Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/06/2023 11:35:55 PM (4 years ago)
Author:
espellcaste
Message:

PHPCS: adding a little bit of space between brackets.

Closes https://github.com/buddypress/buddypress/pull/44
See #7228

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php

    r13372 r13392  
    127127                // Check for updated posted values, but errors preventing them from
    128128                // being saved first time.
    129                 if ( isset( $_POST['field_' . $this->field_obj->id] ) && $option_values != maybe_serialize( $_POST['field_' . $this->field_obj->id] ) ) {
    130                         if ( ! empty( $_POST['field_' . $this->field_obj->id] ) ) {
    131                                 $option_values = array_map( 'sanitize_text_field', $_POST['field_' . $this->field_obj->id] );
     129                if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $option_values != maybe_serialize( $_POST[ 'field_' . $this->field_obj->id ] ) ) {
     130                        if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) {
     131                                $option_values = array_map( 'sanitize_text_field', $_POST[ 'field_' . $this->field_obj->id ] );
    132132                        }
    133133                }
     
    141141                                // Run the allowed option name through the before_save filter,
    142142                                // so we'll be sure to get a match.
    143                                 $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false );
    144 
    145                                 if ( $option_values[$j] === $allowed_options || in_array( $allowed_options, $option_values ) ) {
     143                                $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k ]->name, false, false );
     144
     145                                if ( $option_values[ $j ] === $allowed_options || in_array( $allowed_options, $option_values ) ) {
    146146                                        $selected = ' checked="checked"';
    147147                                        break;
     
    151151                        // If the user has not yet supplied a value for this field, check to
    152152                        // see whether there is a default value available.
    153                         if ( empty( $selected ) && $select_default_option && ! empty( $options[$k]->is_default_option ) ) {
     153                        if ( empty( $selected ) && $select_default_option && ! empty( $options[ $k ]->is_default_option ) ) {
    154154                                $selected = ' checked="checked"';
    155155                        }
     
    159159                                esc_attr( bp_get_the_profile_field_input_name() . '[]' ),
    160160                                esc_attr( "field_{$options[$k]->id}_{$k}" ),
    161                                 esc_attr( stripslashes( $options[$k]->name ) ),
    162                                 esc_html( stripslashes( $options[$k]->name ) )
     161                                esc_attr( stripslashes( $options[ $k ]->name ) ),
     162                                esc_html( stripslashes( $options[ $k ]->name ) )
    163163                        );
    164164
     
    174174                         * @param string $k        Current index in the foreach loop.
    175175                         */
    176                         $html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', $new_html, $options[$k], $this->field_obj->id, $selected, $k );
     176                        $html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', $new_html, $options[ $k ], $this->field_obj->id, $selected, $k );
    177177                }
    178178
Note: See TracChangeset for help on using the changeset viewer.