Changeset 10355 for trunk/src/bp-core/classes/class-bp-embed.php
- Timestamp:
- 11/15/2015 07:13:42 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-embed.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-embed.php
r10108 r10355 32 32 // These are providers that use a regex callback on the URL in question. 33 33 // Do not confuse with oEmbed providers, which require an external ping. 34 // Used in WP_Embed::shortcode() 34 // Used in WP_Embed::shortcode(). 35 35 $this->handlers = $wp_embed->handlers; 36 36 … … 83 83 * @param array $attr Shortcode attributes. 84 84 * @param string $url The URL attempting to be embeded. 85 *86 85 * @return string The embed HTML on success, otherwise the original URL. 87 86 */ … … 93 92 $attr = wp_parse_args( $attr, wp_embed_defaults() ); 94 93 95 // kses converts& into & and we need to undo this96 // See https://core.trac.wordpress.org/ticket/11311 94 // Use kses to convert & into & and we need to undo this 95 // See https://core.trac.wordpress.org/ticket/11311. 97 96 $url = str_replace( '&', '&', $url ); 98 97 99 // Look for known internal handlers 98 // Look for known internal handlers. 100 99 ksort( $this->handlers ); 101 100 foreach ( $this->handlers as $priority => $handlers ) { … … 137 136 $attr['discover'] = ( apply_filters( 'bp_embed_oembed_discover', false ) && current_user_can( 'unfiltered_html' ) ); 138 137 139 // Set up a new WP oEmbed object to check URL with registered oEmbed providers 138 // Set up a new WP oEmbed object to check URL with registered oEmbed providers. 140 139 require_once( ABSPATH . WPINC . '/class-oembed.php' ); 141 140 $oembed_obj = _wp_oembed_get_object(); 142 141 143 // If oEmbed discovery is true, skip oEmbed provider check 142 // If oEmbed discovery is true, skip oEmbed provider check. 144 143 $is_oembed_link = false; 145 144 if ( !$attr['discover'] ) { … … 151 150 } 152 151 153 // If url doesn't match a WP oEmbed provider, stop parsing 152 // If url doesn't match a WP oEmbed provider, stop parsing. 154 153 if ( !$is_oembed_link ) 155 154 return $this->maybe_make_link( $url ); … … 176 175 * @param array $rawattr Untouched shortcode attributes from 177 176 * {@link WP_Embed::shortcode()}. 178 *179 177 * @return string The embed HTML on success, otherwise the original URL. 180 178 */ … … 183 181 184 182 if ( $id ) { 185 // Setup the cachekey 183 // Setup the cachekey. 186 184 $cachekey = '_oembed_' . md5( $url . serialize( $attr ) ); 187 185 188 // Let components / plugins grab their cache 186 // Let components / plugins grab their cache. 189 187 $cache = ''; 190 188 … … 203 201 $cache = apply_filters( 'bp_embed_get_cache', $cache, $id, $cachekey, $url, $attr, $rawattr ); 204 202 205 // Grab cache and return it if available 203 // Grab cache and return it if available. 206 204 if ( !empty( $cache ) ) { 207 205 … … 218 216 return apply_filters( 'bp_embed_oembed_html', $cache, $url, $attr, $rawattr ); 219 217 220 // If no cache, ping the oEmbed provider and cache the result 218 // If no cache, ping the oEmbed provider and cache the result. 221 219 } else { 222 220 $html = wp_oembed_get( $url, $attr ); … … 236 234 do_action( 'bp_embed_update_cache', $cache, $cachekey, $id ); 237 235 238 // If there was a result, return it 236 // If there was a result, return it. 239 237 if ( $html ) { 240 238 … … 245 243 } 246 244 247 // Still unknown 245 // Still unknown. 248 246 return $this->maybe_make_link( $url ); 249 247 }
Note: See TracChangeset
for help on using the changeset viewer.