Changeset 3778 for trunk/bp-activity/bp-activity-template.php
- Timestamp:
- 01/21/2011 12:03:25 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-activity/bp-activity-template.php (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-template.php
r3755 r3778 218 218 * pass their parameters directly to the loop. 219 219 */ 220 $user_id = false;221 $include = false;222 $exclude = false;223 $in = false;220 $user_id = false; 221 $include = false; 222 $exclude = false; 223 $in = false; 224 224 $show_hidden = false; 225 $object = false;226 $primary_id = false;225 $object = false; 226 $primary_id = false; 227 227 228 228 // User filtering … … 309 309 $primary_id = implode( ',', (array)$groups['groups'] ); 310 310 311 $user_id = false;311 $user_id = 0; 312 312 } 313 313 break; … … 324 324 $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ) . '<'; // Start search at @ symbol and stop search at closing tag delimiter. 325 325 $display_comments = 'stream'; 326 $user_id = false;326 $user_id = 0; 327 327 break; 328 328 } … … 330 330 } 331 331 332 if ( $max ) { 333 if ( $per_page > $max ) 334 $per_page = $max; 335 } 332 // Do not exceed the maximum per page 333 if ( !empty( $max ) && ( (int)$per_page > (int)$max ) ) 334 $per_page = $max; 336 335 337 336 // Support for basic filters in earlier BP versions. … … 365 364 366 365 $start_num = intval( ( $activities_template->pag_page - 1 ) * $activities_template->pag_num ) + 1; 367 $from_num = bp_core_number_format( $start_num );368 $to_num = bp_core_number_format( ( $start_num + ( $activities_template->pag_num - 1 ) > $activities_template->total_activity_count ) ? $activities_template->total_activity_count : $start_num + ( $activities_template->pag_num - 1 ) );369 $total = bp_core_number_format( $activities_template->total_activity_count );366 $from_num = bp_core_number_format( $start_num ); 367 $to_num = bp_core_number_format( ( $start_num + ( $activities_template->pag_num - 1 ) > $activities_template->total_activity_count ) ? $activities_template->total_activity_count : $start_num + ( $activities_template->pag_num - 1 ) ); 368 $total = bp_core_number_format( $activities_template->total_activity_count ); 370 369 371 370 return sprintf( __( 'Viewing item %1$s to %2$s (of %3$s items)', 'buddypress' ), $from_num, $to_num, $total ) . ' <span class="ajax-loader"></span>'; … … 393 392 394 393 $remaining_pages = floor( ( $activities_template->total_activity_count - 1 ) / ( $activities_template->pag_num * $activities_template->pag_page ) ); 395 396 $has_more_items = (int)$remaining_pages ? true : false; 394 $has_more_items = (int)$remaining_pages ? true : false; 397 395 398 396 return apply_filters( 'bp_activity_has_more_items', $has_more_items ); … … 646 644 647 645 $action = $activities_template->activity->action; 648 649 646 $action = apply_filters( 'bp_get_activity_action_pre_meta', $action, &$activities_template->activity ); 650 647 … … 661 658 global $activities_template; 662 659 663 / * Backwards compatibility if action is not being used */660 // Backwards compatibility if action is not being used 664 661 if ( empty( $activities_template->activity->action ) && !empty( $activities_template->activity->content ) ) 665 662 $activities_template->activity->content = bp_insert_activity_meta( $activities_template->activity->content ); … … 744 741 extract( $r, EXTR_SKIP ); 745 742 746 / * Get the ID of the parent activity content */743 // Get the ID of the parent activity content 747 744 if ( !$parent_id = $activities_template->activity->item_id ) 748 745 return false; 749 746 750 / * Get the content of the parent */747 // Get the content of the parent 751 748 if ( empty( $activities_template->activity_parents[$parent_id] ) ) 752 749 return false; … … 757 754 $content = $activities_template->activity_parents[$parent_id]->action . ' ' . $activities_template->activity_parents[$parent_id]->content; 758 755 759 / * Remove the time since content for backwards compatibility */756 // Remove the time since content for backwards compatibility 760 757 $content = str_replace( '<span class="time-since">%s</span>', '', $content ); 761 758 762 / * Remove images */759 // Remove images 763 760 $content = preg_replace( '/<img[^>]*>/Ui', '', $content ); 764 761 … … 788 785 return apply_filters( 'bp_activity_get_comments', $comments_html ); 789 786 } 790 /* TODO: The HTML in this function is temporary and will be moved to the template in a future version. */ 787 // TODO: The HTML in this function is temporary and will be moved 788 // to the template in a future version 791 789 function bp_activity_recurse_comments( $comment ) { 792 790 global $activities_template, $bp; … … 804 802 $content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_acomment_name', $comment->user_fullname, $comment ) . '</a> · ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $comment->date_recorded ) ); 805 803 806 /* Reply link - the span is so that threaded reply links can be hidden when JS is off. */ 804 // Reply link - the span is so that threaded reply links can be 805 // hidden when JS is off. 807 806 if ( is_user_logged_in() && bp_activity_can_comment_reply( $comment ) ) 808 807 $content .= apply_filters( 'bp_activity_comment_reply_link', '<span class="acomment-replylink"> · <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>', $comment ); 809 808 810 / * Delete link */809 // Delete link 811 810 if ( $bp->loggedin_user->is_super_admin || $bp->loggedin_user->id == $comment->user_id ) { 812 811 $delete_url = wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ); … … 950 949 } 951 950 952 function bp_activity_latest_update( $user_id = false) {951 function bp_activity_latest_update( $user_id = 0 ) { 953 952 echo bp_get_activity_latest_update( $user_id ); 954 953 } 955 function bp_get_activity_latest_update( $user_id = false) {954 function bp_get_activity_latest_update( $user_id = 0 ) { 956 955 global $bp; 957 956 … … 981 980 extract( $r, EXTR_SKIP ); 982 981 983 / * Fetch the names of components that have activity recorded in the DB */982 // Fetch the names of components that have activity recorded in the DB 984 983 $components = BP_Activity_Activity::get_recorded_components(); 985 984 … … 1022 1021 $link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component ); 1023 1022 1024 / * Make sure all core internal component names are translatable */1023 // Make sure all core internal component names are translatable 1025 1024 $translatable_components = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) ); 1026 1025 … … 1064 1063 } 1065 1064 1066 function bp_total_favorite_count_for_user( $user_id = false) {1065 function bp_total_favorite_count_for_user( $user_id = 0 ) { 1067 1066 echo bp_get_total_favorite_count_for_user( $user_id ); 1068 1067 } 1069 function bp_get_total_favorite_count_for_user( $user_id = false) {1068 function bp_get_total_favorite_count_for_user( $user_id = 0 ) { 1070 1069 return apply_filters( 'bp_get_total_favorite_count_for_user', bp_activity_total_favorites_for_user( $user_id ) ); 1071 1070 } 1072 1071 1073 function bp_total_mention_count_for_user( $user_id = false) {1072 function bp_total_mention_count_for_user( $user_id = 0 ) { 1074 1073 echo bp_get_total_favorite_count_for_user( $user_id ); 1075 1074 } 1076 function bp_get_total_mention_count_for_user( $user_id = false) {1075 function bp_get_total_mention_count_for_user( $user_id = 0 ) { 1077 1076 return apply_filters( 'bp_get_total_mention_count_for_user', get_user_meta( $user_id, 'bp_new_mention_count', true ) ); 1078 1077 } … … 1088 1087 1089 1088 return apply_filters( 'bp_get_send_public_message_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ); 1089 } 1090 1091 function bp_mentioned_user_display_name( $user_id_or_username ) { 1092 echo bp_get_mentioned_user_display_name( $user_id_or_username ); 1093 } 1094 function bp_get_mentioned_user_display_name( $user_id_or_username ) { 1095 if ( !$name = bp_core_get_user_displayname( $user_id_or_username ) ) 1096 $name = __( 'a user', 'buddypress' ); 1097 1098 return apply_filters( 'bp_get_mentioned_user_display_name', $name, $user_id_or_username ); 1090 1099 } 1091 1100 … … 1153 1162 global $bp; 1154 1163 1155 $link = '';1156 1157 1164 if ( $bp->current_component == $bp->profile->slug || 'just-me' == $bp->current_action ) 1158 1165 $link = $bp->displayed_user->domain . $bp->activity->slug . '/feed/'; … … 1165 1172 elseif ( 'mentions' == $bp->current_action ) 1166 1173 $link = $bp->displayed_user->domain . $bp->activity->slug . '/mentions/feed/'; 1174 else 1175 $link = ''; 1167 1176 1168 1177 return apply_filters( 'bp_get_activities_member_rss_link', $link ); … … 1171 1180 1172 1181 1173 /* Template tags for RSS feed output*/1182 /** Template tags for RSS feed output *****************************************/ 1174 1183 1175 1184 function bp_activity_feed_item_guid() { … … 1242 1251 * @since 1.3 1243 1252 */ 1244 function bp_ dtheme_sitewide_feed() {1253 function bp_activity_sitewide_feed() { 1245 1254 ?> 1246 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php _e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_sitewide_activity_feed_link() ?>" /> 1255 1256 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php _e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_sitewide_activity_feed_link() ?>" /> 1257 1247 1258 <?php 1248 1259 } 1249 add_action( 'bp_head', 'bp_dtheme_sitewide_feed' ); 1250 1251 /** 1252 * Template tag so we can hook member activity feed to <head> 1253 * 1254 * @since 1.3 1255 */ 1256 function bp_dtheme_member_feed() { 1257 if ( !bp_is_member() ) 1258 return; 1260 add_action( 'bp_head', 'bp_activity_sitewide_feed' ); 1261 1259 1262 ?> 1260 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php bp_displayed_user_fullname() ?> | <?php _e( 'Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_member_activity_feed_link() ?>" />1261 <?php1262 }1263 add_action( 'bp_head', 'bp_dtheme_member_feed' );1264 1265 /**1266 * Template tag so we can hook group activity feed to <head>1267 *1268 * @since 1.31269 */1270 function bp_dtheme_group_feed() {1271 if ( !bp_is_active( 'groups' ) || !bp_is_group() )1272 return;1273 ?>1274 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php bp_current_group_name() ?> | <?php _e( 'Group Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_group_activity_feed_link() ?>" />1275 <?php1276 }1277 add_action( 'bp_head', 'bp_dtheme_group_feed' );1278 ?>
Note: See TracChangeset
for help on using the changeset viewer.