/** * 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'); }
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); }
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 }
/** * 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); } }
/** * 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); }
/** * 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); }
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); }
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); }
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); }
/** * 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); } }
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'); }
/** * 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); }
} } 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'; }
Original version: Johannes Wagener <*****@*****.**> Options support: Tiffany Conroy <*****@*****.**> HTML5 & oEmbed support: Tim Bormans <*****@*****.**> */ /* 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
/** * 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); } } } } }
<?php // guarantee use of https wp_oembed_remove_provider('#https?://(www\\.)?slideshare\\.net/.*#i'); wp_oembed_add_provider('#https?://(www\\.)?slideshare\\.net/.*#i', 'https://www.slideshare.net/api/oembed/2', true); /* * Slideshare shortcode format: * Old style (still compatible): [slideshare id=5342235&doc=camprock-101002163655-phpapp01&w=300&h=200] * New style: [slideshare id=5342235&w=300&h=200&fb=0&mw=0&mh=0&sc=no] * * Legend: * id = Document ID provided by Slideshare * w = Width of iFrame (int) * h = Height of iFrame (int) * fb = iFrame frameborder (int) * mw = iFrame marginwidth (int) * mh = iFrame marginheight (int) * sc = iFrame Scrollbar (yes/no) **/ add_shortcode('slideshare', 'slideshare_shortcode'); function slideshare_shortcode($atts) { global $content_width; $params = shortcode_new_to_old_params($atts); parse_str($params, $arguments); if (empty($arguments)) { return '<!-- SlideShare error: no arguments -->'; } extract($arguments); // check that the Slideshare ID contains letters, numbers and query strings $pattern = '/[^-_a-zA-Z0-9?=&]/';
<?php // Nicer Mesh email subscription output function subscription_email_mesh($existing) { $existing[] = array('regex' => '@<div style=".*?" class="mesh-embed">\\s*<div style="padding-top: 100%"></div>\\s*(?:<p>)<iframe src="(https://me\\.sh.*?)".*?</iframe>\\s*</div>@', 'endpoint' => 'https://me.sh/oembed'); return $existing; } add_filter('subscription_email_oembeds', 'subscription_email_mesh'); wp_oembed_add_provider('#https?://me.sh/.*#i', 'https://me.sh/oembed?format=json', true);
/** * Add this site to the whitelist of oEmbed providers. */ public function add_oembed_provider() { wp_oembed_add_provider(home_url('/*'), esc_url(rest_url('wp/v2/oembed'))); }
function add_oembed_soundcloud() { wp_oembed_add_provider('http://soundcloud.com/*', 'http://api.soundcloud.com/'); }
public function addVimeoOembedCorrectly() { wp_oembed_add_provider('#http://(www\\.)?vimeo\\.com/.*#i', 'http://vimeo.com/api/oembed.{format}', true); }
/** * 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'); }
function playbuzz_oembed_provider_registration() { wp_oembed_add_provider('#https?://(www\\.)?playbuzz.com/.*#i', 'https://www.playbuzz.com/api/oembed/', true); }
function test_add_remove_oembed_provider() { wp_oembed_add_provider( 'http://foo.bar/*', 'http://foo.bar/oembed' ); $this->assertTrue( wp_oembed_remove_provider( 'http://foo.bar/*' ) ); $this->assertFalse( wp_oembed_remove_provider( 'http://foo.bar/*' ) ); }
\t\t\t\t\t\tpd.src = '{$script_url}'; \t\t\t\t\t\ts = d.getElementsByTagName( c )[0]; \t\t\t\t\t\ts.parentNode.insertBefore( pd, s ); \t\t\t\t\t} else if ( typeof jQuery !== 'undefined' ) { \t\t\t\t\t\tjQuery( d.body ).trigger( 'pd-script-load' ); \t\t\t\t\t} \t\t\t\t} ( document, 'script', 'pd-polldaddy-loader' ) ); \t\t\t\t//]]> \t\t\t\t</script> SCRIPT; } } } // kick it all off new PolldaddyShortcode(); if (!function_exists('polldaddy_link')) { // http://polldaddy.com/poll/1562975/?view=results&msg=voted function polldaddy_link($content) { return preg_replace('!(?:\\n|\\A)http://polldaddy.com/poll/([0-9]+?)/(.+)?(?:\\n|\\Z)!i', "\n<script type='text/javascript' language='javascript' charset='utf-8' src='//static.polldaddy.com/p/\$1.js'></script><noscript> <a href='http://polldaddy.com/poll/\$1/' target='_blank'>View Poll</a></noscript>\n", $content); } // higher priority because we need it before auto-link and autop get to it add_filter('the_content', 'polldaddy_link', 1); add_filter('the_content_rss', 'polldaddy_link', 1); /** This filter is documented in modules/shortcodes/youtube.php */ if (apply_filters('jetpack_comments_allow_oembed', get_option('embed_autourls'))) { add_filter('comment_text', 'polldaddy_link', 1); } } wp_oembed_add_provider('#http://poll\\.fm/.*#i', 'http://polldaddy.com/oembed/', true); }
} bwg_activate(); } register_activation_hook(__FILE__, 'bwg_global_activate'); function bwg_new_blog_added($blog_id, $user_id, $domain, $path, $site_id, $meta) { if (is_plugin_active_for_network('photo-gallery/photo-gallery.php')) { global $wpdb; switch_to_blog($blog_id); bwg_activate(); restore_current_blog(); } } add_action('wpmu_new_blog', 'bwg_new_blog_added', 10, 6); /*there is no instagram provider for https*/ wp_oembed_add_provider('#https://instagr(\\.am|am\\.com)/p/.*#i', 'https://api.instagram.com/oembed', true); function bwg_update_hook() { $version = WD_BWG_VERSION; $new_version = '1.3.10'; if ($version && version_compare($version, $new_version, '<')) { require_once WD_BWG_DIR . "/update/bwg_update.php"; bwg_update($version); update_option("wd_bwg_version", $new_version); } } function bwg_global_update() { if (function_exists('is_multisite') && is_multisite()) { global $wpdb; // Get all blog ids.
<?php /* * TED Player embed code * http://www.ted.com * * http://www.ted.com/talks/view/id/210 * http://www.ted.com/talks/marc_goodman_a_vision_of_crimes_in_the_future.html * [ted id="210" lang="eng"] * [ted id="http://www.ted.com/talks/view/id/210" lang="eng"] * [ted id=1539 lang=fr width=560 height=315] */ wp_oembed_add_provider('!https?://(www\\.)?ted.com/talks/view/id/.+!i', 'http://www.ted.com/talks/oembed.json', true); wp_oembed_add_provider('!https?://(www\\.)?ted.com/talks/[a-zA-Z\\-\\_]+\\.html!i', 'http://www.ted.com/talks/oembed.json', true); function jetpack_shortcode_get_ted_id($atts) { return !empty($atts['id']) ? $atts['id'] : 0; } add_shortcode('ted', 'shortcode_ted'); function shortcode_ted($atts, $content = '') { global $wp_embed; $defaults = array('id' => '', 'width' => '', 'height' => '', 'lang' => 'eng'); $atts = shortcode_atts($defaults, $atts, 'ted'); if (empty($atts['id'])) { return '<!-- Missing TED ID -->'; } if (preg_match("#^[\\d]+\$#", $atts['id'], $matches)) { $url = 'http://ted.com/talks/view/id/' . $matches[0]; } elseif (preg_match("#^https?://(www\\.)?ted\\.com/talks/view/id/[0-9]+\$#", $atts['id'], $matches)) { $url = $matches[0];
/** * 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'); }
/** * Add this site to the whitelist of oEmbed providers. */ function wp_oembed_add_site_as_provider() { wp_oembed_add_provider(home_url('/*'), get_oembed_endpoint_url()); }
/** * Enable the Slideshare oEmbed provider */ function enable_openembed() { wp_oembed_add_provider($this->regex, 'http://www.slideshare.net/api/oembed/2', true); }
<?php /** * Adds the ability to embed tweets in posts. */ /*** oEmbed ***/ wp_oembed_add_provider('https://twitter.com/*/statuses/*', 'https://api.twitter.com/1/statuses/oembed.{format}', false); /*** Shortcode ***/ add_shortcode('twitterstatus', 'tweetable_twitterstatus_shortcode'); function tweetable_twitterstatus_shortcode($attributes) { if (empty($attributes['url'])) { return ''; } global $wp_embed; return $wp_embed->shortcode($attributes, $attributes['url']); }