Changeset 3476
- Timestamp:
- 06/19/2016 07:34:19 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3468 r3476 39 39 add_action( 'template_redirect', array( $this, 'redirect_old_plugin_urls' ) ); 40 40 add_filter( 'query_vars', array( $this, 'filter_query_vars' ) ); 41 42 // oEmbed whitlisting. 43 add_filter( 'embed_oembed_discover', '__return_false' ); 44 add_filter( 'oembed_providers', array( $this, 'oembed_whitelist' ) ); 41 45 42 46 // Shim in postmeta support for data which doesn't yet live in postmeta … … 688 692 die(); 689 693 } 694 } 695 696 /** 697 * Whitelists the oembed providers whitelist. 698 * 699 * Limited to providers that add video support to plugin readme files. 700 * 701 * @param array $providers An array of popular oEmbed providers. 702 * @return array 703 */ 704 public function oembed_whitelist( $providers ) { 705 return array_filter( $providers, function ( $provider ) { 706 $whitelist = array( 707 'youtube.com', 708 'vimeo.com', 709 'wordpress.com', 710 'wordpress.tv', 711 'vine.co', 712 'soundcloud.com', 713 'instagram.com', 714 'mixcloud.com', 715 'cloudup.com', 716 ); 717 718 foreach ( $whitelist as $url ) { 719 if ( false !== strpos( $provider[0], $url ) ) { 720 return true; 721 } 722 } 723 return false; 724 } ); 690 725 } 691 726
Note: See TracChangeset
for help on using the changeset viewer.