Example #1
0
<?php

/*
Plugin Name: oEmbed Gist
Plugin URI: https://github.com/miya0001/oembed-gist
Description: Embed source from gist.github.
Author: Takayuki Miyauchi
Version: 2.0.1
Author URI: http://firegoby.jp/
*/
$oe_gist = new gist();
$oe_gist->register();
class gist
{
    private $shotcode_tag = 'gist';
    private $noscript;
    private $regex = '#(https://gist.github.com/([^\\/]+\\/)?([a-zA-Z0-9]+)(\\/[a-zA-Z0-9]+)?)(\\#file(\\-|_)(.+))?$#i';
    function register()
    {
        add_action('plugins_loaded', array($this, 'plugins_loaded'));
    }
    public function plugins_loaded()
    {
        add_action('wp_head', array($this, 'wp_head'));
        load_plugin_textdomain('oembed-gist', false, dirname(plugin_basename(__FILE__)) . '/languages');
        wp_embed_register_handler('oe-gist', $this->get_gist_regex(), array($this, 'handler'));
        add_shortcode($this->get_shortcode_tag(), array($this, 'shortcode'));
        add_filter('jetpack_shortcodes_to_include', array($this, 'jetpack_shortcodes_to_include'));
        add_filter('oembed_providers', array($this, 'oembed_providers'));
    }
    public function jetpack_shortcodes_to_include($incs)