Ticket #5938: bp-activity-filters-5938.diff
File bp-activity-filters-5938.diff, 5.9 KB (added by , 10 years ago) |
---|
-
src/bp-activity/bp-activity-filters.php
113 113 /** 114 114 * Types of activity stream items to moderate. 115 115 * 116 * @since BuddyPress (1.6 )116 * @since BuddyPress (1.6.0) 117 117 * 118 118 * @return array $types List of the activity types to moderate. 119 119 */ … … 122 122 'activity_comment', 123 123 'activity_update' 124 124 ); 125 126 /** 127 * Filters the default activity types that BuddyPress should moderate. 128 * 129 * @since BuddyPress (1.6.0) 130 * 131 * @param array $types Default activity types to moderate. 132 */ 125 133 return apply_filters( 'bp_activity_check_activity_types', $types ); 126 134 } 127 135 … … 128 136 /** 129 137 * Moderate the posted activity item, if it contains moderate keywords. 130 138 * 131 * @since BuddyPress (1.6 )139 * @since BuddyPress (1.6.0) 132 140 * 133 141 * @param BP_Activity_Activity $activity The activity object to check. 134 142 */ … … 147 155 /** 148 156 * Mark the posted activity as spam, if it contains blacklist keywords. 149 157 * 150 * @since BuddyPress (1.6 )158 * @since BuddyPress (1.6.0) 151 159 * 152 160 * @param BP_Activity_Activity $activity The activity object to check. 153 161 */ … … 165 173 /** 166 174 * Custom kses filtering for activity content. 167 175 * 168 * @since BuddyPress (1.1 )176 * @since BuddyPress (1.1.0) 169 177 * 170 178 * @uses apply_filters() To call the 'bp_activity_allowed_tags' hook. 171 179 * @uses wp_kses() … … 196 204 $activity_allowedtags['span']['class'] = array(); 197 205 198 206 207 /** 208 * Filters the allowed HTML tags for BuddyPress Activity content. 209 * 210 * @since BuddyPress (1.2.0) 211 * 212 * @param array Array of allowed HTML tags and attributes. 213 */ 199 214 $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags ); 200 215 return wp_kses( $content, $activity_allowedtags ); 201 216 } … … 261 276 * If mentions are found, replace @mention text with user links and add our 262 277 * hook to send mention notifications after the activity item is saved. 263 278 * 264 * @since BuddyPress (1.5 )279 * @since BuddyPress (1.5.0) 265 280 * 266 281 * @uses bp_activity_find_mentions() 267 282 * … … 298 313 /** 299 314 * Sends emails and BP notifications for users @-mentioned in an activity item. 300 315 * 301 * @since BuddyPress (1.7 )316 * @since BuddyPress (1.7.0) 302 317 * 303 318 * @uses bp_activity_at_message_notification() 304 319 * @uses bp_activity_update_mention_count_for_user() … … 323 338 324 339 // Send @mentions and setup BP notifications 325 340 foreach( (array) $usernames as $user_id => $username ) { 326 // If you want to disable notifications, you can use this filter to stop email sending 341 /** 342 * Filters BuddyPress' ability to send email notifications for @mentions. 343 * 344 * @since BuddyPress (1.6.0) 345 * 346 * @param bool Whether or not BuddyPress should send a notification to the mentioned users. 347 * @param array $usernames Array of users potentially notified. 348 */ 327 349 if ( apply_filters( 'bp_activity_at_name_do_notifications', true, $usernames ) ) { 328 350 bp_activity_at_message_notification( $activity->id, $user_id ); 329 351 } … … 336 358 /** 337 359 * Catch links in activity text so rel=nofollow can be added. 338 360 * 339 * @since BuddyPress (1.2 )361 * @since BuddyPress (1.2.0) 340 362 * 341 363 * @param string $text Activity text. 342 364 * @return string $text Text with rel=nofollow added to any links. … … 348 370 /** 349 371 * Add rel=nofollow to a link. 350 372 * 351 * @since BuddyPress (1.2 )373 * @since BuddyPress (1.2.0) 352 374 * 353 375 * @param array $matches 354 376 * … … 364 386 /** 365 387 * Truncate long activity entries when viewed in activity streams. 366 388 * 367 * @since BuddyPress (1.5 )389 * @since BuddyPress (1.5.0) 368 390 * 369 391 * @uses bp_is_single_activity() 370 392 * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook. … … 384 406 if ( bp_is_single_activity() ) 385 407 return $text; 386 408 409 /** 410 * Filters the appended text for the activity excerpt. 411 * 412 * @since BuddyPress (1.5.0) 413 * 414 * @param string $read_more Internationalized "Read more" text. 415 */ 387 416 $append_text = apply_filters( 'bp_activity_excerpt_append_text', __( '[Read more]', 'buddypress' ) ); 417 418 /** 419 * Filters the excerpt length for the activity excerpt. 420 * 421 * @since BuddyPress (1.5.0) 422 * 423 * @param int $excerpt_length Number indicating how many words to trim the excerpt down to. 424 */ 388 425 $excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 ); 389 426 390 427 // Run the text through the excerpt function. If it's too short, the original text will be … … 400 437 $excerpt = sprintf( '%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text ); 401 438 } 402 439 440 /** 441 * Filters the composite activity excerpt entry. 442 * 443 * @since BuddyPress (1.5.0) 444 * 445 * @param string $excerpt Excerpt text and markup to be displayed. 446 * @param string $text The original activity entry text. 447 * @param string $append_text The final append text applied. 448 */ 403 449 return apply_filters( 'bp_activity_truncate_entry', $excerpt, $text, $append_text ); 404 450 } 405 451 … … 552 598 553 599 $global_pulse = 0; 554 600 555 // Check whether the global heartbeat settings already exist. 601 /** 602 * Filter that checks whether the global heartbeat settings already exist. 603 * 604 * @since BuddyPress (2.0.0) 605 * 606 * @param array $settings Heartbeat settings array. 607 */ 556 608 $heartbeat_settings = apply_filters( 'heartbeat_settings', array() ); 557 609 if ( ! empty( $heartbeat_settings['interval'] ) ) { 558 610 // 'Fast' is 5 … … 559 611 $global_pulse = is_numeric( $heartbeat_settings['interval'] ) ? absint( $heartbeat_settings['interval'] ) : 5; 560 612 } 561 613 562 // Filter here to specify a BP-specific pulse frequency 614 /** 615 * Filters the pulse frequency to be used for the BuddyPress Activity heartbeat. 616 * 617 * @since BuddyPress (2.0.0) 618 * 619 * @param int $frequency The frequency in seconds between pulses. 620 */ 563 621 $bp_activity_pulse = apply_filters( 'bp_activity_heartbeat_pulse', 15 ); 564 622 565 623 /**