Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/15/2015 07:13:42 PM (11 years ago)
Author:
tw2113
Message:

More documentation cleanup for part of BP-Core component.

See #6398.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-embed.php

    r10108 r10355  
    3232        // These are providers that use a regex callback on the URL in question.
    3333        // Do not confuse with oEmbed providers, which require an external ping.
    34         // Used in WP_Embed::shortcode()
     34        // Used in WP_Embed::shortcode().
    3535        $this->handlers = $wp_embed->handlers;
    3636
     
    8383     * @param array  $attr Shortcode attributes.
    8484     * @param string $url  The URL attempting to be embeded.
    85      *
    8685     * @return string The embed HTML on success, otherwise the original URL.
    8786     */
     
    9392        $attr = wp_parse_args( $attr, wp_embed_defaults() );
    9493
    95         // kses converts & into & and we need to undo this
    96         // 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.
    9796        $url = str_replace( '&', '&', $url );
    9897
    99         // Look for known internal handlers
     98        // Look for known internal handlers.
    10099        ksort( $this->handlers );
    101100        foreach ( $this->handlers as $priority => $handlers ) {
     
    137136        $attr['discover'] = ( apply_filters( 'bp_embed_oembed_discover', false ) && current_user_can( 'unfiltered_html' ) );
    138137
    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.
    140139        require_once( ABSPATH . WPINC . '/class-oembed.php' );
    141140        $oembed_obj = _wp_oembed_get_object();
    142141
    143         // If oEmbed discovery is true, skip oEmbed provider check
     142        // If oEmbed discovery is true, skip oEmbed provider check.
    144143        $is_oembed_link = false;
    145144        if ( !$attr['discover'] ) {
     
    151150            }
    152151
    153             // If url doesn't match a WP oEmbed provider, stop parsing
     152            // If url doesn't match a WP oEmbed provider, stop parsing.
    154153            if ( !$is_oembed_link )
    155154                return $this->maybe_make_link( $url );
     
    176175     * @param array  $rawattr Untouched shortcode attributes from
    177176     *                        {@link WP_Embed::shortcode()}.
    178      *
    179177     * @return string The embed HTML on success, otherwise the original URL.
    180178     */
     
    183181
    184182        if ( $id ) {
    185             // Setup the cachekey
     183            // Setup the cachekey.
    186184            $cachekey = '_oembed_' . md5( $url . serialize( $attr ) );
    187185
    188             // Let components / plugins grab their cache
     186            // Let components / plugins grab their cache.
    189187            $cache = '';
    190188
     
    203201            $cache = apply_filters( 'bp_embed_get_cache', $cache, $id, $cachekey, $url, $attr, $rawattr );
    204202
    205             // Grab cache and return it if available
     203            // Grab cache and return it if available.
    206204            if ( !empty( $cache ) ) {
    207205
     
    218216                return apply_filters( 'bp_embed_oembed_html', $cache, $url, $attr, $rawattr );
    219217
    220             // If no cache, ping the oEmbed provider and cache the result
     218            // If no cache, ping the oEmbed provider and cache the result.
    221219            } else {
    222220                $html = wp_oembed_get( $url, $attr );
     
    236234                do_action( 'bp_embed_update_cache', $cache, $cachekey, $id );
    237235
    238                 // If there was a result, return it
     236                // If there was a result, return it.
    239237                if ( $html ) {
    240238
     
    245243        }
    246244
    247         // Still unknown
     245        // Still unknown.
    248246        return $this->maybe_make_link( $url );
    249247    }
Note: See TracChangeset for help on using the changeset viewer.