Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/06/2023 11:35:55 PM (2 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-multiselectbox.php

    r13372 r13392  
    136136        $html    = '';
    137137
    138         if ( empty( $original_option_values ) && ! empty( $_POST['field_' . $this->field_obj->id] ) ) {
    139             $original_option_values = sanitize_text_field( $_POST['field_' . $this->field_obj->id] );
     138        if ( empty( $original_option_values ) && ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) {
     139            $original_option_values = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ] );
    140140        }
    141141
     
    147147            // being saved first time.
    148148            foreach( $option_values as $i => $option_value ) {
    149                 if ( isset( $_POST['field_' . $this->field_obj->id] ) && $_POST['field_' . $this->field_obj->id][$i] != $option_value ) {
    150                     if ( ! empty( $_POST['field_' . $this->field_obj->id][$i] ) ) {
    151                         $option_values[] = sanitize_text_field( $_POST['field_' . $this->field_obj->id][$i] );
     149                if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $_POST[ 'field_' . $this->field_obj->id ][ $i ] != $option_value ) {
     150                    if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ][ $i ] ) ) {
     151                        $option_values[] = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ][ $i ] );
    152152                    }
    153153                }
     
    156156            // Run the allowed option name through the before_save filter, so
    157157            // we'll be sure to get a match.
    158             $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false );
     158            $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k ]->name, false, false );
    159159
    160160            // First, check to see whether the user-entered value matches.
     
    164164
    165165            // Then, if the user has not provided a value, check for defaults.
    166             if ( ! is_array( $original_option_values ) && empty( $option_values ) && ! empty( $options[$k]->is_default_option ) ) {
     166            if ( ! is_array( $original_option_values ) && empty( $option_values ) && ! empty( $options[ $k ]->is_default_option ) ) {
    167167                $selected = ' selected="selected"';
    168168            }
     
    179179             * @param string $k        Current index in the foreach loop.
    180180             */
    181             $html .= apply_filters( 'bp_get_the_profile_field_options_multiselect', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[$k]->name ) ) . '">' . esc_html( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k], $this->field_obj->id, $selected, $k );
     181            $html .= apply_filters( 'bp_get_the_profile_field_options_multiselect', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[ $k ]->name ) ) . '">' . esc_html( stripslashes( $options[ $k ]->name ) ) . '</option>', $options[ $k ], $this->field_obj->id, $selected, $k );
    182182        }
    183183
Note: See TracChangeset for help on using the changeset viewer.