Make WordPress Core

Changeset 25726


Ignore:
Timestamp:
10/08/2013 04:42:20 AM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-includes/class-wp-embed.php.

Props swissspidy, kpdesign.
Fixes #25515.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-embed.php

    r23321 r25726  
    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                }
     
    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
     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
    181209            // Use oEmbed to get the HTML
    182             $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) );
    183210            $html = wp_oembed_get( $url, $attr );
    184211
     
    188215
    189216            // If there was a result, return it
    190             if ( $html )
     217            if ( $html ) {
     218                //duplicate_hook
    191219                return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
     220            }
    192221        }
    193222
     
    220249        $post = get_post( $post_ID );
    221250
    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 ) ) )
    223260            return;
    224261
     
    272309    function maybe_make_link( $url ) {
    273310        $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         */
    274320        return apply_filters( 'embed_maybe_make_link', $output, $url );
    275321    }
Note: See TracChangeset for help on using the changeset viewer.