Skip to:
Content

BuddyPress.org


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

    r13372 r13392  
    107107        $html    = '<option value="">' . /* translators: no option picked in select box */ esc_html__( '----', 'buddypress' ) . '</option>';
    108108
    109         if ( empty( $original_option_values ) && !empty( $_POST['field_' . $this->field_obj->id] ) ) {
    110             $original_option_values = sanitize_text_field(  $_POST['field_' . $this->field_obj->id] );
     109        if ( empty( $original_option_values ) && !empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) {
     110            $original_option_values = sanitize_text_field(  $_POST[ 'field_' . $this->field_obj->id ] );
    111111        }
    112112
     
    118118            // being saved first time.
    119119            foreach( $option_values as $i => $option_value ) {
    120                 if ( isset( $_POST['field_' . $this->field_obj->id] ) && $_POST['field_' . $this->field_obj->id] != $option_value ) {
    121                     if ( ! empty( $_POST['field_' . $this->field_obj->id] ) ) {
    122                         $option_values[$i] = sanitize_text_field( $_POST['field_' . $this->field_obj->id] );
     120                if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $_POST[ 'field_' . $this->field_obj->id ] != $option_value ) {
     121                    if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) {
     122                        $option_values[ $i ] = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ] );
    123123                    }
    124124                }
     
    127127            // Run the allowed option name through the before_save filter, so
    128128            // we'll be sure to get a match.
    129             $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false );
     129            $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k ]->name, false, false );
    130130
    131131            // First, check to see whether the user-entered value matches.
     
    135135
    136136            // Then, if the user has not provided a value, check for defaults.
    137             if ( ! is_array( $original_option_values ) && empty( $option_values ) && $options[$k]->is_default_option ) {
     137            if ( ! is_array( $original_option_values ) && empty( $option_values ) && $options[ $k ]->is_default_option ) {
    138138                $selected = ' selected="selected"';
    139139            }
     
    150150             * @param string $k        Current index in the foreach loop.
    151151             */
    152             $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[$k]->name ) ) . '">' . esc_html( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k], $this->field_obj->id, $selected, $k );
     152            $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[ $k ]->name ) ) . '">' . esc_html( stripslashes( $options[ $k ]->name ) ) . '</option>', $options[ $k ], $this->field_obj->id, $selected, $k );
    153153        }
    154154
Note: See TracChangeset for help on using the changeset viewer.