Changeset 5325 for trunk/bp-activity/bp-activity-akismet.php
- Timestamp:
- 11/12/2011 09:09:29 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-akismet.php
r5284 r5325 76 76 if ( !$user_result || $user_result == $akismet_result ) { 77 77 // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same 78 if ( $akismet_result == 'true'&& $activity['is_spam'] )78 if ( 'true' == $akismet_result && $activity['is_spam'] ) 79 79 $desc = __( 'Flagged as spam by Akismet', 'buddypress' ); 80 80 81 elseif ( $akismet_result == 'false'&& !$activity['is_spam'] )81 elseif ( 'false' == $akismet_result && !$activity['is_spam'] ) 82 82 $desc = __( 'Cleared by Akismet', 'buddypress' ); 83 83 … … 85 85 $who = bp_activity_get_meta( $activity['id'], '_bp_akismet_user' ); 86 86 87 if ( $user_result == 'true')87 if ( 'true' == $user_result ) 88 88 $desc = sprintf( __( 'Flagged as spam by %s', 'buddypress' ), $who ); 89 89 else … … 97 97 $b[ $k ] = $item; 98 98 if ( $k == 'edit' ) 99 $b['history'] = '<a href=" #"> '. __( 'History', 'buddypress' ) . '</a>';99 $b['history'] = '<a href="' . network_admin_url( 'admin.php?page=bp-activity&action=edit&aid=' . $activity['id'] ) . '#history"> '. __( 'History', 'buddypress' ) . '</a>'; 100 100 } 101 101 … … 104 104 105 105 if ( $desc ) 106 echo '<span class="akismet-status"><a href=" #">' . htmlspecialchars( $desc ) . '</a></span>';106 echo '<span class="akismet-status"><a href="' . network_admin_url( 'admin.php?page=bp-activity&action=edit&aid=' . $activity['id'] ) . '#history">' . htmlspecialchars( $desc ) . '</a></span>'; 107 107 108 108 return apply_filters( 'bp_akismet_comment_row_action', $actions ); … … 240 240 * 241 241 * @param BP_Activity_Activity $activity 242 * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet" (automatically spammed).242 * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed). 243 243 * @since 1.6 244 244 */ 245 245 public function mark_as_ham( $activity, $source ) { 246 //DJPAULTODO: Run bp_activity_at_name_filter() somehow... but not twice, if we can help it. Maybe check if it was auto-spammed by Akismet? 246 // If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped. 247 if ( 'true' == bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) ) 248 $activity->content = bp_activity_at_name_filter( $activity->content, $activity->id ); 247 249 248 250 do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source ); … … 333 335 * Update activity meta after a manual spam change (user initiated) 334 336 * 335 * @global object $bp BuddyPress global settings336 337 * @param BP_Activity_Activity $activity The activity to check 337 338 * @since 1.6 338 339 */ 339 340 public function update_activity_spam_meta( $activity ) { 340 global $bp;341 342 341 // By default, only handle activity updates and activity comments. 343 342 if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) ) 344 343 return; 345 344 346 $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as spam', 'buddypress' ), $bp->loggedin_user->fullname), 'report-spam' );345 $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as spam', 'buddypress' ), bp_get_loggedin_user_fullname() ), 'report-spam' ); 347 346 bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'true' ); 348 bp_activity_update_meta( $activity->id, '_bp_akismet_user', $bp->loggedin_user->fullname);347 bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_fullname() ); 349 348 } 350 349 … … 352 351 * Update activity meta after a manual ham change (user initiated) 353 352 * 354 * @global object $bp BuddyPress global settings355 353 * @param BP_Activity_Activity $activity The activity to check 356 354 * @since 1.6 357 355 */ 358 356 public function update_activity_ham_meta( $activity ) { 359 global $bp;360 361 357 // By default, only handle activity updates and activity comments. 362 358 if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) ) 363 359 return; 364 360 365 $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as not spam', 'buddypress' ), $bp->loggedin_user->fullname), 'report-ham' );361 $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as not spam', 'buddypress' ), bp_get_loggedin_user_fullname() ), 'report-ham' ); 366 362 bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'false' ); 367 bp_activity_update_meta( $activity->id, '_bp_akismet_user', $bp->loggedin_user->fullname);363 bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_fullname() ); 368 364 } 369 365 … … 492 488 493 489 // Unique User Agent 494 $akismet_ua = 'BuddyPress/' . constant( 'BP_VERSION') . ' | Akismet/'. constant( 'AKISMET_VERSION' );490 $akismet_ua = 'BuddyPress/' . bp_get_version() . ' | Akismet/'. constant( 'AKISMET_VERSION' ); 495 491 496 492 // Use specific IP (if provided)
Note: See TracChangeset
for help on using the changeset viewer.