/** * Fix the Facebook embed handling * */ private function _fix_facebook_embed() { // All of these are registered in jetpack/modules/shortcodes/facebook.php if (defined('JETPACK_FACEBOOK_EMBED_REGEX')) { wp_embed_unregister_handler('facebook'); wp_embed_register_handler('facebook', JETPACK_FACEBOOK_EMBED_REGEX, array(__CLASS__, 'facebook_embed_handler')); } if (defined('JETPACK_FACEBOOK_ALTERNATE_EMBED_REGEX')) { wp_embed_unregister_handler('facebook-alternate'); wp_embed_register_handler('facebook-alternate', JETPACK_FACEBOOK_ALTERNATE_EMBED_REGEX, array(__CLASS__, 'facebook_embed_handler')); } if (defined('JETPACK_FACEBOOK_PHOTO_EMBED_REGEX')) { wp_embed_unregister_handler('facebook-photo'); wp_embed_register_handler('facebook-photo', JETPACK_FACEBOOK_PHOTO_EMBED_REGEX, array(__CLASS__, 'facebook_embed_handler')); } if (defined('JETPACK_FACEBOOK_PHOTO_ALTERNATE_EMBED_REGEX')) { wp_embed_unregister_handler('facebook-alternate-photo'); wp_embed_register_handler('facebook-alternate-photo', JETPACK_FACEBOOK_PHOTO_ALTERNATE_EMBED_REGEX, array(__CLASS__, 'facebook_embed_handler')); } if (defined('JETPACK_FACEBOOK_VIDEO_EMBED_REGEX')) { wp_embed_unregister_handler('facebook-video'); wp_embed_register_handler('facebook-video', JETPACK_FACEBOOK_VIDEO_EMBED_REGEX, array(__CLASS__, 'facebook_embed_handler')); } if (defined('JETPACK_FACEBOOK_VIDEO_ALTERNATE_EMBED_REGEX')) { wp_embed_unregister_handler('facebook-alternate-video'); wp_embed_register_handler('facebook-alternate-video', JETPACK_FACEBOOK_VIDEO_ALTERNATE_EMBED_REGEX, array(__CLASS__, 'facebook_embed_handler')); } }
public function test_autoembed_should_return_modified_content() { $handle = rand_str(); $regex = '#https?://example\\.com/embed/([^/]+)#i'; $callback = array($this, '_embed_handler_callback'); wp_embed_register_handler($handle, $regex, $callback); $content = "\nhttp://example.com/embed/foo\n"; $actual = $GLOBALS['wp_embed']->autoembed($content); wp_embed_unregister_handler($handle); $this->assertEquals("\nEmbedded http://example.com/embed/foo\n", $actual); }
function magyar_video_embed() { wp_embed_unregister_handler('vivatvhu'); wp_embed_unregister_handler('mtvcohu'); wp_embed_unregister_handler('mnohu'); wp_embed_unregister_handler('tv2hu'); wp_embed_unregister_handler('rtlhu'); wp_embed_register_handler('vivatvhu', '#http://(www\\.)?vivatv\\.hu/([0-9a-zA-Z\\-\\_\\/]+)/(?:videos)/([0-9a-zA-Z\\-\\_\\/]+)\\-([\\d]+)#i', 'wp_embed_handler_vivatvhu'); wp_embed_register_handler('mtvcohu', '#http://(www\\.)?mtv\\.co\\.hu/([0-9a-zA-Z\\-\\_\\/]+)/(?:videos)/([0-9a-zA-Z\\-\\_\\/]+)\\-([\\d]+)#i', 'wp_embed_handler_mtvcohu'); wp_embed_register_handler('mnohu', '#http://(www\\.)?mno\\.hu/(?:videok)/([\\d]+)#i', 'wp_embed_handler_mnohu'); wp_embed_register_handler('tv2hu', '#http://(www\\.)?tv2\\.hu/(musoraink)/([0-9a-zA-Z\\.\\-\\_]+)/([\\d]+)_([0-9a-zA-Z\\.\\-\\_]+)#i', 'wp_embed_handler_tv2hu'); wp_embed_register_handler('rtlhu', '#http://(www\\.)?rtl\\.hu/(rtlklub)/([0-9a-zA-Z\\-\\_\\/]+)#i', 'wp_embed_handler_rtlhu'); wp_oembed_add_provider('#http://(www\\.)?noltv\\.hu/video/([\\d]+)\\.html#i', 'http://www.noltv.hu/services/oembed', true); wp_oembed_add_provider('#http://(www\\.)?indavideo\\.hu/video/(.*)#i', 'http://www.indavideo.hu/oembed', true); wp_oembed_add_provider('#http://(www\\.)?videa\\.hu/videok/(.*)#i', 'http://videa.hu/oembed', true); wp_oembed_add_provider('#http://(www\\.)?pixter\\.hu/video\\?id=(.*)#i', 'http://www.pixter.hu/oembed.{format}', true); }
public function __construct() { if (is_admin()) { add_action('admin_menu', array($this, 'admin_menu')); $this->edit = true; } $option = get_option('smartideo_option'); if (!empty($option)) { $option = json_decode($option, true); } else { $option = array(); } $this->option = $option; extract($option); if (!empty($strategy)) { $this->strategy = $strategy; } if ($this->strategy != 1) { add_action('wp_enqueue_scripts', array($this, 'smartideo_scripts')); } wp_embed_unregister_handler('youku'); wp_embed_unregister_handler('tudou'); wp_embed_unregister_handler('56com'); wp_embed_unregister_handler('youtube'); // video wp_embed_register_handler('smartideo_tudou', '#https?://(?:www\\.)?tudou\\.com/(?:programs/view|listplay/(?<list_id>[a-z0-9_=\\-]+))/(?<video_id>[a-z0-9_=\\-]+)/#i', array($this, 'smartideo_embed_handler_tudou')); wp_embed_register_handler('smartideo_56', '#https?://(?:www\\.)?56\\.com/[a-z0-9]+/(?:play_album\\-aid\\-[0-9]+_vid\\-(?<video_id1>[a-z0-9_=\\-]+)|v_(?<video_id2>[a-z0-9_=\\-]+))#i', array($this, 'smartideo_embed_handler_56')); wp_embed_register_handler('smartideo_youku', '#https?://v\\.youku\\.com/v_show/id_(?<video_id>[a-z0-9_=\\-]+)#i', array($this, 'smartideo_embed_handler_youku')); wp_embed_register_handler('smartideo_qq', '#https?://v\\.qq\\.com/(?:[a-z0-9_\\./]+\\?vid=(?<video_id1>[a-z0-9_=\\-]+)|(?:[a-z0-9/]+)/(?<video_id2>[a-z0-9_=\\-]+))#i', array($this, 'smartideo_embed_handler_qq')); wp_embed_register_handler('smartideo_sohu', '#https?://my\\.tv\\.sohu\\.com/(?:pl|us)/(?:\\d+)/(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_sohu')); wp_embed_register_handler('smartideo_wasu', '#https?://www\\.wasu\\.cn/play/show/id/(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_wasu')); wp_embed_register_handler('smartideo_yinyuetai', '#https?://v\\.yinyuetai\\.com/video/(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_yinyuetai')); wp_embed_register_handler('smartideo_ku6', '#https?://v\\.ku6\\.com/show/(?<video_id>[a-z0-9\\-_\\.]+).html#i', array($this, 'smartideo_embed_handler_ku6')); wp_embed_register_handler('smartideo_letv', '#https?://(?:[a-z0-9/]+\\.)?letv\\.com/(?:[a-z0-9/]+)/(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_letv')); wp_embed_register_handler('smartideo_hunantv', '#https?://www\\.hunantv\\.com/(?:[a-z0-9/]+)/(?<video_id>\\d+)\\.html#i', array($this, 'smartideo_embed_handler_hunantv')); wp_embed_register_handler('smartideo_acfun', '#https?://www\\.acfun\\.tv/v/ac(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_acfun')); wp_embed_register_handler('smartideo_bilibili', '#https?://www\\.bilibili\\.com/video/av(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_bilibili')); wp_embed_register_handler('smartideo_youtube', '#https?://www\\.youtube\\.com/watch\\?v=(?<video_id>\\w+)#i', array($this, 'smartideo_embed_handler_youtube')); // music wp_embed_register_handler('smartideo_music163', '#https?://music\\.163\\.com/\\#/song\\?id=(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_music163')); wp_embed_register_handler('smartideo_xiami', '#https?://www\\.xiami\\.com/song/(?<video_id>\\d+)#i', array($this, 'smartideo_embed_handler_xiami')); }
public function unregister_embed() { wp_embed_unregister_handler('amp-instagram', -1); remove_shortcode('instagram'); }
public function unregister_embed() { remove_shortcode('tweet'); wp_embed_unregister_handler('amp-twitter', -1); }
public function unregister_embed() { wp_embed_unregister_handler('amp-youtube', -1); remove_shortcode('youtube'); }
public function unregister_embed() { wp_embed_unregister_handler('amp-vine', -1); }
/** * Remove the Wordpress default Oembed support for video providers that ARVE Supports. Array taken from wp-includes/class-oembed.php __construct * * @since 5.9.9 * */ public function oembed_remove_providers() { $wp_core_oembed_shits = array('#http://(www\\.)?youtube\\.com/watch.*#i' => array('http://www.youtube.com/oembed', true), '#https://(www\\.)?youtube\\.com/watch.*#i' => array('http://www.youtube.com/oembed?scheme=https', true), '#http://youtu\\.be/.*#i' => array('http://www.youtube.com/oembed', true), '#https://youtu\\.be/.*#i' => array('http://www.youtube.com/oembed?scheme=https', true), 'http://blip.tv/*' => array('http://blip.tv/oembed/', false), '#https?://(.+\\.)?vimeo\\.com/.*#i' => array('http://vimeo.com/api/oembed.{format}', true), '#https?://(www\\.)?dailymotion\\.com/.*#i' => array('http://www.dailymotion.com/services/oembed', true), 'http://dai.ly/*' => array('http://www.dailymotion.com/services/oembed', false), '#https?://(www\\.)?funnyordie\\.com/videos/.*#i' => array('http://www.funnyordie.com/oembed', true), '#https?://vine.co/v/.*#i' => array('https://vine.co/oembed.{format}', true), '#https?://(www\\.)?collegehumor\\.com/video/.*#i' => array('http://www.collegehumor.com/oembed.{format}', true), '#https?://(www\\.|embed\\.)?ted\\.com/talks/.*#i' => array('http://www.ted.com/talks/oembed.{format}', true)); foreach ($wp_core_oembed_shits as $shit => $f**k) { wp_oembed_remove_provider($shit); } // Jetpack shit remove_shortcode('dailymotion', 'dailymotion_shortcode'); remove_filter('pre_kses', 'jetpack_dailymotion_embed_reversal'); remove_filter('pre_kses', 'dailymotion_embed_to_shortcode'); remove_shortcode('vimeo', 'vimeo_shortcode'); remove_filter('pre_kses', 'vimeo_embed_to_shortcode'); wp_embed_unregister_handler('jetpack_vine'); remove_shortcode('vine', 'vine_shortcode'); remove_filter('pre_kses', 'youtube_embed_to_short_code'); remove_shortcode('youtube', 'youtube_shortcode'); remove_shortcode('ted', 'shortcode_ted'); wp_oembed_remove_provider('!https?://(www\\.)?ted.com/talks/view/id/.+!i'); wp_oembed_remove_provider('!https?://(www\\.)?ted.com/talks/[a-zA-Z\\-\\_]+\\.html!i'); remove_filter('pre_kses', 'blip_embed_to_shortcode'); remove_shortcode('blip.tv', 'blip_shortcode'); }
private function __construct() { wp_embed_unregister_handler('codepen'); }
public function unregister_embed() { wp_embed_unregister_handler('amp-facebook', -1); }
} wp_embed_register_handler('youku_iframe', '#http://v.youku.com/v_show/id_(.*?).html#i', 'wp_iframe_handler_youku'); // add tudou using iframe function wp_iframe_handler_tudou($matches, $attr, $url, $rawattr) { if (wp_is_mobile()) { $height = 250; } else { $height = 485; } $iframe = '<iframe width=100% height=' . $height . 'px src="http://www.tudou.com/programs/view/html5embed.action?code=' . esc_attr($matches[1]) . '" frameborder=0 allowfullscreen></iframe>'; return apply_filters('iframe_tudou', $iframe, $matches, $attr, $url, $ramattr); } wp_embed_register_handler('tudou_iframe', '#http://www.tudou.com/programs/view/(.*?)/#i', 'wp_iframe_handler_tudou'); wp_embed_unregister_handler('youku'); wp_embed_unregister_handler('tudou'); //后台快捷键回复 function hui_admin_comment_ctrlenter() { echo '<script type="text/javascript"> jQuery(document).ready(function($){ $("textarea").keypress(function(e){ if(e.ctrlKey&&e.which==13||e.which==10){ $("#replybtn").click(); } }); }); </script>'; } add_action('admin_footer', 'hui_admin_comment_ctrlenter'); //获取所有站点分类id