Changeset 4937
- Timestamp:
- 08/06/2011 04:24:46 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-functions.php
r4907 r4937 924 924 $activity_obj = $activity_obj->current_comment; 925 925 } 926 926 927 927 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 ) 928 928 $link = $activity_obj->primary_link; … … 995 995 996 996 /** 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) 998 998 * during the activity loop. If no cache and link is embeddable, cache it. 999 * 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()}. 999 1002 * 1000 1003 * @see BP_Embed … … 1012 1015 1013 1016 /** 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 */ 1027 function 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 } 1032 add_action( 'bp_before_activity_comment', 'bp_activity_comment_embed' ); 1033 1034 /** 1035 * When a user clicks on a "Read More" item, make sure embeds are correctly parsed and shown for the expanded content. 1036 * 1037 * @global object $bp BuddyPress global settings 1038 * @param BP_Activity_Activity $activity The activity that is being expanded 1039 * @see BP_Embed 1040 * @since 1.5 1041 */ 1042 function bp_dtheme_embed_read_more( $activity ) { 1043 global $bp; 1044 1045 $bp->activity->read_more_id = $activity->id; 1046 1047 add_filter( 'embed_post_id', create_function( '', 'global $bp; return $bp->activity->read_more_id;' ) ); 1048 add_filter( 'bp_embed_get_cache', 'bp_embed_activity_cache', 10, 3 ); 1049 add_action( 'bp_embed_update_cache', 'bp_embed_activity_save_cache', 10, 3 ); 1050 } 1051 add_action( 'bp_dtheme_get_single_activity_content', 'bp_dtheme_embed_read_more' ); 1052 1053 /** 1054 * Removes the 'embed_post_id' filter after {@link bp_activity_recurse_comments()} 1055 * is rendered to avoid conflict with the 'embed_post_id' filter in 1056 * {@link bp_activity_embed()} or any other component embeds. 1057 * 1058 * @see bp_activity_comment_embed() 1059 * @package BuddyPress Activity 1060 * @since 1.5 1061 */ 1062 function bp_activity_comment_embed_after_recurse() { 1063 remove_filter( 'embed_post_id', 'bp_get_activity_comment_id' ); 1064 } 1065 add_action( 'bp_after_activity_comment', 'bp_activity_comment_embed_after_recurse' ); 1066 1067 /** 1014 1068 * Wrapper function for {@link bp_activity_get_meta()}. 1015 1069 * Used during {@link BP_Embed::parse_oembed()} via {@link bp_activity_embed()}. -
trunk/bp-core/bp-core-classes.php
r4934 r4937 1169 1169 ksort( $this->handlers ); 1170 1170 foreach ( $this->handlers as $priority => $handlers ) { 1171 foreach ( $handlers as $ id => $handler ) {1171 foreach ( $handlers as $hid => $handler ) { 1172 1172 if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { 1173 1173 if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) ) … … 1178 1178 1179 1179 // Get object ID 1180 $id = apply_filters( 'embed_post_id', $id);1180 $id = apply_filters( 'embed_post_id', 0 ); 1181 1181 1182 1182 // Is oEmbed discovery on? … … 1220 1220 */ 1221 1221 function parse_oembed( $id, $url, $attr, $rawattr ) { 1222 $id = intval( $id ); 1223 1222 1224 if ( $id ) { 1223 1225 // Setup the cachekey … … 1230 1232 // Grab cache and return it if available 1231 1233 if ( !empty( $cache ) ) { 1232 return apply_filters( ' embed_oembed_html', $cache, $url, $attr, $rawattr );1234 return apply_filters( 'bp_embed_oembed_html', $cache, $url, $attr, $rawattr ); 1233 1235 1234 1236 // If no cache, ping the oEmbed provider and cache the result -
trunk/bp-themes/bp-default/_inc/ajax.php
r4920 r4937 340 340 exit(); // todo: error? 341 341 342 // Activity content retrieved through AJAX should run through normal filters, but not be 343 // truncated 342 do_action_ref_array( 'bp_dtheme_get_single_activity_content', array( &$activity ) ); 343 344 // Activity content retrieved through AJAX should run through normal filters, but not be truncated 344 345 remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); 345 346 $content = apply_filters( 'bp_get_activity_content_body', $activity->content ); 346 347 347 348 echo $content; 348 349 349 exit(); 350 350 }
Note: See TracChangeset
for help on using the changeset viewer.