Ticket #3429: 3429.03.patch
File 3429.03.patch, 6.6 KB (added by , 13 years ago) |
---|
-
bp-activity/bp-activity-functions.php
function bp_activity_get_permalink( $activity_id, $activity_obj = false ) { 923 923 if ( isset( $activity_obj->current_comment ) ) { 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; 929 929 else { … … function bp_activity_thumbnail_content_images( $content, $link = false ) { 994 994 /** Embeds *******************************************************************/ 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 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()}. 1002 * 1000 1003 * @see BP_Embed 1001 1004 * @see bp_embed_activity_cache() 1002 1005 * @see bp_embed_activity_save_cache() … … function bp_activity_embed() { 1011 1014 add_action( 'activity_loop_start', 'bp_activity_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 * 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 */ 1043 function bp_activity_comment_embed_after_recurse() { 1044 remove_filter( 'embed_post_id', 'bp_get_activity_comment_id' ); 1045 } 1046 add_action( 'bp_after_activity_comment', 'bp_activity_comment_embed_after_recurse' ); 1047 1048 /** 1014 1049 * Wrapper function for {@link bp_activity_get_meta()}. 1015 1050 * Used during {@link BP_Embed::parse_oembed()} via {@link bp_activity_embed()}. 1016 1051 * -
bp-core/bp-core-classes.php
class BP_Embed extends WP_Embed { 1168 1168 // Look for known internal handlers 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 ) ) 1174 1174 return apply_filters( 'embed_handler_html', $return, $url, $attr ); … … class BP_Embed extends WP_Embed { 1177 1177 } 1178 1178 1179 1179 // Get object ID 1180 $id = ''; 1180 1181 $id = apply_filters( 'embed_post_id', $id ); 1181 1182 1182 1183 // Is oEmbed discovery on? … … class BP_Embed extends WP_Embed { 1219 1220 * @return string The embed HTML on success, otherwise the original URL. 1220 1221 */ 1221 1222 function parse_oembed( $id, $url, $attr, $rawattr ) { 1222 if ( $id) {1223 if ( is_numeric( $id ) ) { 1223 1224 // Setup the cachekey 1224 1225 $cachekey = '_oembed_' . md5( $url . serialize( $attr ) ); 1225 1226 … … class BP_Embed extends WP_Embed { 1229 1230 1230 1231 // Grab cache and return it if available 1231 1232 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 ); 1233 1234 1234 1235 // If no cache, ping the oEmbed provider and cache the result 1235 1236 } else { -
bp-themes/bp-default/_inc/ajax.php
function bp_dtheme_get_single_activity_content() { 339 339 if ( !$activity ) 340 340 exit(); // todo: error? 341 341 342 do_action( 'bp_activity_action_get_single_activity_content', $_POST['activity_id'] ); 343 342 344 // Activity content retrieved through AJAX should run through normal filters, but not be 343 345 // truncated 344 346 remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); -
bp-themes/bp-default/functions.php
if ( !function_exists( 'bp_dtheme_enqueue_scripts' ) ) : 134 134 * @since 1.5 135 135 */ 136 136 function bp_dtheme_enqueue_scripts() { 137 137 138 138 // Bump this when changes are made to bust cache 139 139 $version = '20110729'; 140 140 141 141 // Enqueue the global JS - Ajax will not work without it 142 142 wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ), $version ); 143 143 … … function bp_dtheme_enqueue_styles() { 169 169 170 170 // Bump this when changes are made to bust cache 171 171 $version = '20110731b'; 172 172 173 173 // Default CSS 174 174 wp_enqueue_style( 'bp-default-main', get_template_directory_uri() . '/_inc/css/default.css', array(), $version ); 175 175 … … function bp_dtheme_content_nav( $nav_id ) { 702 702 </div><!-- #<?php echo $nav_id; ?> --> 703 703 <?php endif; 704 704 } 705 706 if ( !function_exists( 'bp_dtheme_embed_expanded_activity' ) ) : 707 /** 708 * When a user clicks on a "Read More" item, make sure embeds are correctly parsed and shown 709 * for the expanded content. 710 * 711 * @param int $activity_id The activity ID that is being expanded 712 * @since 1.5 713 * @see BP_Embed 714 */ 715 function bp_dtheme_embed_expanded_activity( $activity_id ) { 716 add_filter( 'embed_post_id', create_function( '', 'return $activity_id;' ) ); 717 add_filter( 'bp_embed_get_cache', 'bp_embed_activity_cache', 10, 3 ); 718 add_action( 'bp_embed_update_cache', 'bp_embed_activity_save_cache', 10, 3 ); 719 } 720 add_action( 'bp_activity_action_get_single_activity_content', 'bp_dtheme_embed_expanded_activity' ); 721 endif; 722 705 723 ?>