Skip to:
Content

BuddyPress.org

Ticket #3429: 3429.02.patch

File 3429.02.patch, 4.6 KB (added by r-a-y, 9 years ago)
  • bp-activity/bp-activity-functions.php

    function bp_activity_get_permalink( $activity_id, $activity_obj = false ) { 
    923923        if ( isset( $activity_obj->current_comment ) ) {
    924924                $activity_obj = $activity_obj->current_comment;
    925925        }
    926        
     926
    927927        if ( 'new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type )
    928928                $link = $activity_obj->primary_link;
    929929        else {
    function bp_activity_thumbnail_content_images( $content, $link = false ) { 
    994994/** Embeds *******************************************************************/
    995995
    996996/**
    997  * Grabs the activity ID and attempts to retrieve the oEmbed cache (if it exists)
     997 * Grabs the activity update ID and attempts to retrieve the oEmbed cache (if it exists)
    998998 * during the activity loop.  If no cache and link is embeddable, cache it.
    999999 *
     1000 * This does not cover recursive activity comments, as they do not use a real loop.
     1001 * For that, see {@link bp_activity_comment_embed()}.
     1002 *
    10001003 * @see BP_Embed
    10011004 * @see bp_embed_activity_cache()
    10021005 * @see bp_embed_activity_save_cache()
    function bp_activity_embed() { 
    10111014add_action( 'activity_loop_start', 'bp_activity_embed' );
    10121015
    10131016/**
     1017 * Grabs the activity comment ID and attempts to retrieve the oEmbed cache (if it exists)
     1018 * when BP is recursing through activity comments {@link bp_activity_recurse_comments()}.
     1019 * If no cache and link is embeddable, cache it.
     1020 *
     1021 * @see BP_Embed
     1022 * @see bp_embed_activity_cache()
     1023 * @see bp_embed_activity_save_cache()
     1024 * @package BuddyPress Activity
     1025 * @since 1.5
     1026 */
     1027function bp_activity_comment_embed() {
     1028        add_filter( 'embed_post_id',            'bp_get_activity_comment_id' );
     1029        add_filter( 'bp_embed_get_cache',       'bp_embed_activity_cache',      10, 3 );
     1030        add_action( 'bp_embed_update_cache',    'bp_embed_activity_save_cache', 10, 3 );
     1031}
     1032add_action( 'bp_before_activity_comment', 'bp_activity_comment_embed' );
     1033
     1034/**
     1035 * Removes the 'embed_post_id' filter after {@link bp_activity_recurse_comments()}
     1036 * is rendered to avoid conflict with the 'embed_post_id' filter in
     1037 * {@link bp_activity_embed()} or any other component embeds.
     1038 *
     1039 * @see bp_activity_comment_embed()
     1040 * @package BuddyPress Activity
     1041 * @since 1.5
     1042 */
     1043function bp_activity_comment_after_recurse() {
     1044        remove_filter( 'embed_post_id',         'bp_get_activity_comment_id' );
     1045}
     1046add_action( 'bp_after_activity_comment', 'bp_activity_comment_after_recurse' );
     1047
     1048/**
    10141049 * Wrapper function for {@link bp_activity_get_meta()}.
    10151050 * Used during {@link BP_Embed::parse_oembed()} via {@link bp_activity_embed()}.
    10161051 *
  • bp-core/bp-core-classes.php

    class BP_Embed extends WP_Embed { 
    11681168                // Look for known internal handlers
    11691169                ksort( $this->handlers );
    11701170                foreach ( $this->handlers as $priority => $handlers ) {
    1171                         foreach ( $handlers as $id => $handler ) {
     1171                        foreach ( $handlers as $hid => $handler ) {
    11721172                                if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) {
    11731173                                        if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) )
    11741174                                                return apply_filters( 'embed_handler_html', $return, $url, $attr );
    class BP_Embed extends WP_Embed { 
    11771177                }
    11781178
    11791179                // Get object ID
     1180                $id = '';
    11801181                $id = apply_filters( 'embed_post_id', $id );
    11811182
    11821183                // Is oEmbed discovery on?
    class BP_Embed extends WP_Embed { 
    12291230
    12301231                        // Grab cache and return it if available
    12311232                        if ( !empty( $cache ) ) {
    1232                                 return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $rawattr );
     1233                                return apply_filters( 'bp_embed_oembed_html', $cache, $url, $attr, $rawattr );
    12331234
    12341235                        // If no cache, ping the oEmbed provider and cache the result
    12351236                        } else {
  • bp-themes/bp-default/_inc/ajax.php

    function bp_dtheme_get_single_activity_content() { 
    339339        if ( !$activity )
    340340                exit(); // todo: error?
    341341
     342        do_action( 'bp_activity_action_get_single_activity_content', $_POST['activity_id'] );
     343
    342344        // Activity content retrieved through AJAX should run through normal filters, but not be
    343345        // truncated
    344346        remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );