Make WordPress Core

Ticket #25515: 25515.3.diff

File 25515.3.diff, 2.1 KB (added by DrewAPicture, 12 years ago)

Final.

  • src/wp-includes/class-wp-embed.php

     
    153153                        foreach ( $handlers as $id => $handler ) {
    154154                                if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) {
    155155                                        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                                                 */
    156165                                                return apply_filters( 'embed_handler_html', $return, $url, $attr );
    157166                                }
    158167                        }
     
    175184                                        return $this->maybe_make_link( $url );
    176185
    177186                                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                                         */
    178197                                        return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
    179198                        }
    180199
     
    187206                        update_post_meta( $post_ID, $cachekey, $cache );
    188207
    189208                        // If there was a result, return it
    190                         if ( $html )
     209                        if ( $html ) {
     210                                //duplicate_hook
    191211                                return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
     212                        }
    192213                }
    193214
    194215                // Still unknown
     
    271292         */
    272293        function maybe_make_link( $url ) {
    273294                $output = ( $this->linkifunknown ) ? '<a href="' . esc_url($url) . '">' . esc_html($url) . '</a>' : $url;
     295
     296                /**
     297                 * Filter the returned, maybe-linked embed URL.
     298                 *
     299                 * @since 2.9.0
     300                 *
     301                 * @param string $output The linked or original URL.
     302                 * @param string $url    The original URL.
     303                 */
    274304                return apply_filters( 'embed_maybe_make_link', $output, $url );
    275305        }
    276306}