Changeset 28846
- Timestamp:
- 06/26/2014 02:29:20 AM (10 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-oembed.php
r28834 r28846 20 20 class WP_oEmbed { 21 21 public $providers = array(); 22 public static $early_providers = array(); 22 23 23 24 /** … … 66 67 ); 67 68 69 if ( ! empty( self::$early_providers['add'] ) ) { 70 foreach ( self::$early_providers['add'] as $format => $data ) { 71 $providers[ $format ] = $data; 72 } 73 } 74 75 if ( ! empty( self::$early_providers['remove'] ) ) { 76 foreach ( self::$early_providers['remove'] as $format ) { 77 unset( $providers[ $format ] ); 78 } 79 } 80 81 self::$early_providers = array(); 82 68 83 /** 69 84 * Filter the list of oEmbed providers. … … 132 147 133 148 return $provider; 149 } 150 151 public static function _add_provider_early( $format, $provider, $regex = false ) { 152 if ( empty( self::$early_providers['add'] ) ) { 153 self::$early_providers['add'] = array(); 154 } 155 156 self::$early_providers['add'][ $format ] = array( $provider, $regex ); 157 } 158 159 public static function _remove_provider_early( $format ) { 160 if ( empty( self::$early_providers['remove'] ) ) { 161 self::$early_providers['remove'] = array(); 162 } 163 164 self::$early_providers['remove'][] = $format; 134 165 } 135 166 -
trunk/src/wp-includes/media.php
r28682 r28846 2136 2136 function wp_oembed_add_provider( $format, $provider, $regex = false ) { 2137 2137 require_once( ABSPATH . WPINC . '/class-oembed.php' ); 2138 $oembed = _wp_oembed_get_object(); 2139 $oembed->providers[$format] = array( $provider, $regex ); 2138 2139 if ( did_action( 'plugins_loaded' ) ) { 2140 $oembed = _wp_oembed_get_object(); 2141 $oembed->providers[$format] = array( $provider, $regex ); 2142 } else { 2143 WP_oEmbed::_add_provider_early( $format, $provider, $regex ); 2144 } 2140 2145 } 2141 2146 … … 2153 2158 require_once( ABSPATH . WPINC . '/class-oembed.php' ); 2154 2159 2155 $oembed = _wp_oembed_get_object(); 2156 2157 if ( isset( $oembed->providers[ $format ] ) ) { 2158 unset( $oembed->providers[ $format ] ); 2159 return true; 2160 if ( did_action( 'plugins_loaded' ) ) { 2161 $oembed = _wp_oembed_get_object(); 2162 2163 if ( isset( $oembed->providers[ $format ] ) ) { 2164 unset( $oembed->providers[ $format ] ); 2165 return true; 2166 } 2167 } else { 2168 WP_oEmbed::_remove_provider_early( $format ); 2160 2169 } 2161 2170
Note: See TracChangeset
for help on using the changeset viewer.