Changeset 5684
- Timestamp:
- 02/09/2012 10:10:47 PM (13 years ago)
- Location:
- trunk/bp-activity
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-actions.php
r5664 r5684 115 115 * @param int $activity_id Activity id to be deleted. Defaults to 0. 116 116 * 117 * @global object $bp BuddyPress global settings118 117 * @uses bp_is_activity_component() 119 118 * @uses bp_is_current_action() … … 130 129 */ 131 130 function bp_activity_action_delete_activity( $activity_id = 0 ) { 132 global $bp;133 131 134 132 // Not viewing activity or action is not delete … … 347 345 * @since 1.2.0 348 346 * 349 * @global object $bp BuddyPress global settings350 347 * @uses is_user_logged_in() 351 348 * @uses bp_is_activity_component() … … 361 358 */ 362 359 function bp_activity_action_mark_favorite() { 363 global $bp;364 360 365 361 if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'favorite' ) ) … … 383 379 * @since 1.2.0 384 380 * 385 * @global object $bp BuddyPress global settings386 381 * @uses is_user_logged_in() 387 382 * @uses bp_is_activity_component() … … 397 392 */ 398 393 function bp_activity_action_remove_favorite() { 399 global $bp;400 394 401 395 if ( !is_user_logged_in() || ( bp_is_activity_component() ) || !bp_is_current_action( 'unfavorite' ) ) … … 447 441 * @since 1.0.0 448 442 * 449 * @global object $bp BuddyPress global settings450 443 * @global object $wp_query 451 444 * @uses bp_is_user_activity() … … 456 449 */ 457 450 function bp_activity_action_personal_feed() { 458 global $ bp, $wp_query;451 global $wp_query; 459 452 460 453 if ( !bp_is_user_activity() || !bp_is_current_action( 'feed' ) ) … … 474 467 * @since 1.0.0 475 468 * 476 * @global object $bp BuddyPress global settings477 469 * @global object $wp_query 478 470 * @uses bp_is_active() … … 486 478 */ 487 479 function bp_activity_action_friends_feed() { 488 global $ bp, $wp_query;480 global $wp_query; 489 481 490 482 if ( !bp_is_active( 'friends' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) ) … … 504 496 * @since 1.2.0 505 497 * 506 * @global object $bp BuddyPress global settings507 498 * @global object $wp_query 508 499 * @uses bp_is_active() … … 516 507 */ 517 508 function bp_activity_action_my_groups_feed() { 518 global $ bp, $wp_query;509 global $wp_query; 519 510 520 511 if ( !bp_is_active( 'groups' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) ) … … 534 525 * @since 1.2.0 535 526 * 536 * @global object $bp BuddyPress global settings537 527 * @global object $wp_query 538 528 * @uses bp_is_user_activity() … … 544 534 */ 545 535 function bp_activity_action_mentions_feed() { 546 global $ bp, $wp_query;536 global $wp_query; 547 537 548 538 if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) ) … … 562 552 * @since 1.2.0 563 553 * 564 * @global object $bp BuddyPress global settings565 554 * @global object $wp_query 566 555 * @uses bp_is_user_activity() … … 572 561 */ 573 562 function bp_activity_action_favorites_feed() { 574 global $ bp, $wp_query;563 global $wp_query; 575 564 576 565 if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) ) … … 584 573 } 585 574 add_action( 'bp_actions', 'bp_activity_action_favorites_feed' ); 586 587 575 588 576 /** … … 610 598 $bp->activity->akismet = new BP_Akismet(); 611 599 } 600 612 601 ?> -
trunk/bp-activity/bp-activity-admin.php
r5623 r5684 24 24 * Registers the Activity component admin screen 25 25 * 26 * @global object $bp Global BuddyPress settings object27 26 * @since 1.6 28 27 */ 29 28 function bp_activity_add_admin_menu() { 30 global $bp;31 29 32 30 if ( ! bp_current_user_can( 'bp_moderate' ) ) … … 906 904 * Constructor 907 905 * 908 * @global $bp BuddyPress global settings909 906 * @since 1.6 910 907 */ 911 908 public function __construct() { 912 global $bp;913 909 914 910 // Define singular and plural labels, as well as whether we support AJAX. -
trunk/bp-activity/bp-activity-akismet.php
r5624 r5684 481 481 */ 482 482 public function buddypress_ua( $user_agent ) { 483 return 'BuddyPress/' . bp_get_version() . ' | Akismet/'. constant( 'AKISMET_VERSION' ); 483 $user_agent = 'BuddyPress/' . bp_get_version() . ' | Akismet/'. constant( 'AKISMET_VERSION' ); 484 return $user_agent; 484 485 } 485 486 -
trunk/bp-activity/bp-activity-cache.php
r5505 r5684 1 1 <?php 2 2 3 /** 3 4 * Functions related to the BuddyPress Activity component and the WP Cache … … 5 6 * @since 1.6 6 7 */ 8 9 // Exit if accessed directly 10 if ( !defined( 'ABSPATH' ) ) exit; 7 11 8 12 /** -
trunk/bp-activity/bp-activity-classes.php
r5573 r5684 374 374 * Append activity comments to their associated activity items 375 375 * 376 * @global object $bp Global BuddyPress settings object377 376 * @global wpdb $wpdb WordPress database object 378 377 * @param array $activities … … 382 381 */ 383 382 function append_comments( $activities, $spam = 'ham_only' ) { 384 global $ bp, $wpdb;383 global $wpdb; 385 384 386 385 $activity_comments = array(); … … 498 497 499 498 function get_sitewide_items_for_feed( $limit = 35 ) { 500 global $wpdb, $bp; 501 502 $activities = bp_activity_get_sitewide( array( 'max' => $limit ) ); 499 global $bp; 500 501 $activities = bp_activity_get_sitewide( array( 'max' => $limit ) ); 502 $activity_feed = array(); 503 503 504 504 for ( $i = 0, $count = count( $activities ); $i < $count; ++$i ) { 505 $title = explode( '<span', $activities[$i]['content'] ); 506 507 $activity_feed[$i]['title'] = trim( strip_tags( $title[0] ) ); 508 $activity_feed[$i]['link'] = $activities[$i]['primary_link']; 505 $title = explode( '<span', $activities[$i]['content'] ); 506 $activity_feed[$i]['title'] = trim( strip_tags( $title[0] ) ); 507 $activity_feed[$i]['link'] = $activities[$i]['primary_link']; 509 508 $activity_feed[$i]['description'] = @sprintf( $activities[$i]['content'], '' ); 510 $activity_feed[$i]['pubdate'] = $activities[$i]['date_recorded'];509 $activity_feed[$i]['pubdate'] = $activities[$i]['date_recorded']; 511 510 } 512 511 … … 539 538 540 539 function get_filter_sql( $filter_array ) { 541 global $wpdb; 540 541 $filter_sql = array(); 542 542 543 543 if ( !empty( $filter_array['user_id'] ) ) { … … 571 571 } 572 572 573 if ( empty( $filter_sql) )573 if ( empty( $filter_sql ) ) 574 574 return false; 575 575 -
trunk/bp-activity/bp-activity-functions.php
r5612 r5684 240 240 * @param int $user_id 241 241 * 242 * @global object $bp BuddyPress global settings243 242 * @uses bp_get_user_meta() 244 243 * @uses apply_filters() To call the 'bp_activity_get_user_favorites' hook … … 247 246 */ 248 247 function bp_activity_get_user_favorites( $user_id = 0 ) { 249 global $bp;250 248 251 249 // Fallback to logged in user if no user_id is passed … … 267 265 * @param int $user_id 268 266 * 269 * @global object $bp BuddyPress global settings270 267 * @uses is_user_logged_in() 271 268 * @uses bp_get_user_meta() … … 279 276 */ 280 277 function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) { 281 global $bp;282 278 283 279 // Favorite activity stream items are for logged in users only … … 326 322 * @param int $user_id 327 323 * 328 * @global object $bp BuddyPress global settings329 324 * @uses is_user_logged_in() 330 325 * @uses bp_get_user_meta() … … 337 332 */ 338 333 function bp_activity_remove_user_favorite( $activity_id, $user_id = 0 ) { 339 global $bp;340 334 341 335 // Favorite activity stream items are for logged in users only … … 421 415 * @param int $user_id 422 416 * 423 * @global object $bp BuddyPress global settings424 417 * @uses BP_Activity_Activity::total_favorite_count() {@link BP_Activity_Activity} 425 418 * … … 427 420 */ 428 421 function bp_activity_total_favorites_for_user( $user_id = 0 ) { 429 global $bp;430 422 431 423 // Fallback on displayed user, and then logged in user … … 879 871 * @param array $args See docs for $defaults for details 880 872 * 881 * @global object $bp BuddyPress global settings882 873 * @uses wp_parse_args() 883 874 * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} … … 889 880 */ 890 881 function bp_activity_add( $args = '' ) { 891 global $bp;892 882 893 883 $defaults = array( … … 1038 1028 extract( $params, EXTR_SKIP ); 1039 1029 1040 if ( empty( $content) || empty($user_id) || empty($activity_id) )1041 return false; 1042 1043 if ( empty( $parent_id) )1030 if ( empty( $content ) || empty( $user_id ) || empty( $activity_id ) ) 1031 return false; 1032 1033 if ( empty( $parent_id ) ) 1044 1034 $parent_id = $activity_id; 1045 1035 … … 1050 1040 // Insert the activity comment 1051 1041 $comment_id = bp_activity_add( array( 1052 'id' => $id,1053 'action' => apply_filters( 'bp_activity_comment_action', sprintf( __( '%s posted a new activity comment', 'buddypress' ), bp_core_get_userlink( $user_id ) ) ),1054 'content' => apply_filters( 'bp_activity_comment_content', $content ),1055 'component' => $bp->activity->id,1056 'type' => 'activity_comment',1057 'user_id' => $user_id,1058 'item_id' => $activity_id,1042 'id' => $id, 1043 'action' => apply_filters( 'bp_activity_comment_action', sprintf( __( '%s posted a new activity comment', 'buddypress' ), bp_core_get_userlink( $user_id ) ) ), 1044 'content' => apply_filters( 'bp_activity_comment_content', $content ), 1045 'component' => $bp->activity->id, 1046 'type' => 'activity_comment', 1047 'user_id' => $user_id, 1048 'item_id' => $activity_id, 1059 1049 'secondary_item_id' => $parent_id, 1060 'hide_sitewide' => $is_hidden1050 'hide_sitewide' => $is_hidden 1061 1051 ) ); 1062 1052 … … 1120 1110 * @param array $args See docs for $defaults for details 1121 1111 * 1122 * @global object $bp BuddyPress global settings1123 1112 * @uses wp_parse_args() 1124 1113 * @uses bp_activity_adjust_mention_count() … … 1134 1123 */ 1135 1124 function bp_activity_delete( $args = '' ) { 1136 global $bp;1137 1125 1138 1126 // Pass one or more the of following variables to delete by those variables … … 1169 1157 $latest_update = bp_get_user_meta( $user_id, 'bp_latest_update', true ); 1170 1158 if ( !empty( $latest_update ) ) { 1171 if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) ) 1159 if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) ) { 1172 1160 bp_delete_user_meta( $user_id, 'bp_latest_update' ); 1161 } 1173 1162 } 1174 1163 … … 1191 1180 * @param array $args See docs for $defaults for details 1192 1181 * 1193 * @global object $bp BuddyPress global settings1194 1182 * @uses wp_parse_args() 1195 1183 * @uses bp_activity_delete() … … 1198 1186 */ 1199 1187 function bp_activity_delete_by_item_id( $args = '' ) { 1200 global $bp; 1201 1202 $defaults = array( 'item_id' => false, 'component' => false, 'type' => false, 'user_id' => false, 'secondary_item_id' => false ); 1188 1189 $defaults = array( 1190 'item_id' => false, 1191 'component' => false, 1192 'type' => false, 1193 'user_id' => false, 1194 'secondary_item_id' => false 1195 ); 1203 1196 $r = wp_parse_args( $args, $defaults ); 1204 1197 extract( $r, EXTR_SKIP ); … … 1337 1330 * @param object $activity_obj (optional) The activity object 1338 1331 * 1339 * @global object $bp BuddyPress global settings1340 1332 * @uses bp_get_root_domain() 1341 1333 * @uses bp_get_activity_root_slug() … … 1345 1337 */ 1346 1338 function bp_activity_get_permalink( $activity_id, $activity_obj = false ) { 1347 global $bp; 1348 1349 if ( !$activity_obj ) 1339 1340 if ( empty( $activity_obj ) ) 1350 1341 $activity_obj = new BP_Activity_Activity( $activity_id ); 1351 1342 … … 1354 1345 } 1355 1346 1356 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 ) 1347 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 ) { 1357 1348 $link = $activity_obj->primary_link; 1358 else {1359 if ( 'activity_comment' == $activity_obj->type ) 1349 } else { 1350 if ( 'activity_comment' == $activity_obj->type ) { 1360 1351 $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->item_id . '/'; 1361 else1352 } else { 1362 1353 $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->id . '/'; 1354 } 1363 1355 } 1364 1356 … … 1395 1387 */ 1396 1388 function bp_activity_thumbnail_content_images( $content, $link = false ) { 1397 global $post;1398 1389 1399 1390 preg_match_all( '/<img[^>]*>/Ui', $content, $matches ); … … 1406 1397 // Get the width and height 1407 1398 preg_match( '/<img.*?(height\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $height ); 1408 preg_match( '/<img.*?(width\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $width);1399 preg_match( '/<img.*?(width\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $width ); 1409 1400 1410 1401 if ( !empty( $src ) ) { 1411 $src = substr( substr( str_replace( 'src=', '', $src[1] ), 0, -1 ), 1 );1402 $src = substr( substr( str_replace( 'src=', '', $src[1] ), 0, -1 ), 1 ); 1412 1403 $height = substr( substr( str_replace( 'height=', '', $height[1] ), 0, -1 ), 1 ); 1413 $width = substr( substr( str_replace( 'width=', '', $width[1] ), 0, -1 ), 1 );1404 $width = substr( substr( str_replace( 'width=', '', $width[1] ), 0, -1 ), 1 ); 1414 1405 1415 1406 if ( empty( $width ) || empty( $height ) ) { 1416 $width = 100;1407 $width = 100; 1417 1408 $height = 100; 1418 1409 } 1419 1410 1420 $ratio = (int)$width / (int)$height;1411 $ratio = (int)$width / (int)$height; 1421 1412 $new_height = (int)$height >= 100 ? 100 : $height; 1422 $new_width = $new_height * $ratio;1413 $new_width = $new_height * $ratio; 1423 1414 1424 1415 $image = '<img src="' . esc_attr( $src ) . '" width="' . $new_width . '" height="' . $new_height . '" alt="' . __( 'Thumbnail', 'buddypress' ) . '" class="align-left thumbnail" />'; … … 1438 1429 * Convenience function to control whether the current user is allowed to mark activity items as spam 1439 1430 * 1440 * @global object $bp BuddyPress global settings1441 1431 * @return bool True if user is allowed to mark activity items as spam 1442 1432 * @since 1.6 … … 1444 1434 */ 1445 1435 function bp_activity_user_can_mark_spam() { 1446 global $bp;1447 1436 return apply_filters( 'bp_activity_user_can_mark_spam', bp_current_user_can( 'bp_moderate' ) ); 1448 1437 } -
trunk/bp-activity/bp-activity-notifications.php
r5595 r5684 19 19 * @param int $receiver_user_id The unique user_id of the user who is receiving the update 20 20 * 21 * @global object $bp BuddyPress global settings22 21 * @uses bp_core_add_notification() 23 22 * @uses bp_get_user_meta() … … 40 39 */ 41 40 function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) { 42 global $bp;43 41 44 42 // Don't leave multiple notifications for the same activity item … … 120 118 * @param array $params {@link bp_activity_new_comment()} 121 119 * 122 * @global object $bp BuddyPress global settings123 120 * @uses bp_get_user_meta() 124 121 * @uses bp_core_get_user_displayname() … … 142 139 */ 143 140 function bp_activity_new_comment_notification( $comment_id, $commenter_id, $params ) { 144 global $bp; 141 142 // Set some default parameters 143 $activity_id = 0; 144 $parent_id = 0; 145 145 146 146 extract( $params ); -
trunk/bp-activity/bp-activity-template.php
r5639 r5684 210 210 211 211 function the_activity() { 212 global $activity;213 212 214 213 $this->in_the_loop = true; 215 $this->activity = $this->next_activity();214 $this->activity = $this->next_activity(); 216 215 217 216 if ( is_array( $this->activity ) ) … … 441 440 * @since 1.2.0 442 441 * 443 * @global object $bp BuddyPress global settings444 442 * @global object $activities_template {@link BP_Activity_Template} 445 443 * @uses bp_core_number_format() … … 448 446 */ 449 447 function bp_get_activity_pagination_count() { 450 global $ bp, $activities_template;448 global $activities_template; 451 449 452 450 $start_num = intval( ( $activities_template->pag_page - 1 ) * $activities_template->pag_num ) + 1; … … 566 564 */ 567 565 function bp_activities_title() { 568 global $bp_activity_title;569 570 566 echo bp_get_activities_title(); 571 567 } … … 595 591 */ 596 592 function bp_activities_no_activity() { 597 global $bp_activity_no_activity;598 599 593 echo bp_get_activities_no_activity(); 600 594 } … … 970 964 * @param array $args optional 971 965 * 972 * @global object $bp BuddyPress global settings973 966 * @global object $activities_template {@link BP_Activity_Template} 974 967 * @uses wp_parse_args() … … 982 975 */ 983 976 function bp_get_activity_secondary_avatar( $args = '' ) { 984 global $ bp, $activities_template;977 global $activities_template; 985 978 986 979 $defaults = array( … … 1159 1152 * @todo properly deprecate this function 1160 1153 * 1161 * @global object $activities_template {@link BP_Activity_Template}1162 1154 * @uses bp_get_activity_action() 1163 1155 * @uses bp_get_activity_content_body() … … 1167 1159 */ 1168 1160 function bp_get_activity_content() { 1169 global $activities_template;1170 1171 1161 /** 1172 1162 * If you want to filter activity update content, please use … … 1188 1178 * 1189 1179 * @global object $activities_template {@link BP_Activity_Template} 1190 * @global object $bp BuddyPress global settings1191 1180 * @uses bp_core_time_since() 1192 1181 * @uses apply_filters_ref_array() To call the 'bp_activity_time_since' hook … … 1200 1189 */ 1201 1190 function bp_insert_activity_meta( $content ) { 1202 global $activities_template , $bp;1191 global $activities_template; 1203 1192 1204 1193 // Strip any legacy time since placeholders from BP 1.0-1.1 … … 1225 1214 * 1226 1215 * @global object $activities_template {@link BP_Activity_Template} 1227 * @global object $bp BuddyPress global settings1228 1216 * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook 1229 1217 * … … 1231 1219 */ 1232 1220 function bp_activity_user_can_delete( $activity = false ) { 1233 global $activities_template , $bp;1221 global $activities_template; 1234 1222 1235 1223 if ( !$activity ) … … 1247 1235 $can_delete = true; 1248 1236 1249 if ( $bp->is_item_admin && $bp->is_single_item)1237 if ( bp_is_item_admin() && bp_is_single_item() ) 1250 1238 $can_delete = true; 1251 1239 … … 1273 1261 * @param array $args Optional 1274 1262 * 1275 * @global object $bp BuddyPress global settings1276 1263 * @global object $activities_template {@link BP_Activity_Template} 1277 1264 * @uses wp_parse_args() … … 1281 1268 */ 1282 1269 function bp_get_activity_parent_content( $args = '' ) { 1283 global $ bp, $activities_template;1270 global $activities_template; 1284 1271 1285 1272 $defaults = array( … … 1328 1315 * @since 1.2.0 1329 1316 * 1330 * @global object $bp BuddyPress global settings1331 1317 * @global object $activities_template {@link BP_Activity_Template} 1332 1318 * @uses apply_filters() To call the 'bp_get_activity_is_favorite' hook … … 1335 1321 */ 1336 1322 function bp_get_activity_is_favorite() { 1337 global $ bp, $activities_template;1323 global $activities_template; 1338 1324 1339 1325 return apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array)$activities_template->my_favs ) ); … … 1366 1352 * 1367 1353 * @global object $activities_template {@link BP_Activity_Template} 1368 * @global object $bp BuddyPress global settings1369 1354 * @uses bp_activity_recurse_comments() 1370 1355 */ 1371 1356 function bp_activity_get_comments( $args = '' ) { 1372 global $activities_template , $bp;1357 global $activities_template; 1373 1358 1374 1359 if ( !isset( $activities_template->activity->children ) || !$activities_template->activity->children ) … … 1391 1376 * 1392 1377 * @global object $activities_template {@link BP_Activity_Template} 1393 * @global object $bp BuddyPress global settings1394 1378 * @uses locate_template() 1395 1379 */ 1396 1380 function bp_activity_recurse_comments( $comment ) { 1397 global $activities_template , $bp, $counter;1398 1399 if ( !$comment)1381 global $activities_template; 1382 1383 if ( empty( $comment ) ) 1400 1384 return false; 1401 1385 … … 1614 1598 * @since 1.5.0 1615 1599 * 1616 * @global object $bp BuddyPress global settings1617 1600 * @uses wp_nonce_url() 1618 1601 * @uses bp_get_root_domain() … … 1624 1607 */ 1625 1608 function bp_get_activity_comment_delete_link() { 1626 global $bp;1627 1628 1609 $link = wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' ); 1629 1610 … … 1688 1669 * 1689 1670 * @global object $activities_template {@link BP_Activity_Template} 1690 * @global object $bp BuddyPress global settings1691 1671 * @uses bp_activity_recurse_comment_count() 1692 1672 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook … … 1695 1675 */ 1696 1676 function bp_activity_get_comment_count( $args = '' ) { 1697 global $activities_template , $bp;1677 global $activities_template; 1698 1678 1699 1679 if ( !isset( $activities_template->activity->children ) || !$activities_template->activity->children ) … … 1718 1698 * @param object $comment Activity comments object 1719 1699 * 1720 * @global object $activities_template {@link BP_Activity_Template}1721 * @global object $bp BuddyPress global settings1722 1700 * @uses bp_activity_recurse_comment_count() 1723 1701 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook … … 1726 1704 */ 1727 1705 function bp_activity_recurse_comment_count( $comment, $count = 0 ) { 1728 global $activities_template, $bp; 1729 1730 if ( !$comment->children ) 1706 1707 if ( empty( $comment->children ) ) 1731 1708 return $count; 1732 1709 1733 foreach ( (array) $comment->children as $comment ) {1710 foreach ( (array) $comment->children as $comment ) { 1734 1711 $count++; 1735 1712 $count = bp_activity_recurse_comment_count( $comment, $count ); … … 1809 1786 * @since 1.2.0 1810 1787 * 1811 * @global object $bp BuddyPress global settings1812 1788 * @uses home_url() 1813 1789 * @uses bp_get_activity_root_slug() … … 1817 1793 */ 1818 1794 function bp_get_activity_comment_form_action() { 1819 global $bp;1820 1821 1795 return apply_filters( 'bp_get_activity_comment_form_action', home_url( bp_get_activity_root_slug() . '/reply/' ) ); 1822 1796 } … … 1865 1839 * @since 1.2.0 1866 1840 * 1867 * @global object $bp BuddyPress global settings1868 1841 * @uses bp_activity_get_permalink() 1869 1842 * @uses apply_filters() To call the 'bp_get_activity_thread_permalink' hook … … 1872 1845 */ 1873 1846 function bp_get_activity_thread_permalink() { 1874 global $ bp, $activities_template;1847 global $activities_template; 1875 1848 1876 1849 $link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ); … … 1895 1868 * @since 1.2.0 1896 1869 * 1897 * @global object $bp BuddyPress global settings1898 1870 * @global object $activities_template {@link BP_Activity_Template} 1899 1871 * @uses wp_nonce_url() … … 1905 1877 */ 1906 1878 function bp_get_activity_favorite_link() { 1907 global $ bp, $activities_template;1879 global $activities_template; 1908 1880 return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) ); 1909 1881 } … … 1925 1897 * @since 1.2.0 1926 1898 * 1927 * @global object $bp BuddyPress global settings1928 1899 * @global object $activities_template {@link BP_Activity_Template} 1929 1900 * @uses wp_nonce_url() … … 1935 1906 */ 1936 1907 function bp_get_activity_unfavorite_link() { 1937 global $ bp, $activities_template;1908 global $activities_template; 1938 1909 return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) ); 1939 1910 } … … 2002 1973 * 2003 1974 * @global object $activities_template {@link BP_Activity_Template} 2004 * @global object $bp BuddyPress global settings2005 1975 * @uses bp_get_root_domain() 2006 1976 * @uses bp_get_activity_root_slug() … … 2015 1985 */ 2016 1986 function bp_get_activity_delete_link() { 2017 global $activities_template , $bp;1987 global $activities_template; 2018 1988 2019 1989 $url = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activities_template->activity->id; … … 2050 2020 * @param int $user_id Defaults to 0 2051 2021 * 2052 * @global object $bp BuddyPress global settings2053 2022 * @uses bp_is_user_inactive() 2054 2023 * @uses bp_core_is_user_deleted() … … 2063 2032 */ 2064 2033 function bp_get_activity_latest_update( $user_id = 0 ) { 2065 global $bp; 2066 2067 if ( !$user_id ) 2034 2035 if ( empty( $user_id ) ) 2068 2036 $user_id = bp_displayed_user_id(); 2069 2037 … … 2100 2068 * @param array $args Defaults to false 2101 2069 * 2102 * @global object $activities_template {@link BP_Activity_Template}2103 * @global object $bp BuddyPress global settings2104 2070 * @uses wp_parse_args() 2105 2071 * @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity} … … 2113 2079 */ 2114 2080 function bp_get_activity_filter_links( $args = false ) { 2115 global $activities_template, $bp;2116 2081 2117 2082 $defaults = array( … … 2122 2087 extract( $r, EXTR_SKIP ); 2123 2088 2089 // Define local variable 2090 $component_links = array(); 2091 2124 2092 // Fetch the names of components that have activity recorded in the DB 2125 2093 $components = BP_Activity_Activity::get_recorded_components(); 2126 2094 2127 if ( !$components)2095 if ( empty( $components ) ) 2128 2096 return false; 2129 2097 2130 2098 foreach ( (array) $components as $component ) { 2131 /* Skip the activity comment filter */ 2099 2100 // Skip the activity comment filter 2132 2101 if ( 'activity' == $component ) 2133 2102 continue; … … 2160 2129 $link = add_query_arg( 'afilter', $component ); 2161 2130 $link = remove_query_arg( 'acpage' , $link ); 2162 2163 2131 $link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component ); 2164 2132 2165 // Make sure all core internal component names are translatable 2166 $translatable_components = array( __( 'xprofile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'sites', 'buddypress' ) ); 2167 2168 $component_links[] = $before . '<a href="' . esc_attr( $link ) . '">' . ucwords( __( $component, 'buddypress' ) ) . '</a>' . $after; 2133 $component_links[] = $before . '<a href="' . esc_attr( $link ) . '">' . ucwords( $component ) . '</a>' . $after; 2169 2134 } 2170 2135 … … 2183 2148 * 2184 2149 * @global object $activities_template {@link BP_Activity_Template} 2185 * @global object $bp BuddyPress global settings2186 2150 * @uses bp_get_activity_action_name() 2187 2151 * @uses apply_filters() To call the 'bp_activity_can_comment' hook … … 2190 2154 */ 2191 2155 function bp_activity_can_comment() { 2192 global $activities_template , $bp;2156 global $activities_template; 2193 2157 2194 2158 $can_comment = true; … … 2284 2248 * @since 1.2.0 2285 2249 * 2286 * @todo remove unnecessary $bp global2287 *2288 2250 * @param int $user_id Defaults to 0 2289 *2290 2251 * @uses bp_get_user_meta() 2291 2252 * @uses apply_filters() To call the 'bp_get_total_mention_count_for_user' hook 2292 *2293 2253 * @return int The total mention count for a specified user 2294 2254 */ 2295 2255 function bp_get_total_mention_count_for_user( $user_id = 0 ) { 2296 global $bp;2297 2298 2256 return apply_filters( 'bp_get_total_mention_count_for_user', bp_get_user_meta( $user_id, 'bp_new_mention_count', true ) ); 2299 2257 } … … 2507 2465 */ 2508 2466 function bp_get_member_activity_feed_link() { 2509 global $bp;2510 2467 2511 2468 if ( bp_is_profile_component() || bp_is_current_action( 'just-me' ) ) … … 2515 2472 elseif ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) 2516 2473 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/'; 2517 elseif ( 'favorites' == $bp->current_action)2474 elseif ( 'favorites' == bp_current_action() ) 2518 2475 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/'; 2519 elseif ( 'mentions' == $bp->current_action)2476 elseif ( 'mentions' == bp_current_action() ) 2520 2477 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/'; 2521 2478 else
Note: See TracChangeset
for help on using the changeset viewer.