當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_oembed_add_provider函數代碼示例

本文整理匯總了PHP中wp_oembed_add_provider函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_oembed_add_provider函數的具體用法?PHP wp_oembed_add_provider怎麽用?PHP wp_oembed_add_provider使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_oembed_add_provider函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: iweb_register_additional_oembed_providers

/**
 * Register additional oEmbed providers
 * 
 * @author Syed Balkhi
 * @link http://goo.gl/tccJh
 */
function iweb_register_additional_oembed_providers()
{
    wp_oembed_add_provider('http://www.mixcloud.com/*', 'http://www.mixcloud.com/oembed');
}
開發者ID:meowrika,項目名稱:govintranet,代碼行數:10,代碼來源:functions.php

示例2: instagram_oembed_provider

function instagram_oembed_provider()
{
    wp_oembed_add_provider('#https?://(www.)?instagram.com/p/.*#i', 'http://api.instagram.com/oembed', true);
    wp_oembed_add_provider('#https?://(www.)?instagr.am/p/.*#i', 'http://api.instagram.com/oembed', true);
}
開發者ID:plowzzer,項目名稱:PL-portfolio,代碼行數:5,代碼來源:functions.php

示例3: wp_estate_init

 function wp_estate_init()
 {
     global $content_width;
     if (!isset($content_width)) {
         $content_width = 1800;
     }
     load_theme_textdomain('wpestate', get_template_directory() . '/languages');
     set_post_thumbnail_size(940, 198, true);
     add_editor_style();
     add_theme_support('post-thumbnails');
     add_theme_support('automatic-feed-links');
     add_theme_support('custom-background');
     add_theme_support("title-tag");
     wp_estate_setup();
     add_action('widgets_init', 'register_wpestate_widgets');
     add_action('init', 'wpestate_shortcodes');
     wp_oembed_add_provider('#https?://twitter.com/\\#!/[a-z0-9_]{1,20}/status/\\d+#i', 'https://api.twitter.com/1/statuses/oembed.json', true);
     wpestate_image_size();
     add_filter('excerpt_length', 'wp_estate_excerpt_length');
     add_filter('excerpt_more', 'wpestate_new_excerpt_more');
     add_action('tgmpa_register', 'wpestate_required_plugins');
     add_action('wp_enqueue_scripts', 'wpestate_scripts');
     // function in css_js_include.php
     add_action('admin_enqueue_scripts', 'wpestate_admin');
     // function in css_js_include.php
 }
開發者ID:riddya85,項目名稱:rentail_upwrk,代碼行數:26,代碼來源:functions_1.php

示例4: add_facebook

 /**
  * Register Facebook provider
  *
  * @since  1.0.0
  * @param  array $providers Existing providers.
  */
 public function add_facebook($providers)
 {
     $endpoints = array('#https?://www\\.facebook\\.com/video.php.*#i' => 'https://www.facebook.com/plugins/video/oembed.json/', '#https?://www\\.facebook\\.com/.*/videos/.*#i' => 'https://www.facebook.com/plugins/video/oembed.json/', '#https?://www\\.facebook\\.com/.*/posts/.*#i' => 'https://www.facebook.com/plugins/post/oembed.json/', '#https?://www\\.facebook\\.com/.*/activity/.*#i' => 'https://www.facebook.com/plugins/post/oembed.json/', '#https?://www\\.facebook\\.com/photo(s/|.php).*#i' => 'https://www.facebook.com/plugins/post/oembed.json/', '#https?://www\\.facebook\\.com/permalink.php.*#i' => 'https://www.facebook.com/plugins/post/oembed.json/', '#https?://www\\.facebook\\.com/media/.*#i' => 'https://www.facebook.com/plugins/post/oembed.json/', '#https?://www\\.facebook\\.com/questions/.*#i' => 'https://www.facebook.com/plugins/post/oembed.json/', '#https?://www\\.facebook\\.com/notes/.*#i' => 'https://www.facebook.com/plugins/post/oembed.json/');
     foreach ($endpoints as $pattern => $endpoint) {
         wp_oembed_add_provider($pattern, $endpoint, true);
     }
 }
開發者ID:CherryFramework,項目名稱:cherry-framework,代碼行數:13,代碼來源:class-cherry-facebook-embed.php

示例5: register_oembed

 /** 
  *	Register the two URLS that support will be created for
  *
  *	@author		Nate Jacobs
  *	@date		3/9/13
  *	@since		1.0
  */
 public function register_oembed()
 {
     $oembed_url = home_url();
     $key = $this->get_key();
     // Create our own oembed url
     $oembed_url = add_query_arg(array('brickset_oembed' => $key), $oembed_url);
     wp_oembed_add_provider('#https?://(www\\.)?brickset.com/detail/\\?Set\\=.*/?#i', $oembed_url, true);
     wp_oembed_add_provider('#https?://(www\\.)?brickset.com/browse/themes/\\?theme\\=.*/?#i', $oembed_url, true);
 }
開發者ID:pedro-mendonca,項目名稱:Brickset-API,代碼行數:16,代碼來源:class-oembed.php

示例6: 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

示例7: register_dc_oembed_provider

 function register_dc_oembed_provider()
 {
     /*
         Hello developer. If you wish to test this plugin against your
         local installation of DocumentCloud (with its own testing
         domain), set the OEMBED_PROVIDER and OEMBED_RESOURCE_DOMAIN
         constants above to your local testing domain. You'll also want
         to uncomment the next line to let WordPress connect to local
         domains.
     */
     // add_filter( 'http_request_host_is_external', '__return_true');
     wp_oembed_add_provider("http://" . WP_DocumentCloud::OEMBED_RESOURCE_DOMAIN . "/documents/*", WP_DocumentCloud::OEMBED_PROVIDER);
     wp_oembed_add_provider("https://" . WP_DocumentCloud::OEMBED_RESOURCE_DOMAIN . "/documents/*", WP_DocumentCloud::OEMBED_PROVIDER);
 }
開發者ID:eyeseast,項目名稱:wordpress-documentcloud,代碼行數:14,代碼來源:documentcloud.php

示例8: 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

示例9: marcatoxml_plugin

 function marcatoxml_plugin()
 {
     $this->importer = new marcatoxml_importer();
     add_action('admin_menu', array($this, 'build_menus'));
     add_filter('posts_where', array($this, 'posts_where'));
     add_action('init', array($this, 'register_custom_post_types'));
     add_action('init', array($this, 'enqueue_styles'));
     register_activation_hook(__FILE__, array($this, 'flush_rewrites'));
     register_deactivation_hook(__FILE__, array($this, 'flush_rewrites'));
     register_activation_hook(__FILE__, array($this, 'schedule_updates'));
     register_deactivation_hook(__FILE__, array($this, 'unschedule_updates'));
     add_action('marcato_update', array($this, 'cron_job'));
     add_filter('pre_get_posts', array($this, 'query_post_type'));
     add_filter('mce_css', array($this, 'add_mce_css'));
     add_shortcode('marcato-link', array($this, 'marcato_link'));
     add_shortcode('marcato-field', array($this, 'marcato_field'));
     add_shortcode('marcato-thumbnail', array($this, 'marcato_thumbnail'));
     wp_oembed_add_provider('#http://(www\\.)?soundcloud.com/.*#i', 'http://www.soundcloud.com/oembed/', true);
 }
開發者ID:jamiemitchell,項目名稱:marcato_festival_wordpress_plugin,代碼行數:19,代碼來源:marcatoxml.php

示例10: add_oembed

 /**
  * Adds oembed endpoints for supported video platforms that are not supported by core.
  *
  * @since 1.3.5
  */
 public function add_oembed()
 {
     // @todo - check with official plugin
     // Wistia
     $options = get_option('wpseo_video');
     $wistia_regex = '`(?:http[s]?:)?//[^/]*(wistia\\.(com|net)|wi\\.st#CUSTOM_URL#)/(medias|embed)/.*`i';
     if ($options['wistia_domain'] !== '') {
         $wistia_regex = str_replace('#CUSTOM_URL#', '|' . preg_quote($options['wistia_domain'], '`'), $wistia_regex);
     } else {
         $wistia_regex = str_replace('#CUSTOM_URL#', '', $wistia_regex);
     }
     wp_oembed_add_provider($wistia_regex, 'http://fast.wistia.com/oembed', true);
     // Animoto, Ted, Collegehumor - WP native support added in WP 4.0
     if (version_compare($GLOBALS['wp_version'], '3.9.99', '<')) {
         wp_oembed_add_provider('`http[s]?://(?:www\\.)?(animoto|video214)\\.com/play/.*`i', 'http://animoto.com/oembeds/create', true);
         wp_oembed_add_provider('`http[s]?://(www\\.)?collegehumor\\.com/video/.*`i', 'http://www.collegehumor.com/oembed.{format}', true);
         wp_oembed_add_provider('`http[s]?://(www\\.|embed\\.)?ted\\.com/talks/.*`i', 'http://www.ted.com/talks/oembed.{format}', true);
     } else {
         wp_oembed_add_provider('`http[s]?://(?:www\\.)?viddler\\.com/.*`i', 'http://lab.viddler.com/services/oembed/', true);
     }
     // Screenr
     wp_oembed_add_provider('`http[s]?://(?:www\\.)?screenr\\.com/.*`i', 'http://www.screenr.com/api/oembed.{format}', true);
     // EVS
     $evs_location = get_option('evs_location');
     if ($evs_location && !empty($evs_location)) {
         wp_oembed_add_provider($evs_location . '/*', $evs_location . '/oembed.php', false);
     }
 }
開發者ID:bitrecruiter,項目名稱:wordpress-stackable,代碼行數:33,代碼來源:video-seo.php

示例11: novalite_oembed_soundcloud

function novalite_oembed_soundcloud()
{
    wp_oembed_add_provider('http://soundcloud.com/*', 'http://soundcloud.com/oembed');
    wp_oembed_add_provider('https://soundcloud.com/*', 'http://soundcloud.com/oembed');
    wp_oembed_add_provider('#https?://(?:api\\.)?soundcloud\\.com/.*#i', 'http://soundcloud.com/oembed');
}
開發者ID:pbhanu1994,項目名稱:bhanuprakash,代碼行數:6,代碼來源:main.php

示例12: extra_oembed_providers

 /**
  * Add any extra oEmbed providers that we know about and use on wpcom for feature parity.
  */
 function extra_oembed_providers()
 {
     // Cloudup: https://dev.cloudup.com/#oembed
     wp_oembed_add_provider('https://cloudup.com/*', 'https://cloudup.com/oembed');
     wp_oembed_add_provider('https://me.sh/*', 'https://me.sh/oembed?format=json');
     wp_oembed_add_provider('#https?://(www\\.)?gfycat\\.com/.*#i', 'https://api.gfycat.com/v1/oembed', true);
     wp_oembed_add_provider('#https?://[^.]+\\.(wistia\\.com|wi\\.st)/(medias|embed)/.*#', 'https://fast.wistia.com/oembed', true);
     wp_oembed_add_provider('#https?://sketchfab\\.com/.*#i', 'https://sketchfab.com/oembed', true);
 }
開發者ID:jordankoschei,項目名稱:jordankoschei-dot-com,代碼行數:12,代碼來源:class.jetpack.php

示例13: wpcom_force_ssl_home_urls_in_content_when_secure

    }
}
function wpcom_force_ssl_home_urls_in_content_when_secure($content)
{
    if (is_admin()) {
        return $content;
    }
    if (is_ssl()) {
        return str_replace(home_url('/', 'http'), home_url('/', 'https'), $content);
    }
    return str_replace(home_url('/', 'https'), home_url('/', 'http'), $content);
}
add_filter('the_content', 'wpcom_force_ssl_home_urls_in_content_when_secure');
add_filter('comment_text', 'wpcom_force_ssl_home_urls_in_content_when_secure');
add_filter('widget_text', 'wpcom_force_ssl_home_urls_in_content_when_secure');
wp_oembed_add_provider('#https?://[^.]+\\.(wistia\\.com|wi\\.st)/(medias|embed)/.*#', 'https://fast.wistia.com/oembed', true);
/**
 * Load a WordPress.com theme compat file, if it exists.
 */
function wpcom_load_theme_compat_file()
{
    if (!defined('WP_INSTALLING') || 'wp-activate.php' === $GLOBALS['pagenow']) {
        // Many wpcom.php files call $themecolors directly. Ease the pain.
        global $themecolors;
        $template_path = get_template_directory();
        $stylesheet_path = get_stylesheet_directory();
        $file = '/inc/wpcom.php';
        // Look also in /includes as alternate location, since premium theme partners may use that convention.
        if (!file_exists($template_path . $file) && !file_exists($stylesheet_path . $file)) {
            $file = '/includes/wpcom.php';
        }
開發者ID:drrobotnik,項目名稱:vip-quickstart,代碼行數:31,代碼來源:wpcom.php

示例14: out

Original version: Johannes Wagener <johannes@soundcloud.com>
Options support: Tiffany Conroy <tiffany@soundcloud.com>
HTML5 & oEmbed support: Tim Bormans <tim@soundcloud.com>
*/
/*
A8C: Taken from http://plugins.svn.wordpress.org/soundcloud-shortcode/trunk/
at revision 664386.

Commenting out (instead of removing) and replacing code with custom modifs
so it's eqsy to see what differs from the standard DOTORG version.

All custom modifs are annoted with "A8C" keyword in comment.
*/
/* Register oEmbed provider
   -------------------------------------------------------------------------- */
wp_oembed_add_provider('#https?://(?:api\\.)?soundcloud\\.com/.*#i', 'http://soundcloud.com/oembed', true);
/* Register SoundCloud shortcode
   -------------------------------------------------------------------------- */
add_shortcode("soundcloud", "soundcloud");
/**
 * SoundCloud shortcode handler
 * @param  {string|array}  $atts     The attributes passed to the shortcode like [soundcloud attr1="value" /].
 *                                   Is an empty string when no arguments are given.
 * @param  {string}        $content  The content between non-self closing [soundcloud]…[/soundcloud] tags.
 * @return {string}                  Widget embed code HTML
 */
function soundcloud($atts, $content = null)
{
    // Custom shortcode options
    $shortcode_options = array_merge(array('url' => trim($content)), is_array($atts) ? $atts : array());
    // Turn shortcode option "param" (param=value&param2=value) into array
開發者ID:EmreKarahan,項目名稱:wordpress,代碼行數:31,代碼來源:soundcloud.php

示例15: add_embedly_providers

/**
 * Does the work of adding the Embedly providers to wp_oembed
 */
function add_embedly_providers($the_content)
{
    $services = get_embedly_selected_services();
    $embedly_key = get_option('embedly_key');
    require_once ABSPATH . WPINC . '/class-oembed.php';
    $oembed = _wp_oembed_get_object();
    $oembed->providers = array();
    if ($services && get_option('embedly_active')) {
        foreach ($services as $service) {
            foreach (json_decode($service->regex) as $sre) {
                if ($embedly_key) {
                    wp_oembed_add_provider($sre, 'http://api.embed.ly/1/oembed?key=' . $embedly_key, true);
                } else {
                    wp_oembed_add_provider($sre, 'http://api.embed.ly/1/oembed', true);
                }
            }
        }
    }
}
開發者ID:r-a-y,項目名稱:embedly_wordpress_plugin,代碼行數:22,代碼來源:embedly.php


注:本文中的wp_oembed_add_provider函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。