Ticket #5938: bp-activity-akismet-5938.diff
File bp-activity-akismet-5938.diff, 4.2 KB (added by , 10 years ago) |
---|
-
src/bp-activity/bp-activity-akismet.php
112 112 if ( $desc ) 113 113 echo '<span class="akismet-status"><a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history">' . htmlspecialchars( $desc ) . '</a></span>'; 114 114 115 /** 116 * Filters the list of actions for the current activity's row. 117 * 118 * @since BuddyPress (1.6.0) 119 * 120 * @param array $actions Array of available actions for the current activity item's row. 121 */ 115 122 return apply_filters( 'bp_akismet_comment_row_action', $actions ); 116 123 } 117 124 … … 239 246 * @return array List of activity types. 240 247 */ 241 248 public static function get_activity_types() { 249 250 /** 251 * Filters the list of activity types that Akismet should automatically check for spam. 252 * 253 * @since BuddyPress (1.6.0) 254 * 255 * @param array Array of default activity types for Akismet to check. 256 */ 242 257 return apply_filters( 'bp_akismet_get_activity_types', array( 'activity_comment', 'activity_update' ) ); 243 258 } 244 259 … … 254 269 // Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update() 255 270 $this->last_activity = $activity; 256 271 272 /** 273 * Fires after marking an activity item has been marked as spam. 274 * 275 * @since BuddyPress (1.6.0) 276 * 277 * @param BP_Activity_Activity $activity Activity object being marked as spam. 278 * @param string $source Source of the whom marked as spam. Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet". 279 */ 257 280 do_action( 'bp_activity_akismet_mark_as_spam', $activity, $source ); 258 281 } 259 282 … … 270 293 if ( 'true' == bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) ) 271 294 $activity->content = bp_activity_at_name_filter( $activity->content, $activity->id ); 272 295 296 /** 297 * Fires after marking an activity item has been marked as ham. 298 * 299 * @since BuddyPress (1.6.0) 300 * 301 * @param BP_Activity_Activity $activity Activity object being marked as ham. 302 * @param string $source Source of the whom marked as ham. Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed). 303 */ 273 304 do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source ); 274 305 } 275 306 … … 311 342 elseif ( !empty( $activity->secondary_item_id ) && !empty( $_POST['_bp_as_nonce_' . $activity->secondary_item_id] ) ) 312 343 $activity_data['akismet_comment_nonce'] = wp_verify_nonce( $_POST["_bp_as_nonce_{$activity->secondary_item_id}"], "_bp_as_nonce_{$userdata->ID}_{$activity->secondary_item_id}" ) ? 'passed' : 'failed'; 313 344 345 /** 346 * Filters activity data before being sent to Akismet to inspect. 347 * 348 * @since BuddyPress (1.6.0) 349 * 350 * @param array $activity_data Array of activity data for Akismet to inspect. 351 * @param BP_Activity_Activity $activity Activity item data. 352 */ 314 353 return apply_filters( 'bp_akismet_build_akismet_data_package', $activity_data, $activity ); 315 354 } 316 355 … … 347 386 348 387 // Spam 349 388 if ( 'true' == $activity_data['bp_as_result'] ) { 350 // Action for plugin authors 389 /** 390 * Fires after an activity item has been proven to be spam, but before officially being marked as spam. 391 * 392 * @since BuddyPress (1.6.0) 393 * 394 * @param BP_Activity_Activity $activity The activity item proven to be spam. 395 * @param array $activity_data Array of activity data for item including Akismet check results data. 396 */ 351 397 do_action_ref_array( 'bp_activity_akismet_spam_caught', array( &$activity, $activity_data ) ); 352 398 353 399 // Mark as spam … … 614 660 function bp_activity_akismet_delete_old_metadata() { 615 661 global $bp, $wpdb; 616 662 663 /** 664 * Filters the threshold for how many days old Akismet metadata needs to be before being automatically deleted. 665 * 666 * @since BuddyPress (1.6.0) 667 * 668 * @param integer 15 How many days old metadata needs to be. 669 */ 617 670 $interval = apply_filters( 'bp_activity_akismet_delete_meta_interval', 15 ); 618 671 619 672 // Enforce a minimum of 1 day