Ticket #8913: 8913.2.patch
| File 8913.2.patch, 8.1 KB (added by , 3 years ago) |
|---|
-
bp-activity-notifications.php
41 41 ) 42 42 ); 43 43 44 /* translators: %s: the current user display name */45 $title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );46 44 $amount = 'single'; 47 45 48 46 if ( (int) $total_items > 1 ) { … … 57 55 58 56 case 'update_reply': 59 57 $link = bp_get_notifications_permalink(); 60 $title = __( 'New Activity reply', 'buddypress' );61 58 $amount = 'single'; 62 59 63 60 if ( (int) $total_items > 1 ) { … … 76 73 77 74 case 'comment_reply': 78 75 $link = bp_get_notifications_permalink(); 79 $title = __( 'New Activity comment reply', 'buddypress' );80 76 $amount = 'single'; 81 77 82 78 if ( (int) $total_items > 1 ) { -
classes/class-bp-activity-activity.php
536 536 } 537 537 538 538 // Spam. 539 if ( 'ham_only' == $r['spam'] ) {539 if ( 'ham_only' === $r['spam'] ) { 540 540 $where_conditions['spam_sql'] = 'a.is_spam = 0'; 541 } elseif ( 'spam_only' == $r['spam'] ) {541 } elseif ( 'spam_only' === $r['spam'] ) { 542 542 $where_conditions['spam_sql'] = 'a.is_spam = 1'; 543 543 } 544 544 -
classes/class-bp-activity-query.php
142 142 'IN', 'NOT IN', 143 143 'BETWEEN', 'NOT BETWEEN', 144 144 'REGEXP', 'NOT REGEXP', 'RLIKE' 145 ) ) ) {145 ), true ) ) { 146 146 $clause['compare'] = '='; 147 147 } 148 148 … … 155 155 156 156 // Value. 157 157 if ( isset( $clause['value'] ) ) { 158 if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {158 if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { 159 159 if ( ! is_array( $value ) ) { 160 160 $value = preg_split( '/[,\s]+/', $value ); 161 161 } … … 162 162 } 163 163 164 164 // Tinyint. 165 if ( ! empty( $column ) && true === in_array( $column, array( 'hide_sitewide', 'is_spam' ) ) ) {165 if ( ! empty( $column ) && true === in_array( $column, array( 'hide_sitewide', 'is_spam' ), true ) ) { 166 166 $sql_chunks['where'][] = $wpdb->prepare( "{$alias}{$column} = %d", $value ); 167 167 168 168 } else { -
classes/class-bp-activity-template.php
393 393 public function user_activities() { 394 394 if ( ( $this->current_activity + 1 ) < $this->activity_count ) { 395 395 return true; 396 } elseif ( ( $this->current_activity + 1 ) == $this->activity_count ) {396 } elseif ( ( $this->current_activity + 1 ) === $this->activity_count ) { 397 397 398 398 /** 399 399 * Fires right before the rewinding of activity posts. … … 432 432 } 433 433 434 434 // Loop has just started. 435 if ( $this->current_activity == 0 ) {435 if ( $this->current_activity === 0 ) { 436 436 437 437 /** 438 438 * Fires if the current activity item is the first in the activity loop. -
classes/class-bp-akismet.php
81 81 $user_result = bp_activity_get_meta( $activity['id'], '_bp_akismet_user_result' ); 82 82 $desc = ''; 83 83 84 if ( !$user_result || $user_result == $akismet_result ) {84 if ( !$user_result || $user_result === $akismet_result ) { 85 85 // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same. 86 if ( 'true' == $akismet_result && $activity['is_spam'] )86 if ( 'true' === $akismet_result && $activity['is_spam'] ) 87 87 $desc = __( 'Flagged as spam by Akismet', 'buddypress' ); 88 88 89 elseif ( 'false' == $akismet_result && !$activity['is_spam'] )89 elseif ( 'false' === $akismet_result && !$activity['is_spam'] ) 90 90 $desc = __( 'Cleared by Akismet', 'buddypress' ); 91 91 92 92 } else { 93 93 $who = bp_activity_get_meta( $activity['id'], '_bp_akismet_user' ); 94 94 95 if ( 'true' == $user_result ) {95 if ( 'true' === $user_result ) { 96 96 /* translators: %s: the name of the user */ 97 97 $desc = sprintf( __( 'Flagged as spam by %s', 'buddypress' ), $who ); 98 98 } else { … … 106 106 $b = array(); 107 107 foreach ( $actions as $k => $item ) { 108 108 $b[ $k ] = $item; 109 if ( $k == 'edit' )109 if ( $k === 'edit' ) 110 110 $b['history'] = '<a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history"> '. __( 'History', 'buddypress' ) . '</a>'; 111 111 } 112 112 … … 142 142 $value = '_bp_as_nonce_' . bp_loggedin_user_id(); 143 143 144 144 // If we're in the activity stream loop, we can use the current item's ID to make the nonce unique. 145 if ( 'bp_activity_entry_comments' == current_filter() ) {145 if ( 'bp_activity_entry_comments' === current_filter() ) { 146 146 $form_id .= '_' . bp_get_activity_id(); 147 147 $value .= '_' . bp_get_activity_id(); 148 148 } … … 172 172 */ 173 173 public function check_member_activity_update( $content, $user_id, $activity_id ) { 174 174 // By default, only handle activity updates and activity comments. 175 if ( empty( $this->last_activity ) || !in_array( $this->last_activity->type, BP_Akismet::get_activity_types() ) )175 if ( empty( $this->last_activity ) || !in_array( $this->last_activity->type, BP_Akismet::get_activity_types(), true ) ) 176 176 return; 177 177 178 178 // Was this $activity_id just marked as spam? If not, bail out. 179 if ( !$this->last_activity->id || $activity_id != $this->last_activity->id || 'false'== $this->last_activity->akismet_submission['bp_as_result'] )179 if ( !$this->last_activity->id || $activity_id !== $this->last_activity->id || 'false' === $this->last_activity->akismet_submission['bp_as_result'] ) 180 180 return; 181 181 182 182 // It was, so delete the member's latest activity update. … … 325 325 */ 326 326 public function mark_as_ham( $activity, $source ) { 327 327 // If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped. 328 if ( 'true' == bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) )328 if ( 'true' === bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) ) 329 329 $activity->content = bp_activity_at_name_filter( $activity->content, $activity->id ); 330 330 331 331 /** … … 424 424 $this->last_activity->akismet_submission = $activity_data; 425 425 426 426 // Spam. 427 if ( 'true' == $activity_data['bp_as_result'] ) {427 if ( 'true' === $activity_data['bp_as_result'] ) { 428 428 /** 429 429 * Fires after an activity item has been proven to be spam, but before officially being marked as spam. 430 430 * … … 571 571 $activity_data['blog'] = bp_get_option( 'home' ); 572 572 $activity_data['blog_charset'] = bp_get_option( 'blog_charset' ); 573 573 $activity_data['blog_lang'] = get_locale(); 574 $activity_data['referrer'] = $_SERVER['HTTP_REFERER'];574 $activity_data['referrer'] = isset( $_SERVER['HTTP_REFERER'] ) ? sanitize_text_field( $_SERVER['HTTP_REFERER'] ) : ""; 575 575 $activity_data['user_agent'] = bp_core_current_user_ua(); 576 576 $activity_data['user_ip'] = bp_core_current_user_ip(); 577 577 … … 602 602 foreach ( $activity_data as $key => $data ) 603 603 $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&'; 604 604 605 if ( 'check' == $check )605 if ( 'check' === $check ) 606 606 $path = 'comment-check'; 607 elseif ( 'submit' == $check )607 elseif ( 'submit' === $check ) 608 608 $path = 'submit-' . $spam; 609 609 610 610 // Send to Akismet. … … 647 647 */ 648 648 function add_history_metabox( $screen_action ) { 649 649 // Only proceed if we're on the edit screen. 650 if ( 'edit' != $screen_action )650 if ( 'edit' !== $screen_action ) 651 651 return; 652 652 653 653 // Display meta box with a low priority (low position on screen by default).