Skip to:
Content

BuddyPress.org

Ticket #8913: 8913.2.patch

File 8913.2.patch, 8.1 KB (added by viralsampat, 3 years ago)

I have checked above mentioned issue and founds few files. Here, I have added its patch.

  • bp-activity-notifications.php

     
    4141                                )
    4242                        );
    4343
    44                         /* translators: %s: the current user display name */
    45                         $title  = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );
    4644                        $amount = 'single';
    4745
    4846                        if ( (int) $total_items > 1 ) {
     
    5755
    5856                case 'update_reply':
    5957                        $link   = bp_get_notifications_permalink();
    60                         $title  = __( 'New Activity reply', 'buddypress' );
    6158                        $amount = 'single';
    6259
    6360                        if ( (int) $total_items > 1 ) {
     
    7673
    7774                case 'comment_reply':
    7875                        $link   = bp_get_notifications_permalink();
    79                         $title  = __( 'New Activity comment reply', 'buddypress' );
    8076                        $amount = 'single';
    8177
    8278                        if ( (int) $total_items > 1 ) {
  • classes/class-bp-activity-activity.php

     
    536536                }
    537537
    538538                // Spam.
    539                 if ( 'ham_only' == $r['spam'] ) {
     539                if ( 'ham_only' === $r['spam'] ) {
    540540                        $where_conditions['spam_sql'] = 'a.is_spam = 0';
    541                 } elseif ( 'spam_only' == $r['spam'] ) {
     541                } elseif ( 'spam_only' === $r['spam'] ) {
    542542                        $where_conditions['spam_sql'] = 'a.is_spam = 1';
    543543                }
    544544
  • classes/class-bp-activity-query.php

     
    142142                        'IN', 'NOT IN',
    143143                        'BETWEEN', 'NOT BETWEEN',
    144144                        'REGEXP', 'NOT REGEXP', 'RLIKE'
    145                 ) ) ) {
     145                ), true ) ) {
    146146                        $clause['compare'] = '=';
    147147                }
    148148
     
    155155
    156156                // Value.
    157157                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 ) ) {
    159159                                if ( ! is_array( $value ) ) {
    160160                                        $value = preg_split( '/[,\s]+/', $value );
    161161                                }
     
    162162                        }
    163163
    164164                        // 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 ) ) {
    166166                                $sql_chunks['where'][] = $wpdb->prepare( "{$alias}{$column} = %d", $value );
    167167
    168168                        } else {
  • classes/class-bp-activity-template.php

     
    393393        public function user_activities() {
    394394                if ( ( $this->current_activity + 1 ) < $this->activity_count ) {
    395395                        return true;
    396                 } elseif ( ( $this->current_activity + 1 ) == $this->activity_count ) {
     396                } elseif ( ( $this->current_activity + 1 ) === $this->activity_count ) {
    397397
    398398                        /**
    399399                         * Fires right before the rewinding of activity posts.
     
    432432                }
    433433
    434434                // Loop has just started.
    435                 if ( $this->current_activity == 0 ) {
     435                if ( $this->current_activity === 0 ) {
    436436
    437437                        /**
    438438                         * Fires if the current activity item is the first in the activity loop.
  • classes/class-bp-akismet.php

     
    8181                $user_result    = bp_activity_get_meta( $activity['id'], '_bp_akismet_user_result' );
    8282                $desc           = '';
    8383
    84                 if ( !$user_result || $user_result == $akismet_result ) {
     84                if ( !$user_result || $user_result === $akismet_result ) {
    8585                        // 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'] )
    8787                                $desc = __( 'Flagged as spam by Akismet', 'buddypress' );
    8888
    89                         elseif ( 'false' == $akismet_result && !$activity['is_spam'] )
     89                        elseif ( 'false' === $akismet_result && !$activity['is_spam'] )
    9090                                $desc = __( 'Cleared by Akismet', 'buddypress' );
    9191
    9292                } else {
    9393                        $who = bp_activity_get_meta( $activity['id'], '_bp_akismet_user' );
    9494
    95                         if ( 'true' == $user_result ) {
     95                        if ( 'true' === $user_result ) {
    9696                                /* translators: %s: the name of the user */
    9797                                $desc = sprintf( __( 'Flagged as spam by %s', 'buddypress' ), $who );
    9898                        } else {
     
    106106                        $b = array();
    107107                        foreach ( $actions as $k => $item ) {
    108108                                $b[ $k ] = $item;
    109                                 if ( $k == 'edit' )
     109                                if ( $k === 'edit' )
    110110                                        $b['history'] = '<a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history"> '. __( 'History', 'buddypress' ) . '</a>';
    111111                        }
    112112
     
    142142                $value   = '_bp_as_nonce_' . bp_loggedin_user_id();
    143143
    144144                // 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() ) {
    146146                        $form_id .= '_' . bp_get_activity_id();
    147147                        $value   .= '_' . bp_get_activity_id();
    148148                }
     
    172172         */
    173173        public function check_member_activity_update( $content, $user_id, $activity_id ) {
    174174                // 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 ) )
    176176                        return;
    177177
    178178                // 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'] )
    180180                        return;
    181181
    182182                // It was, so delete the member's latest activity update.
     
    325325         */
    326326        public function mark_as_ham( $activity, $source ) {
    327327                // 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' ) )
    329329                        $activity->content = bp_activity_at_name_filter( $activity->content, $activity->id );
    330330
    331331                /**
     
    424424                $this->last_activity->akismet_submission = $activity_data;
    425425
    426426                // Spam.
    427                 if ( 'true' == $activity_data['bp_as_result'] ) {
     427                if ( 'true' === $activity_data['bp_as_result'] ) {
    428428                        /**
    429429                         * Fires after an activity item has been proven to be spam, but before officially being marked as spam.
    430430                         *
     
    571571                $activity_data['blog']         = bp_get_option( 'home' );
    572572                $activity_data['blog_charset'] = bp_get_option( 'blog_charset' );
    573573                $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'] ) : "";
    575575                $activity_data['user_agent']   = bp_core_current_user_ua();
    576576                $activity_data['user_ip']      = bp_core_current_user_ip();
    577577
     
    602602                foreach ( $activity_data as $key => $data )
    603603                        $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
    604604
    605                 if ( 'check' == $check )
     605                if ( 'check' === $check )
    606606                        $path = 'comment-check';
    607                 elseif ( 'submit' == $check )
     607                elseif ( 'submit' === $check )
    608608                        $path = 'submit-' . $spam;
    609609
    610610                // Send to Akismet.
     
    647647         */
    648648        function add_history_metabox( $screen_action ) {
    649649                // Only proceed if we're on the edit screen.
    650                 if ( 'edit' != $screen_action )
     650                if ( 'edit' !== $screen_action )
    651651                        return;
    652652
    653653                // Display meta box with a low priority (low position on screen by default).