Changeset 5109
- Timestamp:
- 09/06/2011 12:30:01 PM (13 years ago)
- Location:
- trunk/bp-activity
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-actions.php
r5072 r5109 1 1 <?php 2 /******************************************************************************* 2 3 /** 3 4 * Action functions are exactly the same as screen functions, however they do 4 5 * not have a template screen associated with them. Usually they will send the 5 6 * user back to the default screen after execution. 7 * 8 * @package BuddyPress 9 * @subpackage ActivityActions 6 10 */ 7 11 … … 9 13 if ( !defined( 'ABSPATH' ) ) exit; 10 14 11 // Allow core components and dependent plugins to register activity actions 15 /** 16 * Allow core components and dependent plugins to register activity actions 17 * 18 * @since 1.2.0 19 * 20 * @uses do_action() To call 'bp_register_activity_actions' hook. 21 */ 12 22 function bp_register_activity_actions() { 13 23 do_action( 'bp_register_activity_actions' ); … … 15 25 add_action( 'bp_init', 'bp_register_activity_actions', 8 ); 16 26 27 /** 28 * Allow core components and dependent plugins to register activity actions 29 * 30 * @since 1.2.0 31 * 32 * @global object $bp BuddyPress global settings 33 * @uses bp_is_activity_component() 34 * @uses bp_is_current_action() 35 * @uses bp_action_variable() 36 * @uses bp_activity_get_specific() 37 * @uses bp_is_active() 38 * @uses bp_core_get_user_domain() 39 * @uses groups_get_group() 40 * @uses bp_get_group_permalink() 41 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook 42 * @uses bp_core_redirect() 43 * @uses bp_get_root_domain() 44 * 45 * @return bool False on failure 46 */ 17 47 function bp_activity_action_permalink_router() { 18 48 global $bp; … … 72 102 73 103 /** 74 * bp_activity_action_delete_activity()75 *76 104 * Delete specific activity item and redirect to previous page. 77 105 * 78 * @global object $bp 79 * @since 1.1 106 * @since 1.1.0 107 * 108 * @param int $activity_id Activity id to be deleted. Defaults to 0. 109 * 110 * @global object $bp BuddyPress global settings 111 * @uses bp_is_activity_component() 112 * @uses bp_is_current_action() 113 * @uses bp_action_variable() 114 * @uses check_admin_referer() 115 * @uses bp_activity_user_can_delete() 116 * @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted. 117 * @uses bp_activity_delete() 118 * @uses bp_core_add_message() 80 119 * @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted. 81 * @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted. 120 * @uses bp_core_redirect() 121 * 122 * @return bool False on failure 82 123 */ 83 124 function bp_activity_action_delete_activity( $activity_id = 0 ) { … … 124 165 add_action( 'bp_actions', 'bp_activity_action_delete_activity' ); 125 166 167 /** 168 * Post user/group activity update. 169 * 170 * @since 1.2.0 171 * 172 * @global object $bp BuddyPress global settings 173 * @uses is_user_logged_in() 174 * @uses bp_is_activity_component() 175 * @uses bp_is_current_action() 176 * @uses check_admin_referer() 177 * @uses apply_filters() To call 'bp_activity_post_update_content' hook. 178 * @uses apply_filters() To call 'bp_activity_post_update_object' hook. 179 * @uses apply_filters() To call 'bp_activity_post_update_item_id' hook. 180 * @uses bp_core_add_message() 181 * @uses bp_core_redirect() 182 * @uses bp_activity_post_update() 183 * @uses groups_post_update() 184 * @uses bp_core_redirect() 185 * @uses apply_filters() To call 'bp_activity_custom_update' hook. 186 * 187 * @return bool False on failure 188 */ 126 189 function bp_activity_action_post_update() { 127 190 global $bp; … … 171 234 add_action( 'bp_actions', 'bp_activity_action_post_update' ); 172 235 236 /** 237 * Post new activity comment. 238 * 239 * @since 1.2.0 240 * 241 * @global object $bp BuddyPress global settings 242 * @uses is_user_logged_in() 243 * @uses bp_is_activity_component() 244 * @uses bp_is_current_action() 245 * @uses check_admin_referer() 246 * @uses apply_filters() To call 'bp_activity_post_comment_activity_id' hook. 247 * @uses apply_filters() To call 'bp_activity_post_comment_content' hook. 248 * @uses bp_core_add_message() 249 * @uses bp_core_redirect() 250 * @uses bp_activity_new_comment() 251 * @uses wp_get_referer() 252 * 253 * @return bool False on failure 254 */ 173 255 function bp_activity_action_post_comment() { 174 256 global $bp; … … 203 285 add_action( 'bp_actions', 'bp_activity_action_post_comment' ); 204 286 287 /** 288 * Mark activity as favorite. 289 * 290 * @since 1.2.0 291 * 292 * @global object $bp BuddyPress global settings 293 * @uses is_user_logged_in() 294 * @uses bp_is_activity_component() 295 * @uses bp_is_current_action() 296 * @uses check_admin_referer() 297 * @uses bp_activity_add_user_favorite() 298 * @uses bp_action_variable() 299 * @uses bp_core_add_message() 300 * @uses bp_core_redirect() 301 * @uses wp_get_referer() 302 * 303 * @return bool False on failure 304 */ 205 305 function bp_activity_action_mark_favorite() { 206 306 global $bp; … … 221 321 add_action( 'bp_actions', 'bp_activity_action_mark_favorite' ); 222 322 323 /** 324 * Remove activity from favorites. 325 * 326 * @since 1.2.0 327 * 328 * @global object $bp BuddyPress global settings 329 * @uses is_user_logged_in() 330 * @uses bp_is_activity_component() 331 * @uses bp_is_current_action() 332 * @uses check_admin_referer() 333 * @uses bp_activity_remove_user_favorite() 334 * @uses bp_action_variable() 335 * @uses bp_core_add_message() 336 * @uses bp_core_redirect() 337 * @uses wp_get_referer() 338 * 339 * @return bool False on failure 340 */ 223 341 function bp_activity_action_remove_favorite() { 224 342 global $bp; … … 239 357 add_action( 'bp_actions', 'bp_activity_action_remove_favorite' ); 240 358 359 /** 360 * Load the sitewide feed. 361 * 362 * @since 1.0.0 363 * 364 * @global object $bp BuddyPress global settings 365 * @global object $wp_query 366 * @uses bp_is_activity_component() 367 * @uses bp_is_current_action() 368 * @uses bp_is_user() 369 * @uses status_header() 370 * 371 * @return bool False on failure 372 */ 241 373 function bp_activity_action_sitewide_feed() { 242 374 global $bp, $wp_query; … … 253 385 add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' ); 254 386 387 /** 388 * Load a user's personal feed. 389 * 390 * @since 1.0.0 391 * 392 * @global object $bp BuddyPress global settings 393 * @global object $wp_query 394 * @uses bp_is_user_activity() 395 * @uses bp_is_current_action() 396 * @uses status_header() 397 * 398 * @return bool False on failure 399 */ 255 400 function bp_activity_action_personal_feed() { 256 401 global $bp, $wp_query; … … 267 412 add_action( 'bp_actions', 'bp_activity_action_personal_feed' ); 268 413 414 /** 415 * Load a user's friends feed. 416 * 417 * @since 1.0.0 418 * 419 * @global object $bp BuddyPress global settings 420 * @global object $wp_query 421 * @uses bp_is_active() 422 * @uses bp_is_user_activity() 423 * @uses bp_is_current_action() 424 * @uses bp_get_friends_slug() 425 * @uses bp_is_action_variable() 426 * @uses status_header() 427 * 428 * @return bool False on failure 429 */ 269 430 function bp_activity_action_friends_feed() { 270 431 global $bp, $wp_query; … … 281 442 add_action( 'bp_actions', 'bp_activity_action_friends_feed' ); 282 443 444 /** 445 * Load a user's my groups feed. 446 * 447 * @since 1.2.0 448 * 449 * @global object $bp BuddyPress global settings 450 * @global object $wp_query 451 * @uses bp_is_active() 452 * @uses bp_is_user_activity() 453 * @uses bp_is_current_action() 454 * @uses bp_get_groups_slug() 455 * @uses bp_is_action_variable() 456 * @uses status_header() 457 * 458 * @return bool False on failure 459 */ 283 460 function bp_activity_action_my_groups_feed() { 284 461 global $bp, $wp_query; … … 295 472 add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' ); 296 473 474 /** 475 * Load a user's @mentions feed. 476 * 477 * @since 1.2.0 478 * 479 * @global object $bp BuddyPress global settings 480 * @global object $wp_query 481 * @uses bp_is_user_activity() 482 * @uses bp_is_current_action() 483 * @uses bp_is_action_variable() 484 * @uses status_header() 485 * 486 * @return bool False on failure 487 */ 297 488 function bp_activity_action_mentions_feed() { 298 489 global $bp, $wp_query; … … 309 500 add_action( 'bp_actions', 'bp_activity_action_mentions_feed' ); 310 501 502 /** 503 * Load a user's favorites feed. 504 * 505 * @since 1.2.0 506 * 507 * @global object $bp BuddyPress global settings 508 * @global object $wp_query 509 * @uses bp_is_user_activity() 510 * @uses bp_is_current_action() 511 * @uses bp_is_action_variable() 512 * @uses status_header() 513 * 514 * @return bool False on failure 515 */ 311 516 function bp_activity_action_favorites_feed() { 312 517 global $bp, $wp_query; -
trunk/bp-activity/bp-activity-classes.php
r4961 r5109 1 1 <?php 2 3 /** 4 * BuddyPress Activity Classes 5 * 6 * @package BuddyPress 7 * @subpackage ActivityClasses 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; -
trunk/bp-activity/bp-activity-filters.php
r4989 r5109 1 1 <?php 2 3 /** 4 * The Activity filters 5 * 6 * @package BuddyPress 7 * @subpackage ActivityFilters 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; … … 80 88 add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' ); 81 89 90 /** 91 * Custom kses filtering for activity content 92 * 93 * @since 1.1.0 94 * 95 * @param string $content The activity content 96 * 97 * @uses apply_filters() To call the 'bp_activity_allowed_tags' hook. 98 * @uses wp_kses() 99 * 100 * @return string $content Filtered activity content 101 */ 82 102 function bp_activity_filter_kses( $content ) { 83 103 global $allowedtags; … … 110 130 * Finds and links @-mentioned users in the contents of activity items 111 131 * 112 * @ package BuddyPress Activity132 * @since 1.2.0 113 133 * 114 134 * @param string $content The activity content 115 * @param int $activity_id When $adjust_mention_count is true, you must provide an $activity_id, 116 * which will be added to the list of the user's unread mentions 135 * @param int $activity_id The activity id 136 * 137 * @uses bp_activity_find_mentions() 138 * @uses bp_is_username_compatibility_mode() 139 * @uses bp_core_get_userid_from_nicename() 140 * @uses bp_activity_at_message_notification() 141 * @uses bp_core_get_user_domain() 142 * @uses bp_activity_adjust_mention_count() 143 * 144 * @return string $content Content filtered for mentions 117 145 */ 118 146 function bp_activity_at_name_filter( $content, $activity_id = 0 ) { … … 146 174 * Catch mentions in saved activity items 147 175 * 148 * @package BuddyPress 149 * @since 1.5 176 * @since 1.5.0 150 177 * 151 178 * @param obj $activity 179 * 180 * @uses remove_filter() To remove the 'bp_activity_at_name_filter_updates' hook. 181 * @uses bp_activity_at_name_filter() 182 * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} 152 183 */ 153 184 function bp_activity_at_name_filter_updates( $activity ) { … … 163 194 add_filter( 'bp_activity_after_save', 'bp_activity_at_name_filter_updates' ); 164 195 196 /** 197 * Catches links in activity text so rel=nofollow can be added 198 * 199 * @since 1.2.0 200 * 201 * @param string $text Activity text 202 * 203 * @return string $text Text with rel=nofollow added to any links 204 */ 165 205 function bp_activity_make_nofollow_filter( $text ) { 166 206 return preg_replace_callback( '|<a (.+?)>|i', 'bp_activity_make_nofollow_filter_callback', $text ); 167 207 } 208 209 /** 210 * Adds rel=nofollow to a link 211 * 212 * @since 1.2.0 213 * 214 * @param array $matches 215 * 216 * @return string $text Link with rel=nofollow added 217 */ 168 218 function bp_activity_make_nofollow_filter_callback( $matches ) { 169 219 $text = $matches[1]; … … 175 225 * Truncates long activity entries when viewed in activity streams 176 226 * 177 * @ package BuddyPress Activity178 * @since 1.5227 * @since 1.5.0 228 * 179 229 * @param $text The original activity entry text 180 * @return $excerpt The truncated text 230 * 231 * @uses bp_is_single_activity() 232 * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook 233 * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook 234 * @uses bp_create_excerpt() 235 * @uses bp_get_activity_id() 236 * @uses bp_get_activity_thread_permalink() 237 * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook 238 * 239 * @return string $excerpt The truncated text 181 240 */ 182 241 function bp_activity_truncate_entry( $text ) { … … 206 265 add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); 207 266 add_filter( 'bp_get_activity_content', 'bp_activity_truncate_entry', 5 ); 267 208 268 ?> -
trunk/bp-activity/bp-activity-functions.php
r4961 r5109 1 1 <?php 2 2 3 /** 3 4 * BuddyPress Activity Functions … … 6 7 * 7 8 * @package BuddyPress 8 * @subpackage Activity Core9 * @subpackage ActivityFunctions 9 10 */ 10 11 … … 15 16 * Checks $bp pages global and looks for directory page 16 17 * 17 * @since 1.5 18 * 19 * @global object $bp Global BuddyPress settings object 18 * @since 1.5.0 19 * 20 * @global object $bp BuddyPress global settings 21 * 20 22 * @return bool True if set, False if empty 21 23 */ … … 29 31 * Searches through the content of an activity item to locate usernames, designated by an @ sign 30 32 * 31 * @ package BuddyPress Activity32 * @since 1.533 * 34 * @param str $content The content of the activity, usually found in $activity->content35 * @return array $usernames Array of the found usernames that match existing users33 * @since 1.5.0 34 * 35 * @param string $content The content of the activity, usually found in $activity->content 36 * 37 * @return bool|array $usernames Array of the found usernames that match existing users. False if no matches 36 38 */ 37 39 function bp_activity_find_mentions( $content ) { … … 49 51 * Resets a user's unread mentions list and count 50 52 * 51 * @package BuddyPress Activity 52 * @since 1.5 53 * @since 1.5.0 53 54 * 54 55 * @param int $user_id The id of the user whose unread mentions are being reset 56 * @uses bp_delete_user_meta() 55 57 */ 56 58 function bp_activity_clear_new_mentions( $user_id ) { … … 62 64 * Adjusts new mention count for mentioned users when activity items are deleted or created 63 65 * 64 * @package BuddyPress Activity 65 * @since 1.5 66 * @since 1.5.0 66 67 * 67 68 * @param int $activity_id The unique id for the activity item 69 * @param string $action Can be 'delete' or 'add'. Defaults to 'add' 70 * 71 * @uses BP_Activity_Activity() {@link BP_Activity_Activity} 72 * @uses bp_activity_find_mentions() 73 * @uses bp_is_username_compatibility_mode() 74 * @uses bp_core_get_userid_from_nicename() 75 * @uses bp_get_user_meta() 76 * @uses bp_update_user_meta() 68 77 */ 69 78 function bp_activity_adjust_mention_count( $activity_id, $action = 'add' ) { … … 114 123 * Formats notifications related to activity 115 124 * 116 * @package BuddyPress Activity 117 * @param str $action The type of activity item. Just 'new_at_mention' for now 125 * @since 1.5.0 126 * 127 * @param string $action The type of activity item. Just 'new_at_mention' for now 118 128 * @param int $item_id The activity id 119 129 * @param int $secondary_item_id In the case of at-mentions, this is the mentioner's id 120 130 * @param int $total_items The total number of notifications to format 121 * @param str $format 'string' to get a BuddyBar-compatible notification, 'array' otherwise 131 * @param string $format 'string' to get a BuddyBar-compatible notification, 'array' otherwise 132 * 133 * @global object $bp BuddyPress global settings 134 * @uses bp_loggedin_user_domain() 135 * @uses bp_get_activity_slug() 136 * @uses bp_core_get_user_displayname() 137 * @uses apply_filters() To call the 'bp_activity_multiple_at_mentions_notification' hook 138 * @uses apply_filters() To call the 'bp_activity_single_at_mentions_notification' hook 139 * @uses do_action() To call 'activity_format_notifications' hook 140 * 141 * @return string $return Formatted @mention notification 122 142 */ 123 143 function bp_activity_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { … … 156 176 } 157 177 158 /** Actions ****************************************************************** */178 /** Actions ******************************************************************/ 159 179 160 180 /** 161 181 * Sets the current action for a given activity stream location 162 182 * 163 * @global obj $bp 164 * @param str $component_id 165 * @param str $key 166 * @param str $value 167 * @return bool False on error, True on success 183 * @since 1.1.0 184 * 185 * @param string $component_id 186 * @param string $key 187 * @param string $value 188 * 189 * @global object $bp BuddyPress global settings 190 * @uses apply_filters() To call the 'bp_activity_set_action' hook 191 * 192 * @return bool False if any param is empty, otherwise true 168 193 */ 169 194 function bp_activity_set_action( $component_id, $key, $value ) { … … 186 211 * Retreives the current action from a component and key 187 212 * 188 * @global obj $bp 189 * @param str $component_id 190 * @param str $key 213 * @since 1.1.0 214 * 215 * @param string $component_id 216 * @param string $key 217 * 218 * @global object $bp BuddyPress global settings 219 * @uses apply_filters() To call the 'bp_activity_get_action' hook 220 * 191 221 * @return mixed False on error, action on success 192 222 */ … … 201 231 } 202 232 203 /** Favorites **************************************************************** */233 /** Favorites ****************************************************************/ 204 234 205 235 /** 206 236 * Get a users favorite activity stream items 207 237 * 208 * @global obj $bp 238 * @since 1.2.0 239 * 209 240 * @param int $user_id 241 * 242 * @global object $bp BuddyPress global settings 243 * @uses bp_get_user_meta() 244 * @uses apply_filters() To call the 'bp_activity_get_user_favorites' hook 245 * 210 246 * @return array Array of users favorite activity stream ID's 211 247 */ … … 226 262 * Add an activity stream item as a favorite for a user 227 263 * 228 * @global obj $bp 264 * @since 1.2.0 265 * 229 266 * @param int $activity_id 230 267 * @param int $user_id 231 * @return bool 268 * 269 * @global object $bp BuddyPress global settings 270 * @uses is_user_logged_in() 271 * @uses bp_get_user_meta() 272 * @uses bp_activity_get_meta() 273 * @uses bp_update_user_meta() 274 * @uses bp_activity_update_meta() 275 * @uses do_action() To call the 'bp_activity_add_user_favorite' hook 276 * @uses do_action() To call the 'bp_activity_add_user_favorite_fail' hook 277 * 278 * @return bool True on success, false on failure 232 279 */ 233 280 function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) { … … 271 318 } 272 319 320 /** 321 * Remove an activity stream item as a favorite for a user 322 * 323 * @since 1.2.0 324 * 325 * @param int $activity_id 326 * @param int $user_id 327 * 328 * @global object $bp BuddyPress global settings 329 * @uses is_user_logged_in() 330 * @uses bp_get_user_meta() 331 * @uses bp_activity_get_meta() 332 * @uses bp_activity_update_meta() 333 * @uses bp_update_user_meta() 334 * @uses do_action() To call the 'bp_activity_remove_user_favorite' hook 335 * 336 * @return bool True on success, false on failure 337 */ 273 338 function bp_activity_remove_user_favorite( $activity_id, $user_id = 0 ) { 274 339 global $bp; … … 322 387 * Check if activity exists by scanning content 323 388 * 324 * @param str $content 389 * @since 1.1.0 390 * 391 * @param string $content 392 * 393 * @uses BP_Activity_Activity::check_exists_by_content() {@link BP_Activity_Activity} 394 * @uses apply_filters() To call the 'bp_activity_check_exists_by_content' hook 395 * 325 396 * @return bool 326 397 */ … … 330 401 331 402 /** 332 * Retreive the last time activity was updated 333 * 334 * @return str 403 * Retrieve the last time activity was updated 404 * 405 * @since 1.0.0 406 * 407 * @uses BP_Activity_Activity::get_last_updated() {@link BP_Activity_Activity} 408 * @uses apply_filters() To call the 'bp_activity_get_last_updated' hook 409 * 410 * @return string Date last updated 335 411 */ 336 412 function bp_activity_get_last_updated() { … … 339 415 340 416 /** 341 * Retreive the number of favorite activity stream items a user has 342 * 343 * @global obj $bp 417 * Retrieve the number of favorite activity stream items a user has 418 * 419 * @since 1.2.0 420 * 344 421 * @param int $user_id 345 * @return int 422 * 423 * @global object $bp BuddyPress global settings 424 * @uses BP_Activity_Activity::total_favorite_count() {@link BP_Activity_Activity} 425 * 426 * @return int Total favorite count 346 427 */ 347 428 function bp_activity_total_favorites_for_user( $user_id = 0 ) { … … 355 436 } 356 437 357 /** Meta ********************************************************************* */438 /** Meta *********************************************************************/ 358 439 359 440 /** 360 441 * Delete a meta entry from the DB for an activity stream item 361 442 * 362 * @ global DB $wpdb363 * @global obj $bp443 * @since 1.2.0 444 * 364 445 * @param int $activity_id 365 * @param str $meta_key 366 * @param str $meta_value 367 * @return bool 446 * @param string $meta_key 447 * @param string $meta_value 448 * 449 * @global object $wpdb 450 * @global object $bp BuddyPress global settings 451 * @uses wp_cache_delete() 452 * @uses is_wp_error() 453 * 454 * @return bool True on success, false on failure 368 455 */ 369 456 function bp_activity_delete_meta( $activity_id, $meta_key = '', $meta_value = '' ) { … … 410 497 * Get activity meta 411 498 * 412 * @ global DB $wpdb413 * @global obj $bp499 * @since 1.2.0 500 * 414 501 * @param int $activity_id 415 * @param str $meta_key 502 * @param string $meta_key 503 * 504 * @global object $wpdb 505 * @global object $bp BuddyPress global settings 506 * @uses wp_cache_get() 507 * @uses wp_cache_set() 508 * @uses apply_filters() To call the 'bp_activity_get_meta' hook 509 * 416 510 * @return bool 417 511 */ … … 461 555 * Update activity meta 462 556 * 463 * @ global DB $wpdb464 * @global obj $bp557 * @since 1.2.0 558 * 465 559 * @param int $activity_id 466 * @param str $meta_key 467 * @param str $meta_value 468 * @return bool 560 * @param string $meta_key 561 * @param string $meta_value 562 * 563 * @global object $wpdb 564 * @global object $bp BuddyPress global settings 565 * @uses maybe_serialize() 566 * @uses bp_activity_delete_meta() 567 * @uses wp_cache_set() 568 * 569 * @return bool True on success, false on failure 469 570 */ 470 571 function bp_activity_update_meta( $activity_id, $meta_key, $meta_value ) { … … 511 612 } 512 613 513 /** Clean up ******************************************************************/ 514 515 /** 516 * Completely remove 614 /** Clean up *****************************************************************/ 615 616 /** 617 * Completely remove a user's activity data 618 * 619 * @since 1.5.0 620 * 517 621 * @param int $user_id 622 * 623 * @uses is_user_logged_in() 624 * @uses bp_activity_delete() 625 * @uses bp_delete_user_meta() 626 * @uses do_action() To call the 'bp_activity_remove_data' hook 627 * @uses do_action() To call the 'bp_activity_remove_all_user_data' hook 518 628 */ 519 629 function bp_activity_remove_all_user_data( $user_id = 0 ) { … … 543 653 * Register the activity stream actions for updates 544 654 * 545 * @global obj $bp 655 * @since 1.2.0 656 * 657 * @global object $bp BuddyPress global settings 658 * @uses bp_activity_set_action() 659 * @uses do_action() To call the 'updates_register_activity_actions' hook 546 660 */ 547 661 function updates_register_activity_actions() { … … 554 668 add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' ); 555 669 556 /****************************************************************************** *670 /****************************************************************************** 557 671 * Business functions are where all the magic happens in BuddyPress. They will 558 672 * handle the actual saving or manipulation of information. Usually they will … … 561 675 */ 562 676 677 /** 678 * Retrieve an activity or activities 679 * 680 * @since 1.2.0 681 * 682 * @param array $args 683 * 684 * @uses wp_parse_args() 685 * @uses wp_cache_get() 686 * @uses wp_cache_set() 687 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity} 688 * @uses apply_filters_ref_array() To call the 'bp_activity_get' hook 689 * 690 * @return object $activity The activity/activities object 691 */ 563 692 function bp_activity_get( $args = '' ) { 564 693 $defaults = array( … … 604 733 * Fetch specific activity items 605 734 * 606 * @ package BuddyPress735 * @since 1.2.0 607 736 * 608 737 * @param array $args See docs for $defaults for details 738 * 739 * @uses wp_parse_args() 740 * @uses apply_filters() To call the 'bp_activity_get_specific' hook 741 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity} 742 * 609 743 * @return array The array returned by BP_Activity_Activity::get() 610 744 */ … … 625 759 } 626 760 761 /** 762 * Add an activity item 763 * 764 * @since 1.1.0 765 * 766 * @param array $args See docs for $defaults for details 767 * 768 * @global object $bp BuddyPress global settings 769 * @uses wp_parse_args() 770 * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} 771 * @uses BP_Activity_Activity::rebuild_activity_comment_tree() {@link BP_Activity_Activity} 772 * @uses wp_cache_delete() 773 * @uses do_action() To call the 'bp_activity_add' hook 774 * 775 * @return int The activity id 776 */ 627 777 function bp_activity_add( $args = '' ) { 628 778 global $bp; … … 680 830 } 681 831 832 /** 833 * Post an activity update 834 * 835 * @since 1.2.0 836 * 837 * @param array $args See docs for $defaults for details 838 * 839 * @global object $bp BuddyPress global settings 840 * @uses wp_parse_args() 841 * @uses bp_core_is_user_spammer() 842 * @uses bp_core_is_user_deleted() 843 * @uses bp_core_get_userlink() 844 * @uses bp_activity_add() 845 * @uses apply_filters() To call the 'bp_activity_new_update_action' hook 846 * @uses apply_filters() To call the 'bp_activity_new_update_content' hook 847 * @uses apply_filters() To call the 'bp_activity_new_update_primary_link' hook 848 * @uses bp_update_user_meta() 849 * @uses wp_filter_kses() 850 * @uses do_action() To call the 'bp_activity_posted_update' hook 851 * 852 * @return int $activity_id The activity id 853 */ 682 854 function bp_activity_post_update( $args = '' ) { 683 855 global $bp; … … 720 892 } 721 893 894 /** 895 * Add an activity comment 896 * 897 * @since 1.2.0 898 * 899 * @param array $args See docs for $defaults for details 900 * 901 * @global object $bp BuddyPress global settings 902 * @uses wp_parse_args() 903 * @uses bp_activity_add() 904 * @uses apply_filters() To call the 'bp_activity_comment_action' hook 905 * @uses apply_filters() To call the 'bp_activity_comment_content' hook 906 * @uses bp_activity_new_comment_notification() 907 * @uses wp_cache_delete() 908 * @uses do_action() To call the 'bp_activity_comment_posted' hook 909 * 910 * @return int $comment_id The comment id 911 */ 722 912 function bp_activity_new_comment( $args = '' ) { 723 913 global $bp; … … 769 959 770 960 /** 771 * bp_activity_get_activity_id()772 *773 961 * Fetch the activity_id for an existing activity entry in the DB. 774 962 * 775 * @package BuddyPress Activity 963 * @since 1.2.0 964 * 965 * @param array $args See docs for $defaults for details 966 * 967 * @uses wp_parse_args() 968 * @uses apply_filters() To call the 'bp_activity_get_activity_id' hook 969 * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} 970 * 971 * @return int $activity_id The activity id 776 972 */ 777 973 function bp_activity_get_activity_id( $args = '' ) { … … 793 989 } 794 990 795 /** *991 /** 796 992 * Deleting Activity 797 993 * … … 805 1001 * 806 1002 * If you are deleting an activity comment please use bp_activity_delete_comment(); 807 */ 808 1003 * 1004 * @since 1.0.0 1005 * 1006 * @param array $args See docs for $defaults for details 1007 * 1008 * @global object $bp BuddyPress global settings 1009 * @uses wp_parse_args() 1010 * @uses bp_activity_adjust_mention_count() 1011 * @uses BP_Activity_Activity::delete() {@link BP_Activity_Activity} 1012 * @uses do_action() To call the 'bp_before_activity_delete' hook 1013 * @uses bp_get_user_meta() 1014 * @uses bp_delete_user_meta() 1015 * @uses do_action() To call the 'bp_activity_delete' hook 1016 * @uses do_action() To call the 'bp_activity_deleted_activities' hook 1017 * @uses wp_cache_delete() 1018 * 1019 * @return bool True on success, false on failure 1020 */ 809 1021 function bp_activity_delete( $args = '' ) { 810 1022 global $bp; … … 854 1066 return true; 855 1067 } 856 // The following functions have been deprecated in place of bp_activity_delete() 1068 1069 /** 1070 * Delete an activity item by activity id 1071 * 1072 * You should use bp_activity_delete() instead 1073 * 1074 * @since 1.1.0 1075 * @deprecated 1.2.0 1076 * 1077 * @param array $args See docs for $defaults for details 1078 * 1079 * @global object $bp BuddyPress global settings 1080 * @uses wp_parse_args() 1081 * @uses bp_activity_delete() 1082 * 1083 * @return bool True on success, false on failure 1084 */ 857 1085 function bp_activity_delete_by_item_id( $args = '' ) { 858 1086 global $bp; … … 865 1093 } 866 1094 1095 /** 1096 * Delete an activity item by activity id 1097 * 1098 * You should use bp_activity_delete() instead 1099 * 1100 * @since 1.1.0 1101 * @deprecated 1.2.0 1102 * 1103 * @param int $activity_id The activity id 1104 * 1105 * @uses bp_activity_delete() 1106 * 1107 * @return bool True on success, false on failure 1108 */ 867 1109 function bp_activity_delete_by_activity_id( $activity_id ) { 868 1110 return bp_activity_delete( array( 'id' => $activity_id ) ); 869 1111 } 870 1112 1113 /** 1114 * Delete an activity item by it's content 1115 * 1116 * You should use bp_activity_delete() instead 1117 * 1118 * @since 1.1.0 1119 * @deprecated 1.2.0 1120 * 1121 * @param int $user_id The user id 1122 * @param string $content The activity id 1123 * @param string $component The activity component 1124 * @param string $type The activity type 1125 * 1126 * @uses bp_activity_delete() 1127 * 1128 * @return bool True on success, false on failure 1129 */ 871 1130 function bp_activity_delete_by_content( $user_id, $content, $component, $type ) { 872 1131 return bp_activity_delete( array( 'user_id' => $user_id, 'content' => $content, 'component' => $component, 'type' => $type ) ); 873 1132 } 874 1133 1134 /** 1135 * Delete a user's activity for a component 1136 * 1137 * You should use bp_activity_delete() instead 1138 * 1139 * @since 1.1.0 1140 * @deprecated 1.2.0 1141 * 1142 * @param int $user_id The user id 1143 * @param string $component The activity component 1144 * 1145 * @uses bp_activity_delete() 1146 * 1147 * @return bool True on success, false on failure 1148 */ 875 1149 function bp_activity_delete_for_user_by_component( $user_id, $component ) { 876 1150 return bp_activity_delete( array( 'user_id' => $user_id, 'component' => $component ) ); 877 1151 } 878 // End deprecation 879 1152 1153 /** 1154 * Delete an activity comment 1155 * 1156 * @since 1.2.0 1157 * 1158 * @param int $activity_id The activity id 1159 * @param int $comment_id The activity comment id 1160 * 1161 * @uses apply_filters() To call the 'bp_activity_delete_comment_pre' hook 1162 * @uses bp_activity_delete_children() 1163 * @uses bp_activity_delete() 1164 * @uses BP_Activity_Activity::rebuild_activity_comment_tree() {@link BP_Activity_Activity} 1165 * @uses do_action() To call the 'bp_activity_delete_comment' hook 1166 * 1167 * @return bool True on success, false on failure 1168 */ 880 1169 function bp_activity_delete_comment( $activity_id, $comment_id ) { 881 1170 /*** … … 900 1189 return true; 901 1190 } 1191 1192 /** 1193 * Delete an activity comment's children 1194 * 1195 * @since 1.2.0 1196 * 1197 * @param int $activity_id The activity id 1198 * @param int $comment_id The activity comment id 1199 * 1200 * @uses BP_Activity_Activity::get_child_comments() {@link BP_Activity_Activity} 1201 * @uses bp_activity_delete_children() 1202 * @uses bp_activity_delete() 1203 */ 902 1204 function bp_activity_delete_children( $activity_id, $comment_id) { 903 1205 // Recursively delete all children of this comment. … … 916 1218 * as well, if you already have it available. 917 1219 * 918 * @package BuddyPress 919 * 920 * @uses apply_filters_ref_array() Filter 'bp_activity_get_permalink' to modify the function output 1220 * @since 1.2.0 1221 * 921 1222 * @param int $activity_id The unique id of the activity object 922 * @param obj $activity_obj (optional) The activity object 923 * @return str $link Permalink for the activity item 1223 * @param object $activity_obj (optional) The activity object 1224 * 1225 * @global object $bp BuddyPress global settings 1226 * @uses bp_get_root_domain() 1227 * @uses bp_get_activity_root_slug() 1228 * @uses apply_filters_ref_array() To call the 'bp_activity_get_permalink' hook 1229 * 1230 * @return string $link Permalink for the activity item 924 1231 */ 925 1232 function bp_activity_get_permalink( $activity_id, $activity_obj = false ) { … … 945 1252 } 946 1253 1254 /** 1255 * Hide a user's activity 1256 * 1257 * @since 1.2.0 1258 * 1259 * @param int $user_id The user id 1260 * 1261 * @uses BP_Activity_Activity::hide_all_for_user() {@link BP_Activity_Activity} 1262 * 1263 * @return bool True on success, false on failure 1264 */ 947 1265 function bp_activity_hide_user_activity( $user_id ) { 948 1266 return BP_Activity_Activity::hide_all_for_user( $user_id ); … … 950 1268 951 1269 /** 952 * bp_activity_thumbnail_content_images()953 *954 1270 * Take content, remove all images and replace them with one thumbnail image. 955 1271 * 956 * @package BuddyPress Activity 957 * @param $content str - The content to work with 958 * @param $link str - Optional. The URL that the image should link to 959 * @return $content str - The content with images stripped and replaced with a single thumb. 1272 * @since 1.2.0 1273 * 1274 * @param string $content The content to work with 1275 * @param string $link Optional. The URL that the image should link to 1276 * 1277 * @uses esc_attr() 1278 * @uses apply_filters() To call the 'bp_activity_thumbnail_content_images' hook 1279 * 1280 * @return string $content The content with images stripped and replaced with a single thumb. 960 1281 */ 961 1282 function bp_activity_thumbnail_content_images( $content, $link = false ) { … … 1009 1330 * For that, see {@link bp_activity_comment_embed()}. 1010 1331 * 1332 * @since 1.5 1333 * 1011 1334 * @see BP_Embed 1012 1335 * @see bp_embed_activity_cache() 1013 1336 * @see bp_embed_activity_save_cache() 1014 * @package BuddyPress Activity 1015 * @since 1.5 1337 * 1338 * @uses add_filter() To attach 'bp_get_activity_id' to 'embed_post_id' 1339 * @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache' 1340 * @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache' 1016 1341 */ 1017 1342 function bp_activity_embed() { … … 1027 1352 * If no cache and link is embeddable, cache it. 1028 1353 * 1354 * @since 1.5 1355 * 1029 1356 * @see BP_Embed 1030 1357 * @see bp_embed_activity_cache() 1031 1358 * @see bp_embed_activity_save_cache() 1032 * @package BuddyPress Activity 1033 * @since 1.5 1359 * 1360 * @uses add_filter() To attach 'bp_get_activity_comment_id' to 'embed_post_id' 1361 * @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache' 1362 * @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache' 1034 1363 */ 1035 1364 function bp_activity_comment_embed() { … … 1043 1372 * When a user clicks on a "Read More" item, make sure embeds are correctly parsed and shown for the expanded content. 1044 1373 * 1045 * @ global object $bp BuddyPress global settings1046 * @param BP_Activity_Activity $activity The activity that is being expanded1374 * @since 1.5 1375 * 1047 1376 * @see BP_Embed 1048 * @since 1.5 1377 * 1378 * @param object $activity The activity that is being expanded 1379 * 1380 * @global object $bp BuddyPress global settings 1381 * @uses add_filter() To attach create_function() to 'embed_post_id' 1382 * @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache' 1383 * @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache' 1049 1384 */ 1050 1385 function bp_dtheme_embed_read_more( $activity ) { … … 1064 1399 * {@link bp_activity_embed()} or any other component embeds. 1065 1400 * 1401 * @since 1.5 1402 * 1066 1403 * @see bp_activity_comment_embed() 1067 * @package BuddyPress Activity1068 * @ since 1.51404 * 1405 * @uses remove_filter() To remove 'bp_get_activity_comment_id' from 'embed_post_id' 1069 1406 */ 1070 1407 function bp_activity_comment_embed_after_recurse() { … … 1077 1414 * Used during {@link BP_Embed::parse_oembed()} via {@link bp_activity_embed()}. 1078 1415 * 1079 * @package BuddyPress Activity1080 1416 * @since 1.5 1417 * 1418 * @uses bp_activity_get_meta() 1419 * 1420 * @return mixed The activity meta 1081 1421 */ 1082 1422 function bp_embed_activity_cache( $cache, $id, $cachekey ) { … … 1088 1428 * Used during {@link BP_Embed::parse_oembed()} via {@link bp_activity_embed()}. 1089 1429 * 1090 * @package BuddyPress Activity1091 1430 * @since 1.5 1431 * 1432 * @uses bp_activity_update_meta() 1092 1433 */ 1093 1434 function bp_embed_activity_save_cache( $cache, $cachekey, $id ) { -
trunk/bp-activity/bp-activity-loader.php
r4961 r5109 1 1 <?php 2 2 3 /** 3 4 * BuddyPress Activity Streams Loader … … 6 7 * 7 8 * @package BuddyPress 8 * @subpackage Activity 9 * @subpackage ActivityCore 9 10 */ 10 11 … … 12 13 if ( !defined( 'ABSPATH' ) ) exit; 13 14 15 /** 16 * Main Activity Class 17 * 18 * @since 1.5.0 19 */ 14 20 class BP_Activity_Component extends BP_Component { 15 21 … … 17 23 * Start the activity component creation process 18 24 * 19 * @since 1.5 25 * @since 1.5.0 20 26 */ 21 27 function BP_Activity_Component() { … … 33 39 /** 34 40 * Include files 41 * 42 * @since 1.5.0 35 43 */ 36 44 function includes() { … … 55 63 * backwards compatibility. 56 64 * 57 * @since 1.5 58 * @global obj $bp 65 * @since 1.5.0 66 * 67 * @global object $bp BuddyPress global settings 59 68 */ 60 69 function setup_globals() { … … 89 98 * Setup BuddyBar navigation 90 99 * 91 * @global obj $bp 100 * @since 1.5.0 101 * 102 * @global object $bp BuddyPress global settings 103 * @uses bp_is_active() 104 * @uses is_user_logged_in() 105 * @uses bp_get_friends_slug() 106 * @uses bp_get_groups_slug() 92 107 */ 93 108 function setup_nav() { … … 183 198 * Set up the admin bar 184 199 * 185 * @global obj $bp 200 * @since 1.5.0 201 * 202 * @global object $bp BuddyPress global settings 203 * @uses is_user_logged_in() 204 * @uses trailingslashit() 205 * @uses bp_get_total_mention_count_for_user() 206 * @uses bp_loggedin_user_id() 207 * @uses bp_is_active() 208 * @uses bp_get_friends_slug() 209 * @uses bp_get_groups_slug() 186 210 */ 187 211 function setup_admin_bar() { … … 259 283 * Sets up the title for pages and <title> 260 284 * 261 * @global obj $bp 285 * @since 1.5.0 286 * 287 * @global object $bp BuddyPress global settings 288 * @uses bp_is_activity_component() 289 * @uses bp_is_my_profile() 290 * @uses bp_core_fetch_avatar() 262 291 */ 263 292 function setup_title() { … … 280 309 } 281 310 } 311 282 312 // Create the activity component 283 313 $bp->activity = new BP_Activity_Component(); -
trunk/bp-activity/bp-activity-notifications.php
r4961 r5109 1 1 <?php 2 3 /** 4 * BuddyPress Activity Notifications 5 * 6 * @package BuddyPress 7 * @subpackage ActivityNotifications 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; … … 6 14 * Sends an email notification and a BP notification when someone mentions you in an update 7 15 * 8 * @package BuddyPress Activity 9 * @param str $content The content of the activity update 10 * @param int $poster_user_id The unique user_id of the user who sent the update 16 * @since 1.2.0 17 * 11 18 * @param int $activity_id The id of the activity update 19 * @param int $receiver_user_id The unique user_id of the user who is receiving the update 20 * 21 * @global object $bp BuddyPress global settings 22 * @uses bp_core_add_notification() 23 * @uses bp_get_user_meta() 24 * @uses bp_core_get_user_displayname() 25 * @uses bp_activity_get_permalink() 26 * @uses bp_core_get_user_domain() 27 * @uses bp_get_settings_slug() 28 * @uses bp_activity_filter_kses() 29 * @uses bp_core_get_core_userdata() 30 * @uses wp_specialchars_decode() 31 * @uses get_blog_option() 32 * @uses bp_is_active() 33 * @uses bp_is_group() 34 * @uses bp_get_current_group_name() 35 * @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook 36 * @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook 37 * @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook 38 * @uses wp_mail() 39 * @uses do_action() To call the 'bp_activity_sent_mention_email' hook 12 40 */ 13 41 function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) { … … 73 101 } 74 102 103 /** 104 * Sends an email notification and a BP notification when someone mentions you in an update 105 * 106 * @since 1.2.0 107 * 108 * @param int $comment_id The comment id 109 * @param int $commenter_id The unique user_id of the user who posted the comment 110 * @param array $params {@link bp_activity_new_comment()} 111 * 112 * @global object $bp BuddyPress global settings 113 * @uses bp_get_user_meta() 114 * @uses bp_core_get_user_displayname() 115 * @uses bp_activity_get_permalink() 116 * @uses bp_core_get_user_domain() 117 * @uses bp_get_settings_slug() 118 * @uses bp_activity_filter_kses() 119 * @uses bp_core_get_core_userdata() 120 * @uses wp_specialchars_decode() 121 * @uses get_blog_option() 122 * @uses bp_get_root_blog_id() 123 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook 124 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook 125 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook 126 * @uses wp_mail() 127 * @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook 128 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook 129 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook 130 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook 131 * @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook 132 */ 75 133 function bp_activity_new_comment_notification( $comment_id, $commenter_id, $params ) { 76 134 global $bp; -
trunk/bp-activity/bp-activity-screens.php
r4961 r5109 1 1 <?php 2 3 /** 4 * BuddyPress Activity Screens 5 * 6 * @package BuddyPress 7 * @subpackage ActivityScreens 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; 4 12 5 13 /** 6 * Activity index 7 * 8 * @global obj $bp 14 * Activity screen index 15 * 16 * @since 1.5.0 17 * 18 * @uses bp_displayed_user_id() 19 * @uses bp_is_activity_component() 20 * @uses bp_current_action() 21 * @uses bp_update_is_directory() 22 * @uses do_action() To call the 'bp_activity_screen_index' hook 23 * @uses bp_core_load_template() 24 * @uses apply_filters() To call the 'bp_activity_screen_index' hook 9 25 */ 10 26 function bp_activity_screen_index() { … … 19 35 add_action( 'bp_screens', 'bp_activity_screen_index' ); 20 36 37 /** 38 * Activity screen 'my activity' index 39 * 40 * @since 1.0.0 41 * 42 * @uses do_action() To call the 'bp_activity_screen_my_activity' hook 43 * @uses bp_core_load_template() 44 * @uses apply_filters() To call the 'bp_activity_template_my_activity' hook 45 */ 21 46 function bp_activity_screen_my_activity() { 22 47 do_action( 'bp_activity_screen_my_activity' ); … … 24 49 } 25 50 51 /** 52 * Activity screen 'friends' index 53 * 54 * @since 1.0.0 55 * 56 * @uses bp_is_active() 57 * @uses bp_update_is_item_admin() 58 * @uses is_super_admin() 59 * @uses do_action() To call the 'bp_activity_screen_friends' hook 60 * @uses bp_core_load_template() 61 * @uses apply_filters() To call the 'bp_activity_template_friends_activity' hook 62 */ 26 63 function bp_activity_screen_friends() { 27 64 if ( !bp_is_active( 'friends' ) ) … … 33 70 } 34 71 72 /** 73 * Activity screen 'groups' index 74 * 75 * @since 1.2.0 76 * 77 * @uses bp_is_active() 78 * @uses bp_update_is_item_admin() 79 * @uses is_super_admin() 80 * @uses do_action() To call the 'bp_activity_screen_groups' hook 81 * @uses bp_core_load_template() 82 * @uses apply_filters() To call the 'bp_activity_template_groups_activity' hook 83 */ 35 84 function bp_activity_screen_groups() { 36 85 if ( !bp_is_active( 'groups' ) ) … … 42 91 } 43 92 93 /** 94 * Activity screen 'favorites' index 95 * 96 * @since 1.2.0 97 * 98 * @uses bp_update_is_item_admin() 99 * @uses is_super_admin() 100 * @uses do_action() To call the 'bp_activity_screen_favorites' hook 101 * @uses bp_core_load_template() 102 * @uses apply_filters() To call the 'bp_activity_template_favorite_activity' hook 103 */ 44 104 function bp_activity_screen_favorites() { 45 105 bp_update_is_item_admin( is_super_admin(), 'activity' ); … … 48 108 } 49 109 110 /** 111 * Activity screen 'mentions' index 112 * 113 * @since 1.2.0 114 * 115 * @uses bp_update_is_item_admin() 116 * @uses is_super_admin() 117 * @uses do_action() To call the 'bp_activity_screen_mentions' hook 118 * @uses bp_core_load_template() 119 * @uses apply_filters() To call the 'bp_activity_template_mention_activity' hook 120 */ 50 121 function bp_activity_screen_mentions() { 51 122 bp_update_is_item_admin( is_super_admin(), 'activity' ); … … 55 126 56 127 /** 57 * bp_activity_remove_screen_notifications()58 *59 128 * Removes activity notifications from the notification menu when a user clicks on them and 60 129 * is taken to a specific screen. 61 130 * 62 * @package BuddyPress Activity 131 * @since 1.5.0 132 * 133 * @global object $bp BuddyPress global settings 134 * @uses bp_core_delete_notifications_by_type() 63 135 */ 64 136 function bp_activity_remove_screen_notifications() { … … 74 146 * Reset the logged-in user's new mentions data when he visits his mentions screen 75 147 * 76 * @package BuddyPress Activity 77 * @since 1.5 148 * @since 1.5.0 149 * 150 * @uses bp_is_my_profile() 78 151 * @uses bp_activity_clear_new_mentions() 79 * @uses bp_ is_my_profile()152 * @uses bp_loggedin_user_id() 80 153 */ 81 154 function bp_activity_reset_my_new_mentions() { … … 85 158 add_action( 'bp_activity_screen_mentions', 'bp_activity_reset_my_new_mentions' ); 86 159 160 /** 161 * Reset the logged-in user's new mentions data when he visits his mentions screen 162 * 163 * @since 1.2.0 164 * 165 * @global object $bp BuddyPress global settings 166 * @uses bp_is_activity_component() 167 * @uses bp_activity_get_specific() 168 * @uses bp_current_action() 169 * @uses bp_action_variables() 170 * @uses bp_do_404() 171 * @uses bp_is_active() 172 * @uses groups_get_group() 173 * @uses groups_is_user_member() 174 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook 175 * @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook 176 * @uses bp_core_add_message() 177 * @uses is_user_logged_in() 178 * @uses bp_core_redirect() 179 * @uses site_url() 180 * @uses esc_url() 181 * @uses bp_get_root_domain() 182 * @uses bp_get_activity_root_slug() 183 * @uses bp_core_load_template() 184 * @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook 185 */ 87 186 function bp_activity_screen_single_activity_permalink() { 88 187 global $bp; … … 156 255 add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' ); 157 256 257 /** 258 * Add activity notifications settings to the notifications settings page 259 * 260 * @since 1.2.0 261 * 262 * @global object $bp BuddyPress global settings 263 * @uses bp_get_user_meta() 264 * @uses bp_core_get_username() 265 * @uses do_action() To call the 'bp_activity_screen_notification_settings' hook 266 */ 158 267 function bp_activity_screen_notification_settings() { 159 268 global $bp; -
trunk/bp-activity/bp-activity-template.php
r5019 r5109 1 1 <?php 2 2 3 /** 3 4 * BuddyPress Activity Template Functions 4 5 * 5 6 * @package BuddyPress 6 * @subpackage Activity 7 * @subpackage ActivityTemplate 7 8 */ 8 9 … … 13 14 * Output the activity component slug 14 15 * 15 * @package BuddyPress 16 * @subpackage Activity Template 17 * @since 1.5 16 * @since 1.5.0 18 17 * 19 18 * @uses bp_get_activity_slug() … … 25 24 * Return the activity component slug 26 25 * 27 * @package BuddyPress 28 * @subpackage Activity Template 29 * @since 1.5 26 * @since 1.5.0 27 * 28 * @global object $bp BuddyPress global settings 29 * @uses apply_filters() To call the 'bp_get_activity_slug' hook 30 30 */ 31 31 function bp_get_activity_slug() { … … 37 37 * Output the activity component root slug 38 38 * 39 * @package BuddyPress 40 * @subpackage Activity Template 41 * @since 1.5 39 * @since 1.5.0 42 40 * 43 41 * @uses bp_get_activity_root_slug() … … 49 47 * Return the activity component root slug 50 48 * 51 * @package BuddyPress 52 * @subpackage Activity Template 53 * @since 1.5 49 * @since 1.5.0 50 * 51 * @global object $bp BuddyPress global settings 52 * @uses apply_filters() To call the 'bp_get_activity_root_slug' hook 54 53 */ 55 54 function bp_get_activity_root_slug() { … … 61 60 * Output member directory permalink 62 61 * 63 * @package BuddyPress 64 * @subpackage Activity Template 65 * @since 1.5 62 * @since 1.5.0 63 * 66 64 * @uses bp_get_activity_directory_permalink() 67 65 */ … … 72 70 * Return member directory permalink 73 71 * 74 * @package BuddyPress 75 * @subpackage Activity Template 76 * @since 1.5 77 * @uses apply_filters() 72 * @since 1.5.0 73 * 78 74 * @uses traisingslashit() 79 75 * @uses bp_get_root_domain() 80 76 * @uses bp_get_activity_root_slug() 81 * @return string 77 * @uses apply_filters() To call the 'bp_get_activity_directory_permalink' hook 78 * 79 * @return string Activity directory permalink 82 80 */ 83 81 function bp_get_activity_directory_permalink() { … … 90 88 * This is responsible for loading a group of activity items and displaying them 91 89 * 92 * @package BuddyPress 93 * @subpackage Activity Template 94 * @since 1.5 90 * @since 1.0.0 95 91 */ 96 92 class BP_Activity_Template { … … 231 227 232 228 /** 233 * bp_has_activities()234 *235 229 * Initializes the activity loop. 236 230 * 237 231 * Based on the $args passed, bp_has_activities() populates the $activities_template global. 238 232 * 239 * @global BP_Activity_Template $activities_template 240 * @global object $bp Global BuddyPress settings object 241 * @param mixed $args Arguments for limiting the contents of the activity loop. Can be passed as an associative array or as a URL argument string 233 * @since 1.0.0 234 * 235 * @param array $args Arguments for limiting the contents of the activity loop. Can be passed as an associative array or as a URL argument string 236 * 237 * @global object $activities_template {@link BP_Activity_Template} 238 * @global object $bp BuddyPress global settings 239 * @uses groups_is_user_member() 240 * @uses bp_current_action() 241 * @uses bp_is_current_action() 242 * @uses bp_get_activity_slug() 243 * @uses bp_action_variable() 244 * @uses wp_parse_args() 245 * @uses bp_is_active() 246 * @uses friends_get_friend_user_ids() 247 * @uses groups_get_user_groups() 248 * @uses bp_activity_get_user_favorites() 249 * @uses apply_filters() To call the 'bp_has_activities' hook 250 * 242 251 * @return bool Returns true when activities are found 243 252 */ … … 381 390 } 382 391 392 /** 393 * Determines if there are still activities left in the loop. 394 * 395 * @since 1.0.0 396 * 397 * @global object $activities_template {@link BP_Activity_Template} 398 * @uses BP_Activity_Template::user_activities() {@link BP_Activity_Template::user_activities()} 399 * 400 * @return bool Returns true when activities are found 401 */ 383 402 function bp_activities() { 384 403 global $activities_template; … … 386 405 } 387 406 407 /** 408 * Gets the current activity object in the loop 409 * 410 * @since 1.0.0 411 * 412 * @global object $activities_template {@link BP_Activity_Template} 413 * @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()} 414 * 415 * @return object The current activity within the loop 416 */ 388 417 function bp_the_activity() { 389 418 global $activities_template; … … 391 420 } 392 421 422 /** 423 * Outputs the activity pagination count 424 * 425 * @since 1.0.0 426 * 427 * @global object $activities_template {@link BP_Activity_Template} 428 * @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()} 429 */ 393 430 function bp_activity_pagination_count() { 394 431 echo bp_get_activity_pagination_count(); 395 432 } 433 434 /** 435 * Returns the activity pagination count 436 * 437 * @since 1.2.0 438 * 439 * @global object $bp BuddyPress global settings 440 * @global object $activities_template {@link BP_Activity_Template} 441 * @uses bp_core_number_format() 442 * 443 * @return string The pagination text 444 */ 396 445 function bp_get_activity_pagination_count() { 397 446 global $bp, $activities_template; … … 405 454 } 406 455 456 /** 457 * Outputs the activity pagination links 458 * 459 * @since 1.0.0 460 * 461 * @uses bp_get_activity_pagination_links() 462 */ 407 463 function bp_activity_pagination_links() { 408 464 echo bp_get_activity_pagination_links(); 409 465 } 466 467 /** 468 * Outputs the activity pagination links 469 * 470 * @since 1.0.0 471 * 472 * @global object $activities_template {@link BP_Activity_Template} 473 * @uses apply_filters() To call the 'bp_get_activity_pagination_links' hook 474 * 475 * @return string The pagination links 476 */ 410 477 function bp_get_activity_pagination_links() { 411 478 global $activities_template; … … 417 484 * Returns true when there are more activity items to be shown than currently appear 418 485 * 419 * @package BuddyPress Activity 420 * @since 1.5 421 * 422 * @global $activities_template The activity data loop object created in bp_has_activities() 486 * @since 1.5.0 487 * 488 * @global object $activities_template {@link BP_Activity_Template} 489 * @uses apply_filters() To call the 'bp_activity_has_more_items' hook 490 * 491 * @return bool $has_more_items True if more items, false if not 423 492 */ 424 493 function bp_activity_has_more_items() { … … 431 500 } 432 501 502 /** 503 * Outputs the activity count 504 * 505 * @since 1.2.0 506 * 507 * @uses bp_get_activity_count() 508 */ 433 509 function bp_activity_count() { 434 510 echo bp_get_activity_count(); 435 511 } 512 513 /** 514 * Returns the activity count 515 * 516 * @since 1.2.0 517 * 518 * @global object $activities_template {@link BP_Activity_Template} 519 * @uses apply_filters() To call the 'bp_get_activity_count' hook 520 * 521 * @return int The activity count 522 */ 436 523 function bp_get_activity_count() { 437 524 global $activities_template; … … 440 527 } 441 528 529 /** 530 * Outputs the number of activities per page 531 * 532 * @since 1.2.0 533 * 534 * @uses bp_get_activity_per_page() 535 */ 442 536 function bp_activity_per_page() { 443 537 echo bp_get_activity_per_page(); 444 538 } 539 540 /** 541 * Returns the number of activities per page 542 * 543 * @since 1.2.0 544 * 545 * @global object $activities_template {@link BP_Activity_Template} 546 * @uses apply_filters() To call the 'bp_get_activity_per_page' hook 547 * 548 * @return int The activities per page 549 */ 445 550 function bp_get_activity_per_page() { 446 551 global $activities_template; … … 449 554 } 450 555 556 /** 557 * Outputs the activities title 558 * 559 * @since 1.0.0 560 * 561 * @uses bp_get_activities_title() 562 */ 451 563 function bp_activities_title() { 452 564 global $bp_activity_title; … … 454 566 echo bp_get_activities_title(); 455 567 } 568 569 /** 570 * Returns the activities title 571 * 572 * @since 1.0.0 573 * 574 * @global string $bp_activity_title 575 * @uses apply_filters() To call the 'bp_get_activities_title' hook 576 * 577 * @return int The activities title 578 */ 456 579 function bp_get_activities_title() { 457 580 global $bp_activity_title; … … 460 583 } 461 584 585 /** 586 * {@internal Missing Description} 587 * 588 * @since 1.0.0 589 * 590 * @uses bp_get_activities_no_activity() 591 */ 462 592 function bp_activities_no_activity() { 463 593 global $bp_activity_no_activity; … … 465 595 echo bp_get_activities_no_activity(); 466 596 } 597 598 /** 599 * {@internal Missing Description} 600 * 601 * @since 1.0.0 602 * 603 * @global string $bp_activity_no_activity 604 * @uses apply_filters() To call the 'bp_get_activities_no_activity' hook 605 * 606 * @return unknown_type 607 */ 467 608 function bp_get_activities_no_activity() { 468 609 global $bp_activity_no_activity; … … 471 612 } 472 613 614 /** 615 * Outputs the activity id 616 * 617 * @since 1.2.0 618 * 619 * @uses bp_get_activity_id() 620 */ 473 621 function bp_activity_id() { 474 622 echo bp_get_activity_id(); 475 623 } 624 625 /** 626 * Returns the activity id 627 * 628 * @since 1.2.0 629 * 630 * @global object $activities_template {@link BP_Activity_Template} 631 * @uses apply_filters() To call the 'bp_get_activity_id' hook 632 * 633 * @return int The activity id 634 */ 476 635 function bp_get_activity_id() { 477 636 global $activities_template; … … 479 638 } 480 639 640 /** 641 * Outputs the activity item id 642 * 643 * @since 1.2.0 644 * 645 * @uses bp_get_activity_item_id() 646 */ 481 647 function bp_activity_item_id() { 482 648 echo bp_get_activity_item_id(); 483 649 } 650 651 /** 652 * Returns the activity item id 653 * 654 * @since 1.2.0 655 * 656 * @global object $activities_template {@link BP_Activity_Template} 657 * @uses apply_filters() To call the 'bp_get_activity_item_id' hook 658 * 659 * @return int The activity item id 660 */ 484 661 function bp_get_activity_item_id() { 485 662 global $activities_template; … … 487 664 } 488 665 666 /** 667 * Outputs the activity secondary item id 668 * 669 * @since 1.2.0 670 * 671 * @uses bp_get_activity_secondary_item_id() 672 */ 489 673 function bp_activity_secondary_item_id() { 490 674 echo bp_get_activity_secondary_item_id(); 491 675 } 676 677 /** 678 * Returns the activity secondary item id 679 * 680 * @since 1.2.0 681 * 682 * @global object $activities_template {@link BP_Activity_Template} 683 * @uses apply_filters() To call the 'bp_get_activity_secondary_item_id' hook 684 * 685 * @return int The activity secondary item id 686 */ 492 687 function bp_get_activity_secondary_item_id() { 493 688 global $activities_template; … … 495 690 } 496 691 692 /** 693 * Outputs the date the activity was recorded 694 * 695 * @since 1.2.0 696 * 697 * @uses bp_get_activity_date_recorded() 698 */ 497 699 function bp_activity_date_recorded() { 498 700 echo bp_get_activity_date_recorded(); 499 701 } 702 703 /** 704 * Returns the date the activity was recorded 705 * 706 * @since 1.2.0 707 * 708 * @global object $activities_template {@link BP_Activity_Template} 709 * @uses apply_filters() To call the 'bp_get_activity_date_recorded' hook 710 * 711 * @return string The date the activity was recorded 712 */ 500 713 function bp_get_activity_date_recorded() { 501 714 global $activities_template; … … 503 716 } 504 717 718 /** 719 * Outputs the activity object name 720 * 721 * @since 1.2.0 722 * 723 * @uses bp_get_activity_object_name() 724 */ 505 725 function bp_activity_object_name() { 506 726 echo bp_get_activity_object_name(); 507 727 } 728 729 /** 730 * Returns the activity object name 731 * 732 * @since 1.2.0 733 * 734 * @global object $activities_template {@link BP_Activity_Template} 735 * @uses apply_filters() To call the 'bp_get_activity_object_name' hook 736 * 737 * @return string The activity object name 738 */ 508 739 function bp_get_activity_object_name() { 509 740 global $activities_template; … … 511 742 } 512 743 744 /** 745 * Outputs the activity type 746 * 747 * @since 1.2.0 748 * 749 * @uses bp_get_activity_type() 750 */ 513 751 function bp_activity_type() { 514 752 echo bp_get_activity_type(); 515 753 } 754 755 /** 756 * Returns the activity type 757 * 758 * @since 1.2.0 759 * 760 * @global object $activities_template {@link BP_Activity_Template} 761 * @uses apply_filters() To call the 'bp_get_activity_type' hook 762 * 763 * @return string The activity type 764 */ 516 765 function bp_get_activity_type() { 517 766 global $activities_template; 518 767 return apply_filters( 'bp_get_activity_type', $activities_template->activity->type ); 519 768 } 769 770 /** 771 * Outputs the activity action name 772 * 773 * Just a wrapper for bp_activity_type() 774 * 775 * @since 1.2.0 776 * @deprecated 1.5.0 777 * 778 * @todo Properly deprecate in favor of bp_activity_type() and 779 * remove redundant echo 780 * 781 * @uses bp_activity_type() 782 */ 520 783 function bp_activity_action_name() { echo bp_activity_type(); } 784 785 /** 786 * Returns the activity type 787 * 788 * Just a wrapper for bp_get_activity_type() 789 * 790 * @since 1.2.0 791 * @deprecated 1.5.0 792 * 793 * @todo Properly deprecate in favor of bp_get_activity_type() 794 * 795 * @uses bp_get_activity_type() 796 * 797 * @return string The activity type 798 */ 521 799 function bp_get_activity_action_name() { return bp_get_activity_type(); } 522 800 801 /** 802 * Outputs the activity user id 803 * 804 * @since 1.1.0 805 * 806 * @uses bp_get_activity_user_id() 807 */ 523 808 function bp_activity_user_id() { 524 809 echo bp_get_activity_user_id(); 525 810 } 811 812 /** 813 * Returns the activity user id 814 * 815 * @since 1.1.0 816 * 817 * @global object $activities_template {@link BP_Activity_Template} 818 * @uses apply_filters() To call the 'bp_get_activity_user_id' hook 819 * 820 * @return int The activity user id 821 */ 526 822 function bp_get_activity_user_id() { 527 823 global $activities_template; … … 529 825 } 530 826 827 /** 828 * Outputs the activity user link 829 * 830 * @since 1.2.0 831 * 832 * @uses bp_get_activity_user_link() 833 */ 531 834 function bp_activity_user_link() { 532 835 echo bp_get_activity_user_link(); 533 836 } 837 838 /** 839 * Returns the activity user link 840 * 841 * @since 1.2.0 842 * 843 * @global object $activities_template {@link BP_Activity_Template} 844 * @uses bp_core_get_user_domain() 845 * @uses apply_filters() To call the 'bp_get_activity_user_link' hook 846 * 847 * @return string $link The activity user link 848 */ 534 849 function bp_get_activity_user_link() { 535 850 global $activities_template; … … 544 859 545 860 /** 546 * bp_activity_avatar( $args )547 *548 861 * Output the avatar of the user that performed the action 549 862 * 863 * @since 1.1.0 864 * 550 865 * @param array $args 866 * 867 * @uses bp_get_activity_avatar() 551 868 */ 552 869 function bp_activity_avatar( $args = '' ) { … … 554 871 } 555 872 /** 556 * bp_get_activity_avatar( $args )557 *558 873 * Return the avatar of the user that performed the action 559 874 * 560 * @ global array $bp561 * @global object $activities_template875 * @since 1.1.0 876 * 562 877 * @param array $args optional 563 * @return string 878 * 879 * @global object $activities_template {@link BP_Activity_Template} 880 * @global object $bp BuddyPress global settings 881 * @uses bp_is_single_activity() 882 * @uses wp_parse_args() 883 * @uses apply_filters() To call the 'bp_get_activity_avatar_object_' . $current_activity_item->component hook 884 * @uses apply_filters() To call the 'bp_get_activity_avatar_item_id' hook 885 * @uses bp_core_fetch_avatar() 886 * @uses apply_filters() To call the 'bp_get_activity_avatar' hook 887 * 888 * @return string User avatar 564 889 */ 565 890 function bp_get_activity_avatar( $args = '' ) { … … 614 939 615 940 /** 616 * bp_activity_secondary_avatar( $args )617 *618 941 * Output the avatar of the object that action was performed on 619 942 * 943 * @since 1.2.0 944 * 620 945 * @param array $args optional 946 * 947 * @uses bp_get_activity_secondary_avatar() 621 948 */ 622 949 function bp_activity_secondary_avatar( $args = '' ) { 623 950 echo bp_get_activity_secondary_avatar( $args ); 624 951 } 625 /** 626 * bp_get_activity_secondary_avatar( $args ) 627 * 952 953 /** 628 954 * Return the avatar of the object that action was performed on 629 955 * 630 * @ global array $bp631 * @global object $activities_template956 * @since 1.2.0 957 * 632 958 * @param array $args optional 633 * @return string 959 * 960 * @global object $bp BuddyPress global settings 961 * @global object $activities_template {@link BP_Activity_Template} 962 * @uses wp_parse_args() 963 * @uses get_blog_option() 964 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component hook 965 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_item_id' hook 966 * @uses bp_core_fetch_avatar() 967 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar' hook 968 * 969 * @return string The secondary avatar 634 970 */ 635 971 function bp_get_activity_secondary_avatar( $args = '' ) { … … 695 1031 } 696 1032 1033 /** 1034 * Output the activity action 1035 * 1036 * @since 1.2.0 1037 * 1038 * @uses bp_get_activity_action() 1039 */ 697 1040 function bp_activity_action() { 698 1041 echo bp_get_activity_action(); 699 1042 } 1043 1044 /** 1045 * Return the activity action 1046 * 1047 * @since 1.2.0 1048 * 1049 * @global object $activities_template {@link BP_Activity_Template} 1050 * @uses apply_filters_ref_array() To call the 'bp_get_activity_action_pre_meta' hook 1051 * @uses bp_insert_activity_meta() 1052 * @uses apply_filters_ref_array() To call the 'bp_get_activity_action' hook 1053 * 1054 * @return string The activity action 1055 */ 700 1056 function bp_get_activity_action() { 701 1057 global $activities_template; … … 710 1066 } 711 1067 1068 /** 1069 * Output the activity content body 1070 * 1071 * @since 1.2.0 1072 * 1073 * @uses bp_get_activity_content_body() 1074 */ 712 1075 function bp_activity_content_body() { 713 1076 echo bp_get_activity_content_body(); 714 1077 } 1078 1079 /** 1080 * Return the activity content body 1081 * 1082 * @since 1.2.0 1083 * 1084 * @global object $activities_template {@link BP_Activity_Template} 1085 * @uses bp_insert_activity_meta() 1086 * @uses apply_filters_ref_array() To call the 'bp_get_activity_content_body' hook 1087 * 1088 * @return string The activity content body 1089 */ 715 1090 function bp_get_activity_content_body() { 716 1091 global $activities_template; … … 723 1098 } 724 1099 725 function bp_activity_has_content() { 726 global $activities_template; 727 728 if ( !empty( $activities_template->activity->content ) ) 729 return true; 730 731 return false; 732 } 733 1100 /** 1101 * Does the activity have content? 1102 * 1103 * @since 1.2.0 1104 * 1105 * @global object $activities_template {@link BP_Activity_Template} 1106 * 1107 * @return bool True if activity has content, false otherwise 1108 */ 1109 function bp_activity_has_content() { 1110 global $activities_template; 1111 1112 if ( !empty( $activities_template->activity->content ) ) 1113 return true; 1114 1115 return false; 1116 } 1117 1118 /** 1119 * Output the activity content 1120 * 1121 * @since 1.0.0 1122 * @deprecated 1.5.0 1123 * 1124 * @todo properly deprecate this function 1125 * 1126 * @uses bp_get_activity_content() 1127 */ 734 1128 function bp_activity_content() { 735 1129 echo bp_get_activity_content(); 736 1130 } 1131 1132 /** 1133 * Return the activity content 1134 * 1135 * @since 1.0.0 1136 * @deprecated 1.5.0 1137 * 1138 * @todo properly deprecate this function 1139 * 1140 * @global object $activities_template {@link BP_Activity_Template} 1141 * @uses bp_get_activity_action() 1142 * @uses bp_get_activity_content_body() 1143 * @uses apply_filters() To call the 'bp_get_activity_content' hook 1144 * 1145 * @return string The activity content 1146 */ 737 1147 function bp_get_activity_content() { 738 1148 global $activities_template; 739 1149 740 /** *1150 /** 741 1151 * If you want to filter activity update content, please use 742 1152 * the filter 'bp_get_activity_content_body' … … 749 1159 } 750 1160 751 function bp_insert_activity_meta( $content ) { 752 global $activities_template, $bp; 753 754 // Strip any legacy time since placeholders from BP 1.0-1.1 755 $content = str_replace( '<span class="time-since">%s</span>', '', $content ); 756 757 // Insert the time since. 758 $time_since = apply_filters_ref_array( 'bp_activity_time_since', array( '<span class="time-since">' . bp_core_time_since( $activities_template->activity->date_recorded ) . '</span>', &$activities_template->activity ) ); 759 760 // Insert the permalink 761 if ( !bp_is_single_activity() ) 762 $content = apply_filters_ref_array( 'bp_activity_permalink', array( sprintf( '%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ), esc_attr__( 'View Discussion', 'buddypress' ), $time_since ), &$activities_template->activity ) ); 763 else 764 $content .= str_pad( $time_since, strlen( $time_since ) + 2, ' ', STR_PAD_BOTH ); 765 766 return apply_filters( 'bp_insert_activity_meta', $content ); 767 } 768 1161 /** 1162 * Insert activity meta 1163 * 1164 * @since 1.2.0 1165 * 1166 * @param string $content 1167 * 1168 * @global object $activities_template {@link BP_Activity_Template} 1169 * @global object $bp BuddyPress global settings 1170 * @uses bp_core_time_since() 1171 * @uses apply_filters_ref_array() To call the 'bp_activity_time_since' hook 1172 * @uses bp_is_single_activity() 1173 * @uses bp_activity_get_permalink() 1174 * @uses esc_attr__() 1175 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink' hook 1176 * @uses apply_filters() To call the 'bp_insert_activity_meta' hook 1177 * 1178 * @return string The activity content 1179 */ 1180 function bp_insert_activity_meta( $content ) { 1181 global $activities_template, $bp; 1182 1183 // Strip any legacy time since placeholders from BP 1.0-1.1 1184 $content = str_replace( '<span class="time-since">%s</span>', '', $content ); 1185 1186 // Insert the time since. 1187 $time_since = apply_filters_ref_array( 'bp_activity_time_since', array( '<span class="time-since">' . bp_core_time_since( $activities_template->activity->date_recorded ) . '</span>', &$activities_template->activity ) ); 1188 1189 // Insert the permalink 1190 if ( !bp_is_single_activity() ) 1191 $content = apply_filters_ref_array( 'bp_activity_permalink', array( sprintf( '%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ), esc_attr__( 'View Discussion', 'buddypress' ), $time_since ), &$activities_template->activity ) ); 1192 else 1193 $content .= str_pad( $time_since, strlen( $time_since ) + 2, ' ', STR_PAD_BOTH ); 1194 1195 return apply_filters( 'bp_insert_activity_meta', $content ); 1196 } 1197 1198 /** 1199 * Determine if the current user can delete an activity item 1200 * 1201 * @since 1.2.0 1202 * 1203 * @param object $activity Optional 1204 * 1205 * @global object $activities_template {@link BP_Activity_Template} 1206 * @global object $bp BuddyPress global settings 1207 * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook 1208 * 1209 * @return bool True if can delete, false otherwise 1210 */ 769 1211 function bp_activity_user_can_delete( $activity = false ) { 770 1212 global $activities_template, $bp; … … 790 1232 } 791 1233 1234 /** 1235 * Output the activity parent content 1236 * 1237 * @since 1.2.0 1238 * 1239 * @param array $args Optional 1240 * 1241 * @uses bp_get_activity_parent_content() 1242 */ 792 1243 function bp_activity_parent_content( $args = '' ) { 793 1244 echo bp_get_activity_parent_content($args); 794 1245 } 1246 1247 /** 1248 * Return the activity content 1249 * 1250 * @since 1.2.0 1251 * 1252 * @param array $args Optional 1253 * 1254 * @global object $bp BuddyPress global settings 1255 * @global object $activities_template {@link BP_Activity_Template} 1256 * @uses wp_parse_args() 1257 * @uses apply_filters() To call the 'bp_get_activity_parent_content' hook 1258 * 1259 * @return mixed False on failure, otherwise the activity parent content 1260 */ 795 1261 function bp_get_activity_parent_content( $args = '' ) { 796 1262 global $bp, $activities_template; … … 825 1291 } 826 1292 1293 /** 1294 * Output whether or not the current activity is in a current user's favorites 1295 * 1296 * @since 1.2.0 1297 * 1298 * @uses bp_get_activity_is_favorite() 1299 */ 827 1300 function bp_activity_is_favorite() { 828 1301 echo bp_get_activity_is_favorite(); 829 1302 } 1303 1304 /** 1305 * Return whether or not the current activity is in a current user's favorites 1306 * 1307 * @since 1.2.0 1308 * 1309 * @global object $bp BuddyPress global settings 1310 * @global object $activities_template {@link BP_Activity_Template} 1311 * @uses apply_filters() To call the 'bp_get_activity_is_favorite' hook 1312 * 1313 * @return bool True if user favorite, false otherwise 1314 */ 830 1315 function bp_get_activity_is_favorite() { 831 1316 global $bp, $activities_template; … … 837 1322 * Echoes the comment markup for an activity item 838 1323 * 839 * @package BuddyPress 840 * @subpackage Activity Template 841 * 842 * @param str $args Unused 1324 * @since 1.2.0 1325 * 1326 * @todo deprecate $args param 1327 * 1328 * @param string $args Unused. Appears to be left over from an earlier implementation. 843 1329 */ 844 1330 function bp_activity_comments( $args = '' ) { 845 1331 echo bp_activity_get_comments( $args ); 846 1332 } 1333 847 1334 /** 848 1335 * Gets the comment markup for an activity item 849 1336 * 850 * @ package BuddyPress851 * @subpackage Activity Template852 * 853 * @param str $args Unused. Appears to be left over from an earlier implementation.1337 * @since 1.2.0 1338 * 1339 * @todo deprecate $args param 1340 * 854 1341 * @todo Given that checks for children already happen in bp_activity_recurse_comments(), 855 1342 * this function can probably be streamlined or removed. 1343 * 1344 * @param string $args Unused. Appears to be left over from an earlier implementation. 1345 * 1346 * @global object $activities_template {@link BP_Activity_Template} 1347 * @global object $bp BuddyPress global settings 1348 * @uses bp_activity_recurse_comments() 856 1349 */ 857 1350 function bp_activity_get_comments( $args = '' ) { … … 870 1363 * split between here and the comment.php template. 871 1364 * 872 * @package BuddyPress 873 * @subpackage Activity Template 1365 * @since 1.2.0 874 1366 * 875 * @param obj $comment The activity object currently being recursed 1367 * @todo remove $counter global 1368 * 1369 * @param object $comment The activity object currently being recursed 1370 * 1371 * @global object $activities_template {@link BP_Activity_Template} 1372 * @global object $bp BuddyPress global settings 1373 * @uses locate_template() 876 1374 */ 877 1375 function bp_activity_recurse_comments( $comment ) { … … 909 1407 * Utility function that returns the comment currently being recursed 910 1408 * 911 * @package BuddyPress 912 * @subpackage Activity Template 913 * @since 1.5 914 * 915 * @return obj $current_comment The activity comment currently being displayed 1409 * @since 1.5.0 1410 * 1411 * @global object $activities_template {@link BP_Activity_Template} 1412 * @uses apply_filters() To call the 'bp_activity_current_comment' hook 1413 * 1414 * @return object|bool $current_comment The activity comment currently being displayed. False on failure 916 1415 */ 917 1416 function bp_activity_current_comment() { … … 927 1426 * Echoes the id of the activity comment currently being displayed 928 1427 * 929 * @ package BuddyPress930 * @subpackage Activity Template931 * @ since 1.51428 * @since 1.5.0 1429 * 1430 * @uses bp_get_activity_comment_id() 932 1431 */ 933 1432 function bp_activity_comment_id() { 934 1433 echo bp_get_activity_comment_id(); 935 1434 } 1435 936 1436 /** 937 1437 * Gets the id of the activity comment currently being displayed 938 1438 * 939 * @package BuddyPress 940 * @subpackage Activity Template 941 * @since 1.5 1439 * @since 1.5.0 1440 * 1441 * @global object $activities_template {@link BP_Activity_Template} 1442 * @uses apply_filters() To call the 'bp_activity_comment_id' hook 942 1443 * 943 1444 * @return int $comment_id The id of the activity comment currently being displayed … … 954 1455 * Echoes the user_id of the author of the activity comment currently being displayed 955 1456 * 956 * @ package BuddyPress957 * @subpackage Activity Template958 * @ since 1.51457 * @since 1.5.0 1458 * 1459 * @uses bp_get_activity_comment_user_id() 959 1460 */ 960 1461 function bp_activity_comment_user_id() { 961 1462 echo bp_get_activity_comment_user_id(); 962 1463 } 1464 963 1465 /** 964 1466 * Gets the user_id of the author of the activity comment currently being displayed 965 1467 * 966 * @package BuddyPress 967 * @subpackage Activity Template 968 * @since 1.5 969 * 970 * @return int $user_id The user_id of the author of the displayed activity comment 1468 * @since 1.5.0 1469 * 1470 * @global object $activities_template {@link BP_Activity_Template} 1471 * @uses apply_filters() To call the 'bp_activity_comment_user_id' hook 1472 * 1473 * @return int|bool $user_id The user_id of the author of the displayed activity comment. False on failure 971 1474 */ 972 1475 function bp_get_activity_comment_user_id() { … … 981 1484 * Echoes the author link for the activity comment currently being displayed 982 1485 * 983 * @ package BuddyPress984 * @subpackage Activity Template985 * @ since 1.51486 * @since 1.5.0 1487 * 1488 * @uses bp_get_activity_comment_user_link() 986 1489 */ 987 1490 function bp_activity_comment_user_link() { 988 1491 echo bp_get_activity_comment_user_link(); 989 1492 } 1493 990 1494 /** 991 1495 * Gets the author link for the activity comment currently being displayed 992 1496 * 993 * @package BuddyPress 994 * @subpackage Activity Template 995 * @since 1.5 996 * 997 * @return str $user_link The URL of the activity comment author's profile 1497 * @since 1.5.0 1498 * 1499 * @uses bp_core_get_user_domain() 1500 * @uses bp_get_activity_comment_user_id() 1501 * @uses apply_filters() To call the 'bp_activity_comment_user_link' hook 1502 * 1503 * @return string $user_link The URL of the activity comment author's profile 998 1504 */ 999 1505 function bp_get_activity_comment_user_link() { … … 1006 1512 * Echoes the author name for the activity comment currently being displayed 1007 1513 * 1008 * @ package BuddyPress1009 * @subpackage Activity Template1010 * @ since 1.51514 * @since 1.5.0 1515 * 1516 * @uses bp_get_activity_comment_name() 1011 1517 */ 1012 1518 function bp_activity_comment_name() { 1013 1519 echo bp_get_activity_comment_name(); 1014 1520 } 1521 1015 1522 /** 1016 1523 * Gets the author name for the activity comment currently being displayed … … 1018 1525 * The use of the bp_acomment_name filter is deprecated. Please use bp_activity_comment_name 1019 1526 * 1020 * @package BuddyPress 1021 * @subpackage Activity Template 1022 * @since 1.5 1023 * 1024 * @return str $name The full name of the activity comment author 1527 * @since 1.5.0 1528 * 1529 * @global object $activities_template {@link BP_Activity_Template} 1530 * @uses apply_filters() To call the 'bp_acomment_name' hook 1531 * @uses apply_filters() To call the 'bp_activity_comment_name' hook 1532 * 1533 * @return string $name The full name of the activity comment author 1025 1534 */ 1026 1535 function bp_get_activity_comment_name() { … … 1035 1544 * Echoes the date_recorded of the activity comment currently being displayed 1036 1545 * 1037 * @ package BuddyPress1038 * @subpackage Activity Template1039 * @ since 1.51546 * @since 1.5.0 1547 * 1548 * @uses bp_get_activity_comment_date_recorded() 1040 1549 */ 1041 1550 function bp_activity_comment_date_recorded() { 1042 1551 echo bp_get_activity_comment_date_recorded(); 1043 1552 } 1553 1044 1554 /** 1045 1555 * Gets the date_recorded for the activity comment currently being displayed 1046 1556 * 1047 * @package BuddyPress 1048 * @subpackage Activity Template 1049 * @since 1.5 1050 * 1051 * @return str $date_recorded Time since the activity was recorded, of the form "%s ago" 1557 * @since 1.5.0 1558 * 1559 * @global object $activities_template {@link BP_Activity_Template} 1560 * @uses bp_core_time_since() 1561 * @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook 1562 * 1563 * @return string|bool $date_recorded Time since the activity was recorded, of the form "%s ago". False on failure 1052 1564 */ 1053 1565 function bp_get_activity_comment_date_recorded() { … … 1065 1577 * Echoes the 'delete' URL for the activity comment currently being displayed 1066 1578 * 1067 * @ package BuddyPress1068 * @subpackage Activity Template1069 * @ since 1.51579 * @since 1.5.0 1580 * 1581 * @uses bp_get_activity_comment_delete_link() 1070 1582 */ 1071 1583 function bp_activity_comment_delete_link() { 1072 1584 echo bp_get_activity_comment_delete_link(); 1073 1585 } 1586 1074 1587 /** 1075 1588 * Gets the 'delete' URL for the activity comment currently being displayed 1076 1589 * 1077 * @package BuddyPress 1078 * @subpackage Activity Template 1079 * @since 1.5 1080 * 1081 * @return str $link The nonced URL for deleting the current activity comment 1590 * @since 1.5.0 1591 * 1592 * @global object $bp BuddyPress global settings 1593 * @uses wp_nonce_url() 1594 * @uses bp_get_root_domain() 1595 * @uses bp_get_activity_slug() 1596 * @uses bp_get_activity_comment_id() 1597 * @uses apply_filters() To call the 'bp_activity_comment_delete_link' hook 1598 * 1599 * @return string $link The nonced URL for deleting the current activity comment 1082 1600 */ 1083 1601 function bp_get_activity_comment_delete_link() { … … 1092 1610 * Echoes the content of the activity comment currently being displayed 1093 1611 * 1094 * @ package BuddyPress1095 * @subpackage Activity Template1096 * @ since 1.51612 * @since 1.5.0 1613 * 1614 * @uses bp_get_activity_comment_content() 1097 1615 */ 1098 1616 function bp_activity_comment_content() { 1099 1617 echo bp_get_activity_comment_content(); 1100 1618 } 1619 1101 1620 /** 1102 1621 * Gets the content of the activity comment currently being displayed … … 1106 1625 * content of activity comments only. 1107 1626 * 1108 * @package BuddyPress 1109 * @subpackage Activity Template 1110 * @since 1.5 1111 * 1112 * @return str $content The content of the current activity comment 1627 * @since 1.5.0 1628 * 1629 * @global object $activities_template {@link BP_Activity_Template} 1630 * @uses apply_filters() To call the 'bp_get_activity_content' hook 1631 * @uses apply_filters() To call the 'bp_activity_comment_content' hook 1632 * 1633 * @return string $content The content of the current activity comment 1113 1634 */ 1114 1635 function bp_get_activity_comment_content() { … … 1120 1641 } 1121 1642 1643 /** 1644 * Echoes the activity comment count 1645 * 1646 * @since 1.2.0 1647 * 1648 * @uses bp_activity_get_comment_count() 1649 */ 1122 1650 function bp_activity_comment_count() { 1123 1651 echo bp_activity_get_comment_count(); 1124 1652 } 1653 1654 /** 1655 * Gets the content of the activity comment currently being displayed 1656 * 1657 * The content is run through two filters. bp_get_activity_content will apply all filters 1658 * applied to activity items in general. Use bp_activity_comment_content to modify the 1659 * content of activity comments only. 1660 * 1661 * @since 1.2.0 1662 * 1663 * @todo deprecate $args 1664 * 1665 * @global object $activities_template {@link BP_Activity_Template} 1666 * @global object $bp BuddyPress global settings 1667 * @uses bp_activity_recurse_comment_count() 1668 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook 1669 * 1670 * @return int $count The activity comment count. Defaults to zero 1671 */ 1125 1672 function bp_activity_get_comment_count( $args = '' ) { 1126 1673 global $activities_template, $bp; … … 1133 1680 return apply_filters( 'bp_activity_get_comment_count', (int)$count ); 1134 1681 } 1682 1683 /** 1684 * Gets the content of the activity comment currently being displayed 1685 * 1686 * The content is run through two filters. bp_get_activity_content will apply all filters 1687 * applied to activity items in general. Use bp_activity_comment_content to modify the 1688 * content of activity comments only. 1689 * 1690 * @since 1.2.0 1691 * 1692 * @todo investigate why bp_activity_recurse_comment_count() is used while being declared 1693 * 1694 * @param object $comment Activity comments object 1695 * 1696 * @global object $activities_template {@link BP_Activity_Template} 1697 * @global object $bp BuddyPress global settings 1698 * @uses bp_activity_recurse_comment_count() 1699 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook 1700 * 1701 * @return int $count The activity comment count. 1702 */ 1135 1703 function bp_activity_recurse_comment_count( $comment, $count = 0 ) { 1136 1704 global $activities_template, $bp; … … 1147 1715 } 1148 1716 1717 /** 1718 * Echoes the activity comment link 1719 * 1720 * @since 1.2.0 1721 * 1722 * @uses bp_get_activity_comment_link() 1723 */ 1149 1724 function bp_activity_comment_link() { 1150 1725 echo bp_get_activity_comment_link(); 1151 1726 } 1727 1728 /** 1729 * Gets the activity comment link 1730 * 1731 * @since 1.2.0 1732 * 1733 * @global object $activities_template {@link BP_Activity_Template} 1734 * @uses apply_filters() To call the 'bp_get_activity_comment_link' hook 1735 * 1736 * @return string The activity comment link 1737 */ 1152 1738 function bp_get_activity_comment_link() { 1153 1739 global $activities_template; … … 1155 1741 } 1156 1742 1743 /** 1744 * Echoes the activity comment form no javascript display CSS 1745 * 1746 * @since 1.2.0 1747 * 1748 * @uses bp_get_activity_comment_form_nojs_display() 1749 */ 1157 1750 function bp_activity_comment_form_nojs_display() { 1158 1751 echo bp_get_activity_comment_form_nojs_display(); 1159 1752 } 1753 1754 /** 1755 * Gets the activity comment form no javascript display CSS 1756 * 1757 * @since 1.2.0 1758 * 1759 * @global object $activities_template {@link BP_Activity_Template} 1760 * 1761 * @return string|bool The activity comment form no javascript display CSS. False on failure 1762 */ 1160 1763 function bp_get_activity_comment_form_nojs_display() { 1161 1764 global $activities_template; … … 1166 1769 } 1167 1770 1771 /** 1772 * Echoes the activity comment form action 1773 * 1774 * @since 1.2.0 1775 * 1776 * @uses bp_get_activity_comment_form_action() 1777 */ 1168 1778 function bp_activity_comment_form_action() { 1169 1779 echo bp_get_activity_comment_form_action(); 1170 1780 } 1781 1782 /** 1783 * Gets the activity comment form action 1784 * 1785 * @since 1.2.0 1786 * 1787 * @global object $bp BuddyPress global settings 1788 * @uses home_url() 1789 * @uses bp_get_activity_root_slug() 1790 * @uses apply_filters() To call the 'bp_get_activity_comment_form_action' hook 1791 * 1792 * @return string The activity comment form action 1793 */ 1171 1794 function bp_get_activity_comment_form_action() { 1172 1795 global $bp; … … 1175 1798 } 1176 1799 1800 /** 1801 * Echoes the activity permalink id 1802 * 1803 * @since 1.2.0 1804 * 1805 * @uses bp_get_activity_permalink_id() 1806 */ 1177 1807 function bp_activity_permalink_id() { 1178 1808 echo bp_get_activity_permalink_id(); 1179 1809 } 1810 1811 /** 1812 * Gets the activity permalink id 1813 * 1814 * @since 1.2.0 1815 * 1816 * @global object $bp BuddyPress global settings 1817 * @uses apply_filters() To call the 'bp_get_activity_permalink_id' hook 1818 * 1819 * @return string The activity permalink id 1820 */ 1180 1821 function bp_get_activity_permalink_id() { 1181 1822 global $bp; … … 1184 1825 } 1185 1826 1827 /** 1828 * Echoes the activity thread permalink 1829 * 1830 * @since 1.2.0 1831 * 1832 * @uses bp_get_activity_permalink_id() 1833 */ 1186 1834 function bp_activity_thread_permalink() { 1187 1835 echo bp_get_activity_thread_permalink(); 1188 1836 } 1837 1838 /** 1839 * Gets the activity thread permalink 1840 * 1841 * @since 1.2.0 1842 * 1843 * @global object $bp BuddyPress global settings 1844 * @uses bp_activity_get_permalink() 1845 * @uses apply_filters() To call the 'bp_get_activity_thread_permalink' hook 1846 * 1847 * @return string $link The activity thread permalink 1848 */ 1189 1849 function bp_get_activity_thread_permalink() { 1190 1850 global $bp, $activities_template; … … 1195 1855 } 1196 1856 1857 /** 1858 * Echoes the activity favorite link 1859 * 1860 * @since 1.2.0 1861 * 1862 * @uses bp_get_activity_favorite_link() 1863 */ 1197 1864 function bp_activity_favorite_link() { 1198 1865 echo bp_get_activity_favorite_link(); 1199 1866 } 1867 1868 /** 1869 * Gets the activity favorite link 1870 * 1871 * @since 1.2.0 1872 * 1873 * @global object $bp BuddyPress global settings 1874 * @global object $activities_template {@link BP_Activity_Template} 1875 * @uses wp_nonce_url() 1876 * @uses home_url() 1877 * @uses bp_get_activity_root_slug() 1878 * @uses apply_filters() To call the 'bp_get_activity_favorite_link' hook 1879 * 1880 * @return string The activity favorite link 1881 */ 1200 1882 function bp_get_activity_favorite_link() { 1201 1883 global $bp, $activities_template; … … 1203 1885 } 1204 1886 1887 /** 1888 * Echoes the activity unfavorite link 1889 * 1890 * @since 1.2.0 1891 * 1892 * @uses bp_get_activity_unfavorite_link() 1893 */ 1205 1894 function bp_activity_unfavorite_link() { 1206 1895 echo bp_get_activity_unfavorite_link(); 1207 1896 } 1897 1898 /** 1899 * Gets the activity unfavorite link 1900 * 1901 * @since 1.2.0 1902 * 1903 * @global object $bp BuddyPress global settings 1904 * @global object $activities_template {@link BP_Activity_Template} 1905 * @uses wp_nonce_url() 1906 * @uses home_url() 1907 * @uses bp_get_activity_root_slug() 1908 * @uses apply_filters() To call the 'bp_get_activity_unfavorite_link' hook 1909 * 1910 * @return string The activity unfavorite link 1911 */ 1208 1912 function bp_get_activity_unfavorite_link() { 1209 1913 global $bp, $activities_template; … … 1211 1915 } 1212 1916 1917 /** 1918 * Echoes the activity CSS class 1919 * 1920 * @since 1.0.0 1921 * 1922 * @uses bp_get_activity_css_class() 1923 */ 1213 1924 function bp_activity_css_class() { 1214 1925 echo bp_get_activity_css_class(); 1215 1926 } 1927 1928 /** 1929 * Gets the activity CSS class 1930 * 1931 * @since 1.0.0 1932 * 1933 * @global object $activities_template {@link BP_Activity_Template} 1934 * @uses apply_filters() To call the 'bp_activity_mini_activity_types' hook 1935 * @uses bp_activity_get_comment_count() 1936 * @uses bp_activity_can_comment() 1937 * @uses apply_filters() To call the 'bp_get_activity_css_class' hook 1938 * 1939 * @return string The activity css class 1940 */ 1216 1941 function bp_get_activity_css_class() { 1217 1942 global $activities_template; … … 1237 1962 1238 1963 /** 1239 * bp_activity_delete_link()1240 *1241 1964 * Display the activity delete link. 1242 1965 * 1243 * @since 1.1 1966 * @since 1.1.0 1967 * 1244 1968 * @uses bp_get_activity_delete_link() 1245 1969 */ … … 1249 1973 1250 1974 /** 1251 * bp_get_activity_delete_link()1252 *1253 1975 * Return the activity delete link. 1254 1976 * 1255 * @global object $activities_template BuddyPress Activities Template 1977 * @since 1.1.0 1978 * 1979 * @global object $activities_template {@link BP_Activity_Template} 1256 1980 * @global object $bp BuddyPress global settings 1981 * @uses bp_get_root_domain() 1982 * @uses bp_get_activity_root_slug() 1983 * @uses bp_is_activity_component() 1984 * @uses bp_current_action() 1985 * @uses add_query_arg() 1986 * @uses wp_get_referer() 1987 * @uses wp_nonce_url() 1988 * @uses apply_filters() To call the 'bp_get_activity_delete_link' hook 1989 * 1257 1990 * @return string $link Activity delete link. Contains $redirect_to arg if on single activity page. 1258 * @since 1.11259 1991 */ 1260 1992 function bp_get_activity_delete_link() { … … 1274 2006 } 1275 2007 2008 /** 2009 * Display the activity latest update link. 2010 * 2011 * @since 1.2.0 2012 * 2013 * @param int $user_id Defaults to 0 2014 * 2015 * @uses bp_get_activity_latest_update() 2016 */ 1276 2017 function bp_activity_latest_update( $user_id = 0 ) { 1277 2018 echo bp_get_activity_latest_update( $user_id ); 1278 2019 } 2020 2021 /** 2022 * Return the activity latest update link. 2023 * 2024 * @since 1.2.0 2025 * 2026 * @param int $user_id Defaults to 0 2027 * 2028 * @global object $bp BuddyPress global settings 2029 * @uses bp_core_is_user_spammer() 2030 * @uses bp_core_is_user_deleted() 2031 * @uses bp_get_user_meta() 2032 * @uses apply_filters() To call the 'bp_get_activity_latest_update_excerpt' hook 2033 * @uses bp_create_excerpt() 2034 * @uses bp_get_root_domain() 2035 * @uses bp_get_activity_root_slug() 2036 * @uses apply_filters() To call the 'bp_get_activity_latest_update' hook 2037 * 2038 * @return string|bool $latest_update The activity latest update link. False on failure 2039 */ 1279 2040 function bp_get_activity_latest_update( $user_id = 0 ) { 1280 2041 global $bp; … … 1295 2056 } 1296 2057 2058 /** 2059 * Display the activity filter links. 2060 * 2061 * @since 1.1.0 2062 * 2063 * @param array $args Defaults to false 2064 * 2065 * @uses bp_get_activity_filter_links() 2066 */ 1297 2067 function bp_activity_filter_links( $args = false ) { 1298 2068 echo bp_get_activity_filter_links( $args ); 1299 2069 } 2070 2071 /** 2072 * Return the activity filter links. 2073 * 2074 * @since 1.1.0 2075 * 2076 * @param array $args Defaults to false 2077 * 2078 * @global object $activities_template {@link BP_Activity_Template} 2079 * @global object $bp BuddyPress global settings 2080 * @uses wp_parse_args() 2081 * @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity} 2082 * @uses esc_attr() 2083 * @uses add_query_arg() 2084 * @uses remove_query_arg() 2085 * @uses apply_filters() To call the 'bp_get_activity_filter_link_href' hook 2086 * @uses apply_filters() To call the 'bp_get_activity_filter_links' hook 2087 * 2088 * @return string|bool $component_links The activity filter links. False on failure 2089 */ 1300 2090 function bp_get_activity_filter_links( $args = false ) { 1301 2091 global $activities_template, $bp; … … 1363 2153 } 1364 2154 2155 /** 2156 * Determine if a comment can be made on an activity item 2157 * 2158 * @since 1.2.0 2159 * 2160 * @global object $activities_template {@link BP_Activity_Template} 2161 * @global object $bp BuddyPress global settings 2162 * @uses bp_get_activity_action_name() 2163 * @uses apply_filters() To call the 'bp_activity_can_comment' hook 2164 * 2165 * @return bool $can_comment Defaults to true 2166 */ 1365 2167 function bp_activity_can_comment() { 1366 2168 global $activities_template, $bp; … … 1379 2181 } 1380 2182 2183 /** 2184 * Determine if a comment can be made on an activity reply item 2185 * 2186 * @since 1.5.0 2187 * 2188 * @param object $comment Activity comment 2189 * 2190 * @uses apply_filters() To call the 'bp_activity_can_comment_reply' hook 2191 * 2192 * @return bool $can_comment Defaults to true 2193 */ 1381 2194 function bp_activity_can_comment_reply( $comment ) { 1382 2195 $can_comment = true; … … 1385 2198 } 1386 2199 2200 /** 2201 * Determine if an favorites are allowed 2202 * 2203 * @since 1.5.0 2204 * 2205 * @uses apply_filters() To call the 'bp_activity_can_favorite' hook 2206 * 2207 * @return bool $can_favorite Defaults to true 2208 */ 1387 2209 function bp_activity_can_favorite() { 1388 2210 $can_favorite = true; … … 1391 2213 } 1392 2214 2215 /** 2216 * Echoes the total favorite count for a specified user 2217 * 2218 * @since 1.2.0 2219 * 2220 * @param int $user_id Defaults to 0 2221 * 2222 * @uses bp_get_total_favorite_count_for_user() 2223 */ 1393 2224 function bp_total_favorite_count_for_user( $user_id = 0 ) { 1394 2225 echo bp_get_total_favorite_count_for_user( $user_id ); 1395 2226 } 2227 2228 /** 2229 * Returns the total favorite count for a specified user 2230 * 2231 * @since 1.2.0 2232 * 2233 * @param int $user_id Defaults to 0 2234 * 2235 * @uses bp_activity_total_favorites_for_user() 2236 * @uses apply_filters() To call the 'bp_get_total_favorite_count_for_user' hook 2237 * 2238 * @return int The total favorite count for a specified user 2239 */ 1396 2240 function bp_get_total_favorite_count_for_user( $user_id = 0 ) { 1397 2241 return apply_filters( 'bp_get_total_favorite_count_for_user', bp_activity_total_favorites_for_user( $user_id ) ); 1398 2242 } 1399 2243 2244 /** 2245 * Echoes the total mention count for a specified user 2246 * 2247 * @since 1.2.0 2248 * 2249 * @param int $user_id Defaults to 0 2250 * 2251 * @uses bp_get_total_favorite_count_for_user() 2252 */ 1400 2253 function bp_total_mention_count_for_user( $user_id = 0 ) { 1401 2254 echo bp_get_total_favorite_count_for_user( $user_id ); 1402 2255 } 2256 2257 /** 2258 * Returns the total mention count for a specified user 2259 * 2260 * @since 1.2.0 2261 * 2262 * @todo remove unnecessary $bp global 2263 * 2264 * @param int $user_id Defaults to 0 2265 * 2266 * @uses bp_get_user_meta() 2267 * @uses apply_filters() To call the 'bp_get_total_mention_count_for_user' hook 2268 * 2269 * @return int The total mention count for a specified user 2270 */ 1403 2271 function bp_get_total_mention_count_for_user( $user_id = 0 ) { 1404 2272 global $bp; … … 1407 2275 } 1408 2276 2277 /** 2278 * Echoes the public message link for displayed user 2279 * 2280 * @since 1.2.0 2281 * 2282 * @uses bp_get_send_public_message_link() 2283 */ 1409 2284 function bp_send_public_message_link() { 1410 2285 echo bp_get_send_public_message_link(); 1411 2286 } 2287 2288 /** 2289 * Returns the public message link for displayed user 2290 * 2291 * @since 1.2.0 2292 * 2293 * @global object $bp BuddyPress global settings 2294 * @uses bp_is_my_profile() 2295 * @uses is_user_logged_in() 2296 * @uses wp_nonce_url() 2297 * @uses bp_loggedin_user_domain() 2298 * @uses bp_get_activity_slug() 2299 * @uses bp_core_get_username() 2300 * @uses apply_filters() To call the 'bp_get_send_public_message_link' hook 2301 * 2302 * @return string The public message link for displayed user 2303 */ 1412 2304 function bp_get_send_public_message_link() { 1413 2305 global $bp; … … 1419 2311 } 1420 2312 2313 /** 2314 * Echoes the mentioned user display name 2315 * 2316 * @since 1.2.0 2317 * 2318 * @param int|string User id or username 2319 * 2320 * @uses bp_get_mentioned_user_display_name() 2321 */ 1421 2322 function bp_mentioned_user_display_name( $user_id_or_username ) { 1422 2323 echo bp_get_mentioned_user_display_name( $user_id_or_username ); 1423 2324 } 2325 2326 /** 2327 * Returns the mentioned user display name 2328 * 2329 * @since 1.2.0 2330 * 2331 * @param int|string User id or username 2332 * 2333 * @uses bp_core_get_user_displayname() 2334 * @uses apply_filters() To call the 'bp_get_mentioned_user_display_name' hook 2335 * 2336 * @return string The mentioned user display name 2337 */ 1424 2338 function bp_get_mentioned_user_display_name( $user_id_or_username ) { 1425 2339 if ( !$name = bp_core_get_user_displayname( $user_id_or_username ) ) … … 1430 2344 1431 2345 /** 1432 * bp_send_public_message_button( $args )1433 *1434 2346 * Output button for sending a public message 1435 2347 * 1436 * @param array $args 2348 * @since 1.2.0 2349 * 2350 * @param array $args Optional 2351 * 2352 * @uses bp_get_send_public_message_button() 1437 2353 */ 1438 2354 function bp_send_public_message_button( $args = '' ) { 1439 2355 echo bp_get_send_public_message_button( $args ); 1440 2356 } 1441 /** 1442 * bp_get_send_public_message_button( $args ) 1443 * 2357 2358 /** 1444 2359 * Return button for sending a public message 1445 2360 * 1446 * @param array $args 1447 * @return string 2361 * @since 1.2.0 2362 * 2363 * @param array $args Optional 2364 * 2365 * @uses bp_get_send_public_message_link() 2366 * @uses wp_parse_args() 2367 * @uses bp_get_button() 2368 * @uses apply_filters() To call the 'bp_get_send_public_message_button' hook 2369 * 2370 * @return string The button for sending a public message 1448 2371 */ 1449 2372 function bp_get_send_public_message_button( $args = '' ) { … … 1466 2389 } 1467 2390 2391 /** 2392 * Outputs the activity post form action 2393 * 2394 * @since 1.2.0 2395 * 2396 * @uses bp_get_activity_post_form_action() 2397 */ 1468 2398 function bp_activity_post_form_action() { 1469 2399 echo bp_get_activity_post_form_action(); 1470 2400 } 2401 2402 /** 2403 * Returns the activity post form action 2404 * 2405 * @since 1.2.0 2406 * 2407 * @uses home_url() 2408 * @uses bp_get_activity_root_slug() 2409 * @uses apply_filters() To call the 'bp_get_activity_post_form_action' hook 2410 * 2411 * @return string The activity post form action 2412 */ 1471 2413 function bp_get_activity_post_form_action() { 1472 2414 return apply_filters( 'bp_get_activity_post_form_action', home_url( bp_get_activity_root_slug() . '/post/' ) ); 1473 2415 } 1474 2416 1475 /* RSS Feed Template Tags ***************************/ 1476 2417 /* RSS Feed Template Tags ****************************************************/ 2418 2419 /** 2420 * Outputs the sitewide activity feed link 2421 * 2422 * @since 1.0.0 2423 * 2424 * @uses bp_get_sitewide_activity_feed_link() 2425 */ 1477 2426 function bp_sitewide_activity_feed_link() { 1478 2427 echo bp_get_sitewide_activity_feed_link(); 1479 2428 } 2429 2430 /** 2431 * Returns the sitewide activity feed link 2432 * 2433 * @since 1.0.0 2434 * 2435 * @uses home_url() 2436 * @uses bp_get_activity_root_slug() 2437 * @uses apply_filters() To call the 'bp_get_sitewide_activity_feed_link' hook 2438 * 2439 * @return string The sitewide activity feed link 2440 */ 1480 2441 function bp_get_sitewide_activity_feed_link() { 1481 2442 return apply_filters( 'bp_get_sitewide_activity_feed_link', home_url( bp_get_activity_root_slug() . '/feed/' ) ); 1482 2443 } 1483 2444 2445 /** 2446 * Outputs the member activity feed link 2447 * 2448 * @since 1.2.0 2449 * 2450 * @uses bp_get_member_activity_feed_link() 2451 */ 1484 2452 function bp_member_activity_feed_link() { 1485 2453 echo bp_get_member_activity_feed_link(); 1486 2454 } 1487 function bp_activities_member_rss_link() { 1488 echo bp_get_member_activity_feed_link(); 1489 } 1490 2455 2456 /** 2457 * Outputs the member activity feed link 2458 * 2459 * @since 1.0.0 2460 * @deprecated 1.2.0 2461 * 2462 * @todo properly deprecated in favor of bp_member_activity_feed_link() 2463 * 2464 * @uses bp_get_member_activity_feed_link() 2465 */ 2466 function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link(); } 2467 2468 /** 2469 * Returns the member activity feed link 2470 * 2471 * @since 1.2.0 2472 * 2473 * @uses bp_is_profile_component() 2474 * @uses bp_is_current_action() 2475 * @uses bp_displayed_user_domain() 2476 * @uses bp_get_activity_slug() 2477 * @uses bp_is_active() 2478 * @uses bp_get_friends_slug() 2479 * @uses bp_get_groups_slug() 2480 * @uses apply_filters() To call the 'bp_get_activities_member_rss_link' hook 2481 * 2482 * @return string $link The member activity feed link 2483 */ 1491 2484 function bp_get_member_activity_feed_link() { 1492 2485 global $bp; … … 1507 2500 return apply_filters( 'bp_get_activities_member_rss_link', $link ); 1508 2501 } 2502 2503 /** 2504 * Returns the member activity feed link 2505 * 2506 * @since 1.0.0 2507 * @deprecated 1.2.0 2508 * 2509 * @todo properly deprecated in favor of bp_get_member_activity_feed_link() 2510 * 2511 * @uses bp_get_member_activity_feed_link() 2512 * 2513 * @return string The member activity feed link 2514 */ 1509 2515 function bp_get_activities_member_rss_link() { return bp_get_member_activity_feed_link(); } 1510 2516 1511 2517 1512 /** Template tags for RSS feed output *****************************************/ 1513 2518 /** Template tags for RSS feed output ****************************************/ 2519 2520 /** 2521 * Outputs the activity feed item guid 2522 * 2523 * @since 1.0.0 2524 * 2525 * @uses bp_activity_feed_item_guid() 2526 */ 1514 2527 function bp_activity_feed_item_guid() { 1515 2528 echo bp_get_activity_feed_item_guid(); 1516 2529 } 2530 2531 /** 2532 * Returns the activity feed item guid 2533 * 2534 * @since 1.2.0 2535 * 2536 * @global object $activities_template {@link BP_Activity_Template} 2537 * @uses apply_filters() To call the 'bp_get_activity_feed_item_guid' hook 2538 * 2539 * @return string The activity feed item guid 2540 */ 1517 2541 function bp_get_activity_feed_item_guid() { 1518 2542 global $activities_template; … … 1521 2545 } 1522 2546 2547 /** 2548 * Outputs the activity feed item title 2549 * 2550 * @since 1.0.0 2551 * 2552 * @uses bp_get_activity_feed_item_title() 2553 */ 1523 2554 function bp_activity_feed_item_title() { 1524 2555 echo bp_get_activity_feed_item_title(); 1525 2556 } 2557 2558 /** 2559 * Returns the activity feed item title 2560 * 2561 * @since 1.0.0 2562 * 2563 * @global object $activities_template {@link BP_Activity_Template} 2564 * @uses ent2ncr() 2565 * @uses convert_chars() 2566 * @uses bp_create_excerpt() 2567 * @uses apply_filters() To call the 'bp_get_activity_feed_item_title' hook 2568 * 2569 * @return string $title The activity feed item title 2570 */ 1526 2571 function bp_get_activity_feed_item_title() { 1527 2572 global $activities_template; … … 1544 2589 } 1545 2590 2591 /** 2592 * Outputs the activity feed item link 2593 * 2594 * @since 1.0.0 2595 * 2596 * @uses bp_get_activity_feed_item_link() 2597 */ 1546 2598 function bp_activity_feed_item_link() { 1547 2599 echo bp_get_activity_feed_item_link(); 1548 2600 } 2601 2602 /** 2603 * Returns the activity feed item link 2604 * 2605 * @since 1.0.0 2606 * 2607 * @global object $activities_template {@link BP_Activity_Template} 2608 * @uses apply_filters() To call the 'bp_get_activity_feed_item_link' hook 2609 * 2610 * @return string The activity feed item link 2611 */ 1549 2612 function bp_get_activity_feed_item_link() { 1550 2613 global $activities_template; … … 1553 2616 } 1554 2617 2618 /** 2619 * Outputs the activity feed item date 2620 * 2621 * @since 1.0.0 2622 * 2623 * @uses bp_get_activity_feed_item_date() 2624 */ 1555 2625 function bp_activity_feed_item_date() { 1556 2626 echo bp_get_activity_feed_item_date(); 1557 2627 } 2628 2629 /** 2630 * Returns the activity feed item date 2631 * 2632 * @since 1.0.0 2633 * 2634 * @global object $activities_template {@link BP_Activity_Template} 2635 * @uses apply_filters() To call the 'bp_get_activity_feed_item_date' hook 2636 * 2637 * @return string The activity feed item date 2638 */ 1558 2639 function bp_get_activity_feed_item_date() { 1559 2640 global $activities_template; … … 1562 2643 } 1563 2644 2645 /** 2646 * Outputs the activity feed item description 2647 * 2648 * @since 1.0.0 2649 * 2650 * @uses bp_get_activity_feed_item_description() 2651 */ 1564 2652 function bp_activity_feed_item_description() { 1565 2653 echo bp_get_activity_feed_item_description(); 1566 2654 } 2655 2656 /** 2657 * Returns the activity feed item description 2658 * 2659 * @since 1.0.0 2660 * 2661 * @global object $activities_template {@link BP_Activity_Template} 2662 * @uses ent2ncr() 2663 * @uses convert_chars() 2664 * @uses apply_filters() To call the 'bp_get_activity_feed_item_description' hook 2665 * 2666 * @return string The activity feed item description 2667 */ 1567 2668 function bp_get_activity_feed_item_description() { 1568 2669 global $activities_template; … … 1579 2680 * Template tag so we can hook activity feed to <head> 1580 2681 * 1581 * @since 1.5 2682 * @since 1.5.0 2683 * 2684 * @uses bloginfo() 2685 * @uses bp_sitewide_activity_feed_link() 1582 2686 */ 1583 2687 function bp_activity_sitewide_feed() { -
trunk/bp-activity/feeds/bp-activity-favorites-feed.php
r4817 r5109 1 1 <?php 2 2 3 /** 3 4 * RSS2 Feed Template for displaying a member's favorite activity 4 5 * 5 6 * @package BuddyPress 7 * @subpackage ActivityFeeds 6 8 */ 7 9 -
trunk/bp-activity/feeds/bp-activity-friends-feed.php
r5065 r5109 1 1 <?php 2 2 3 /** 3 4 * RSS2 Feed Template for displaying a member's friends activity stream. 4 5 * 5 6 * @package BuddyPress 7 * @subpackage ActivityFeeds 6 8 */ 7 9 -
trunk/bp-activity/feeds/bp-activity-group-feed.php
r4817 r5109 1 1 <?php 2 2 3 /** 3 4 * RSS2 Feed Template for displaying a group activity stream 4 5 * 5 6 * @package BuddyPress 7 * @subpackage ActivityFeeds 6 8 */ 7 9 -
trunk/bp-activity/feeds/bp-activity-mentions-feed.php
r4817 r5109 1 1 <?php 2 2 3 /** 3 4 * RSS2 Feed Template for displaying a member's group's activity 4 5 * 5 6 * @package BuddyPress 7 * @subpackage ActivityFeeds 6 8 */ 7 9 -
trunk/bp-activity/feeds/bp-activity-mygroups-feed.php
r4817 r5109 1 1 <?php 2 2 3 /** 3 4 * RSS2 Feed Template for displaying a member's group's activity 4 5 * 5 6 * @package BuddyPress 7 * @subpackage ActivityFeeds 6 8 */ 7 9 -
trunk/bp-activity/feeds/bp-activity-personal-feed.php
r4817 r5109 1 1 <?php 2 2 3 /** 3 4 * RSS2 Feed Template for displaying a member's activity stream. 4 5 * 5 6 * @package BuddyPress 7 * @subpackage ActivityFeeds 6 8 */ 7 9 -
trunk/bp-activity/feeds/bp-activity-sitewide-feed.php
r4817 r5109 1 1 <?php 2 2 3 /** 3 4 * RSS2 Feed Template for displaying the site wide activity stream. 4 5 * 5 6 * @package BuddyPress 7 * @subpackage ActivityFeeds 6 8 */ 7 9
Note: See TracChangeset
for help on using the changeset viewer.