当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_embed_register_handler函数代码示例

本文整理汇总了PHP中wp_embed_register_handler函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_embed_register_handler函数的具体用法?PHP wp_embed_register_handler怎么用?PHP wp_embed_register_handler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_embed_register_handler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _fix_facebook_embed

 /**
  * 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'));
     }
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:32,代码来源:class-instant-articles-jetpack.php

示例2: 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'));
 }
开发者ID:shizhua,项目名称:oembed-gist,代码行数:8,代码来源:oembed-gist.php

示例3: init

 /**
  * Register shortcode macro and handler
  *
  * @since 1.3.0
  *
  * @return void
  */
 public static function init()
 {
     add_shortcode(static::SHORTCODE_TAG, array(__CLASS__, 'shortcodeHandler'));
     // pass a Periscope profile URL through the Periscope On Air shortcode handler
     wp_embed_register_handler(self::SHORTCODE_TAG, static::PERISCOPE_PROFILE_URL_REGEX, array(__CLASS__, 'linkHandler'), 1);
     // Shortcode UI, if supported
     add_action('register_shortcode_ui', array(__CLASS__, 'shortcodeUI'), 5, 0);
 }
开发者ID:cemoulto,项目名称:wordpress,代码行数:15,代码来源:PeriscopeOnAir.php

示例4: plugins_loaded

 public function plugins_loaded()
 {
     add_action('wp_enqueue_scripts', array($this, 'enquene_script'));
     add_action('wp_head', array($this, 'wp_head'));
     load_plugin_textdomain('oembed-travis', false, plugins_url(implode(array('languages'), DIRECTORY_SEPARATOR), __FILE__));
     wp_embed_register_handler('oembed-travis', $this->get_travis_url_regex(), array($this, 'handler'));
     add_shortcode($this->get_shortcode_tag(), array($this, 'shortcode'));
 }
开发者ID:kamataryo,项目名称:oembed-travis,代码行数:8,代码来源:oembed-travis.php

示例5: run

 /**
  * Set up the plugin.
  *
  * Adds a [gist] shortcode to do the bulk of the heavy lifting. An embed
  * handler is registered to mimic oEmbed functionality, but it relies on
  * the shortcode for processing.
  *
  * Supported formats:
  *
  * * Old link: https://gist.github.com/{{id}}#file_{{filename}}
  * * Old link with username: https://gist.github.com/{{user}}/{{id}}#file_{{filename}}
  * * New bookmark: https://gist.github.com/{{id}}#file-{{file_slug}}
  * * New bookmark with username: https://gist.github.com/{{user}}/{{id}}#file-{{sanitized-filename}}
  *
  * @since 1.1.0
  */
 public function run()
 {
     $oembed_pattern = '#https://gist\\.github\\.com/(?:.*/)?([a-z0-9]+)(?:\\#file([_-])(.*))?#i';
     wp_embed_register_handler('gist', $oembed_pattern, array($this, 'wp_embed_handler'));
     add_shortcode('gist', array($this, 'shortcode'));
     add_action('init', array($this, 'style'), 15);
     add_action('post_updated', array($this, 'delete_gist_transients'), 10, 3);
 }
开发者ID:shizhua,项目名称:gistpress,代码行数:24,代码来源:class-gistpress.php

示例6: init

 public static function init()
 {
     /**
      * Add new handler
      * provider
      * e.g. <iframe src='https://fr.tuto.com/embed/preview/53781/' width='560' height='356' frameborder='0' scrolling='auto' allowfullscreen></iframe>
      */
     wp_embed_register_handler('embed-tuto', apply_filters('tuto_oembed/regex', '#https?:\\/\\/fr\\.tuto\\.com\\/embed\\/preview\\/([\\d]+)\\/?#i'), array(__CLASS__, 'register_handler'));
 }
开发者ID:TweetPressFr,项目名称:tuto-oembed-wp,代码行数:9,代码来源:tuto-oembed-wp.php

示例7: plugins_loaded

 function plugins_loaded()
 {
     if (!defined('NPR_API_KEY_OPTION')) {
         return;
     }
     // http://www.npr.org/2010/11/20/131472499/hours-so-early-holiday-shoppers-stay-up-late
     wp_embed_register_handler('npr_api', '#http://www.npr.org/\\d{4}/\\d{1,2}/\\d{1,2}/(\\d{7,})/#i', array(&$this, 'embed_callback'));
     add_action('save_post', array(&$this, 'save_post'), 10, 2);
 }
开发者ID:appliaison,项目名称:WP-NPR-API,代码行数:9,代码来源:embed.php

示例8: init

 /**
  * Register shortcode macro and handler
  *
  * @since 1.0.0
  *
  * @return void
  */
 public static function init()
 {
     $classname = get_called_class();
     add_shortcode(static::SHORTCODE_TAG, array($classname, 'shortcodeHandler'));
     // convert a URL into the shortcode equivalent
     wp_embed_register_handler(static::SHORTCODE_TAG, static::URL_REGEX, array($classname, 'linkHandler'), 1);
     // Shortcode UI, if supported
     add_action('register_shortcode_ui', array($classname, 'shortcodeUI'), 5, 0);
 }
开发者ID:cemoulto,项目名称:wordpress,代码行数:16,代码来源:Follow.php

示例9: test_autoembed_should_return_modified_content

 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);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:11,代码来源:WpEmbed.php

示例10: init

 /**
  * Attach handlers for Vine embeds
  *
  * @since 1.0.0
  *
  * @return void
  */
 public static function init()
 {
     // register our shortcode and its handler
     add_shortcode(self::SHORTCODE_TAG, array(__CLASS__, 'shortcodeHandler'));
     // register a preferred handler for the Vine URL pattern
     // matched URLs execute before the oEmbed handlers
     wp_embed_register_handler(self::SHORTCODE_TAG, self::URL_PATTERN, array(__CLASS__, 'linkHandler'), 1);
     // add Vine to the list of allowed oEmbed providers
     // fallback for functions that go straight to oEmbed
     wp_oembed_add_provider(self::URL_PATTERN, 'https://vine.co/oembed.{format}', true);
 }
开发者ID:StudentLifeMarketingAndDesign,项目名称:krui-wp,代码行数:18,代码来源:Vine.php

示例11: addPlugin

 public function addPlugin($plugin)
 {
     $reflClass = new \ReflectionClass($plugin);
     if (!$this->getAnnotationReader()->getClassAnnotation($reflClass, 'Oow\\Plugin\\Annotations\\Plugin')) {
         throw new \InvalidArgumentException("{$reflClass->getName()} does not have any Oow\\Plugin\\Annotations\\Plugin annotation instance");
     }
     foreach ($reflClass->getMethods() as $method) {
         if ($method->isPublic()) {
             foreach ($this->getAnnotationReader()->getMethodAnnotations($method) as $annot) {
                 if ($annot instanceof Annotations\Hook) {
                     $tag = $annot->tag;
                     $function_to_add = array($plugin, $method->getName());
                     $priority = $annot->priority;
                     $accepted_args = $method->getNumberOfParameters();
                     add_filter($tag, $function_to_add, $priority, $accepted_args);
                 } elseif ($annot instanceof Annotations\Settings) {
                     $this->addPlugin($plugin->{$method->getName()}());
                 } elseif ($annot instanceof Annotations\Shortcode) {
                     $tag = $annot->tag;
                     $func = array($plugin, $method->getName());
                     add_shortcode($tag, $func);
                 } elseif ($annot instanceof Annotations\AjaxResponse) {
                     $closure = function () use($plugin, $method, $annot) {
                         if (isset($_REQUEST['_wpnonce']) && !wp_verify_nonce($_REQUEST['_wpnonce'], $annot->action)) {
                             $response = false;
                         } else {
                             $response = $plugin->{$method->getName()}();
                         }
                         if ($annot->json) {
                             wp_send_json($response);
                         } else {
                             echo $response;
                             wp_die();
                         }
                     };
                     add_action('wp_ajax_' . $annot->action, $closure);
                     if ($annot->nopriv) {
                         add_action('wp_ajax_nopriv_' . $annot->action, $closure);
                     }
                 } elseif ($annot instanceof Annotations\Embed) {
                     $id = $annot->id;
                     $regex = $annot->regex;
                     $func = array($plugin, $method->getName());
                     $priority = $annot->priority;
                     wp_embed_register_handler($id, $regex, $func, $priority);
                 }
             }
         }
     }
     return $this;
 }
开发者ID:akky,项目名称:auto-currency-converter,代码行数:51,代码来源:PluginManager.php

示例12: init

 /**
  * Register shortcode handlers
  *
  * @since 1.1.6
  *
  * @uses add_shortcode()
  * @uses wp_embed_register_handler()
  * @return void
  */
 public static function init()
 {
     // expose social plugin markup using WordPress Shortcode API
     add_shortcode('facebook_like_button', array('Facebook_Shortcodes', 'like_button'));
     add_shortcode('facebook_send_button', array('Facebook_Shortcodes', 'send_button'));
     add_shortcode('facebook_follow_button', array('Facebook_Shortcodes', 'follow_button'));
     add_shortcode('facebook_embedded_post', array('Facebook_Shortcodes', 'embedded_post'));
     // Convert a Facebook URL possibly representing a public post into Facebook embedded post markup
     wp_embed_register_handler('facebook_embedded_post_vanity', '#^https?://www\\.facebook\\.com/([A-Za-z0-9\\.-]{2,50})/posts/([\\d]+)#i', array('Facebook_Shortcodes', 'wp_embed_handler_embedded_post'));
     wp_embed_register_handler('facebook_embedded_post_no_vanity', '#^https?://www\\.facebook\\.com/permalink\\.php\\?story_fbid=([\\d]+)&id=([\\d]+)#i', array('Facebook_Shortcodes', 'wp_embed_handler_embedded_post'));
     wp_embed_register_handler('facebook_embedded_post_activity', '#^https?://www\\.facebook\\.com/([A-Za-z0-9\\.-]{2,50})/activity/([\\d]+)#i', array('Facebook_Shortcodes', 'wp_embed_handler_embedded_post'));
     wp_embed_register_handler('facebook_embedded_post_question', '#^https?://www\\.facebook\\.com/questions/([\\d]+)#i', array('Facebook_Shortcodes', 'wp_embed_handler_embedded_post'));
     wp_embed_register_handler('facebook_embedded_post_photo', '#^https?://www\\.facebook\\.com/photo\\.php\\?fbid=([\\d]+)#i', array('Facebook_Shortcodes', 'wp_embed_handler_embedded_post'));
     wp_embed_register_handler('facebook_embedded_post_video', '#^https?://www\\.facebook\\.com/photo\\.php\\?v=([\\d]+)#i', array('Facebook_Shortcodes', 'wp_embed_handler_embedded_post'));
     wp_embed_register_handler('facebook_embedded_post_note', '#^https?://www\\.facebook\\.com/notes/([A-Za-z0-9\\.-]{2,50})/([^/]+)/([\\d]+)#i', array('Facebook_Shortcodes', 'wp_embed_handler_embedded_post'));
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:25,代码来源:shortcodes.php

示例13: magyar_video_embed

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);
}
开发者ID:AniPalace,项目名称:FansubPress,代码行数:17,代码来源:magyar-video-embed.php

示例14: __construct

 public function __construct()
 {
     // Initialize private defaults.
     $this->prefix = $this->shortcode . '_';
     $this->dt_defaults = json_encode(array('dom' => "B<'clear'>lfrtip", 'buttons' => array('colvis', 'copy', 'csv', 'excel', 'pdf', 'print')));
     $this->capabilities = array($this->prefix . 'query_sql_databases');
     add_action('plugins_loaded', array($this, 'registerL10n'));
     add_action('init', array($this, 'maybeFetchGvizDataSource'));
     add_action('admin_init', array($this, 'registerSettings'));
     add_action('admin_menu', array($this, 'registerAdminMenu'));
     add_action('admin_head', array($this, 'doAdminHeadActions'));
     add_action('admin_enqueue_scripts', array($this, 'addAdminScripts'));
     add_action('admin_print_footer_scripts', array($this, 'addQuickTagButton'));
     add_action('wp_enqueue_scripts', array($this, 'addFrontEndScripts'));
     add_shortcode($this->shortcode, array($this, 'displayShortcode'));
     wp_embed_register_handler($this->shortcode . 'spreadsheet', $this->gdoc_url_regex, array($this, 'oEmbedHandler'));
     register_activation_hook(__FILE__, array($this, 'activate'));
 }
开发者ID:jgadbois,项目名称:inline-gdocs-viewer,代码行数:18,代码来源:inline-gdocs-viewer.php

示例15: __construct

 /**
  * add filters
  */
 public function __construct()
 {
     add_filter('wpv_multiwidget_tab_title', array(&$this, 'multiwidget_tab_title'), 10, 3);
     add_action('wpv_multiwidget_single_title', array(&$this, 'multiwidget_single_title'), 10, 2);
     add_filter('wpv_posts_widget_thumbnail_name', array(&$this, 'posts_widget_thumbnail_name'), 10, 2);
     add_filter('wpv_posts_widget_img_size', array(&$this, 'posts_widget_img_size'), 10, 2);
     add_filter('wpv_column_title', array(&$this, 'column_title'), 10, 2);
     add_filter('excerpt_length', array(&$this, 'excerpt_length'));
     add_filter('excerpt_more', array(&$this, 'excerpt_more'));
     add_filter('wp_title', array(__CLASS__, 'wp_title'));
     remove_filter('the_content', 'li_display_love_link', 100);
     wp_embed_register_handler('wpv-swf', '#https?://[^\\s]+?.swf$#i', array(__CLASS__, 'embed_handler_swf'));
     add_filter('pre_option_page_for_posts', create_function('$value', 'return 0;'));
     add_filter('oembed_dataparse', array(&$this, 'oembed_dataparse'), 90, 3);
     add_action('layerslider_ready', array(&$this, 'layerslider_ready'));
     add_filter('nav_menu_css_class', array(__CLASS__, 'nav_menu_css_class'), 10, 3);
     add_action('wpv_before_post_content', array(__CLASS__, 'single_sermon_media'));
     add_action('wpv_body', array(__CLASS__, 'wpv_splash_screen'));
 }
开发者ID:petrfaitl,项目名称:wordpress-event-theme,代码行数:22,代码来源:shortcode-overrides.php


注:本文中的wp_embed_register_handler函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。