本文整理汇总了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');
}
示例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);
}
示例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
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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');
}
示例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);
}
示例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';
}
示例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¶m2=value) into array
示例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);
}
}
}
}
}