Changeset 25726
- Timestamp:
- 10/08/2013 04:42:20 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-embed.php
r23321 r25726 154 154 if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { 155 155 if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) ) 156 /** 157 * Filter the returned embed handler. 158 * 159 * @since 2.9.0 160 * 161 * @param mixed $return The shortcode callback function to call. 162 * @param string $url The attempted embed URL. 163 * @param array $attr An array of shortcode attributes. 164 */ 156 165 return apply_filters( 'embed_handler_html', $return, $url, $attr ); 157 166 } … … 176 185 177 186 if ( ! empty( $cache ) ) 187 /** 188 * Filter the cached oEmbed HTML. 189 * 190 * @since 2.9.0 191 * 192 * @param mixed $cache The cached HTML result, stored in post meta. 193 * @param string $url The attempted embed URL. 194 * @param array $attr An array of shortcode attributes. 195 * @param int $post_ID Post ID. 196 */ 178 197 return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID ); 179 198 } 180 199 200 /** 201 * Filter whether to inspect the given URL for discoverable <link> tags. 202 * 203 * @see WP_oEmbed::discover() 204 * 205 * @param bool false Whether to enable <link> tag discovery. Default false. 206 */ 207 $attr['discover'] = ( apply_filters( 'embed_oembed_discover', false ) && author_can( $post_ID, 'unfiltered_html' ) ); 208 181 209 // Use oEmbed to get the HTML 182 $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) );183 210 $html = wp_oembed_get( $url, $attr ); 184 211 … … 188 215 189 216 // If there was a result, return it 190 if ( $html ) 217 if ( $html ) { 218 //duplicate_hook 191 219 return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID ); 220 } 192 221 } 193 222 … … 220 249 $post = get_post( $post_ID ); 221 250 222 if ( empty($post->ID) || !in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', array( 'post', 'page' ) ) ) ) 251 $post_types = array( 'post', 'page' ); 252 /** 253 * Filter the array of post types to cache oEmbed results for. 254 * 255 * @since 2.9.0 256 * 257 * @param array $post_types Array of post types to cache oEmbed results for. Default 'post', 'page'. 258 */ 259 if ( empty($post->ID) || !in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ) 223 260 return; 224 261 … … 272 309 function maybe_make_link( $url ) { 273 310 $output = ( $this->linkifunknown ) ? '<a href="' . esc_url($url) . '">' . esc_html($url) . '</a>' : $url; 311 312 /** 313 * Filter the returned, maybe-linked embed URL. 314 * 315 * @since 2.9.0 316 * 317 * @param string $output The linked or original URL. 318 * @param string $url The original URL. 319 */ 274 320 return apply_filters( 'embed_maybe_make_link', $output, $url ); 275 321 }
Note: See TracChangeset
for help on using the changeset viewer.