Skip to:
Content

BuddyPress.org

Changeset 13392


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

PHPCS: adding a little bit of space between brackets.

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

Location:
trunk/src/bp-xprofile
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-admin.php

    r13126 r13392  
    604604            }
    605605
    606             if ( ! empty( $_POST["sort_order_{$field->type}"] ) ) {
    607                 $field->order_by = $_POST["sort_order_{$field->type}"];
     606            if ( ! empty( $_POST[ "sort_order_{$field->type}" ] ) ) {
     607                $field->order_by = $_POST[ "sort_order_{$field->type}" ];
    608608            }
    609609
     
    11901190        }
    11911191
    1192         if ( isset( $categories[$the_category] ) ) {
    1193             $categories[$the_category][] = array( $field_name, $field_type_obj );
     1192        if ( isset( $categories[ $the_category ] ) ) {
     1193            $categories[ $the_category ][] = array( $field_name, $field_type_obj );
    11941194        } else {
    1195             $categories[$the_category] = array( array( $field_name, $field_type_obj ) );
     1195            $categories[ $the_category ] = array( array( $field_name, $field_type_obj ) );
    11961196        }
    11971197    }
  • trunk/src/bp-xprofile/bp-xprofile-cssjs.php

    r12886 r13392  
    7474            if ( isset( $field::$supported_features ) && is_array( $field::$supported_features ) ) {
    7575                foreach ( $field::$supported_features as $feature => $support ) {
    76                     if ( isset( $strings['hide_' . $feature . '_metabox'] ) && ! $support ) {
    77                         $strings['hide_' . $feature . '_metabox'][] = $field_type;
     76                    if ( isset( $strings[ 'hide_' . $feature . '_metabox' ] ) && ! $support ) {
     77                        $strings[ 'hide_' . $feature . '_metabox' ][] = $field_type;
    7878                    }
    7979                }
  • trunk/src/bp-xprofile/bp-xprofile-functions.php

    r13121 r13392  
    193193
    194194    $field = bp_xprofile_get_field_types();
    195     $class = isset( $field[$type] ) ? $field[$type] : '';
     195    $class = isset( $field[ $type ] ) ? $field[ $type ] : '';
    196196
    197197    /**
     
    558558    }
    559559
    560     $current_visibility_levels[$field_id] = $visibility_level;
     560    $current_visibility_levels[ $field_id ] = $visibility_level;
    561561
    562562    return bp_update_user_meta( $user_id, 'bp_xprofile_visibility_levels', $current_visibility_levels );
     
    13611361        // the user-provided setting with the default specified by the admin.
    13621362        if ( isset( $defaults['allow_custom'] ) && isset( $defaults['default'] ) && 'disabled' == $defaults['allow_custom'] ) {
    1363             $user_visibility_levels[$d_field_id] = $defaults['default'];
     1363            $user_visibility_levels[ $d_field_id ] = $defaults['default'];
    13641364        }
    13651365    }
     
    13751375    if ( in_array( 1, $field_ids ) ) {
    13761376        $key = array_search( 1, $field_ids );
    1377         unset( $field_ids[$key] );
     1377        unset( $field_ids[ $key ] );
    13781378    }
    13791379
     
    13911391 */
    13921392function bp_xprofile_maybe_format_datebox_post_data( $field_id ) {
    1393     if ( ! isset( $_POST['field_' . $field_id] ) ) {
    1394         if ( ! empty( $_POST['field_' . $field_id . '_day'] ) && ! empty( $_POST['field_' . $field_id . '_month'] ) && ! empty( $_POST['field_' . $field_id . '_year'] ) ) {
     1393    if ( ! isset( $_POST[ 'field_' . $field_id ] ) ) {
     1394        if ( ! empty( $_POST[ 'field_' . $field_id . '_day' ] ) && ! empty( $_POST[ 'field_' . $field_id . '_month' ] ) && ! empty( $_POST[ 'field_' . $field_id . '_year' ] ) ) {
    13951395            // Concatenate the values.
    1396             $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
     1396            $date_value = $_POST[ 'field_' . $field_id . '_day' ] . ' ' . $_POST[ 'field_' . $field_id . '_month' ] . ' ' . $_POST[ 'field_' . $field_id . '_year' ];
    13971397
    13981398            // Check that the concatenated value can be turned into a timestamp.
    13991399            if ( $timestamp = strtotime( $date_value ) ) {
    14001400                // Add the timestamp to the global $_POST that should contain the datebox data.
    1401                 $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', $timestamp );
     1401                $_POST[ 'field_' . $field_id ] = date( 'Y-m-d H:i:s', $timestamp );
    14021402            }
    14031403        }
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r13358 r13392  
    615615
    616616        // Was a new value posted? If so, use it instead.
    617         if ( isset( $_POST['field_' . $field->id] ) ) {
     617        if ( isset( $_POST[ 'field_' . $field->id ] ) ) {
    618618
    619619            // This is sanitized via the filter below (based on the field type).
    620             $field->data->value = $_POST['field_' . $field->id];
     620            $field->data->value = $_POST[ 'field_' . $field->id ];
    621621        }
    622622
     
    860860        // precedence over default visibility, so that submitted values
    861861        // are not lost on failure.
    862         if ( bp_is_register_page() && ! empty( $_POST['field_' . $field->id . '_visibility'] ) ) {
    863             $retval = esc_attr( $_POST['field_' . $field->id . '_visibility'] );
     862        if ( bp_is_register_page() && ! empty( $_POST[ 'field_' . $field->id . '_visibility' ] ) ) {
     863            $retval = esc_attr( $_POST[ 'field_' . $field->id . '_visibility' ] );
    864864        } else {
    865865            $retval = ! empty( $field->visibility_level ) ? $field->visibility_level : 'public';
     
    898898        // precedence over default visibility, so that submitted values
    899899        // are not lost on failure.
    900         if ( bp_is_register_page() && ! empty( $_POST['field_' . $field->id . '_visibility'] ) ) {
    901             $level = esc_html( $_POST['field_' . $field->id . '_visibility'] );
     900        if ( bp_is_register_page() && ! empty( $_POST[ 'field_' . $field->id . '_visibility' ] ) ) {
     901            $level = esc_html( $_POST[ 'field_' . $field->id . '_visibility' ] );
    902902        } else {
    903903            $level = ! empty( $field->visibility_level ) ? $field->visibility_level : 'public';
  • 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
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php

    r13372 r13392  
    193193        // Check for updated posted values, and errors preventing them from
    194194        // being saved first time.
    195         if ( ! empty( $_POST['field_' . $this->field_obj->id . '_day'] ) ) {
    196             $new_day = (int) $_POST['field_' . $this->field_obj->id . '_day'];
     195        if ( ! empty( $_POST[ 'field_' . $this->field_obj->id . '_day' ] ) ) {
     196            $new_day = (int) $_POST[ 'field_' . $this->field_obj->id . '_day' ];
    197197            $day     = ( $day != $new_day ) ? $new_day : $day;
    198198        }
    199199
    200         if ( ! empty( $_POST['field_' . $this->field_obj->id . '_month'] ) ) {
    201             if ( in_array( $_POST['field_' . $this->field_obj->id . '_month'], $eng_months ) ) {
    202                 $new_month = $_POST['field_' . $this->field_obj->id . '_month'];
     200        if ( ! empty( $_POST[ 'field_' . $this->field_obj->id . '_month' ] ) ) {
     201            if ( in_array( $_POST[ 'field_' . $this->field_obj->id . '_month' ], $eng_months ) ) {
     202                $new_month = $_POST[ 'field_' . $this->field_obj->id . '_month' ];
    203203            } else {
    204204                $new_month = $month;
     
    208208        }
    209209
    210         if ( ! empty( $_POST['field_' . $this->field_obj->id . '_year'] ) ) {
    211             $new_year = (int) $_POST['field_' . $this->field_obj->id . '_year'];
     210        if ( ! empty( $_POST[ 'field_' . $this->field_obj->id . '_year' ] ) ) {
     211            $new_year = (int) $_POST[ 'field_' . $this->field_obj->id . '_year' ];
    212212            $year     = ( $year != $new_year ) ? $new_year : $year;
    213213        }
     
    242242
    243243                for ( $i = 0; $i < 12; ++$i ) {
    244                     $html .= sprintf( '<option value="%1$s" %2$s>%3$s</option>', esc_attr( $eng_months[$i] ), selected( $month, $eng_months[$i], false ), $months[$i] );
     244                    $html .= sprintf( '<option value="%1$s" %2$s>%3$s</option>', esc_attr( $eng_months[ $i ] ), selected( $month, $eng_months[ $i ], false ), $months[ $i ] );
    245245                }
    246246            break;
  • 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
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php

    r13372 r13392  
    125125            // Check for updated posted values, but errors preventing them from
    126126            // being saved first time.
    127             if ( isset( $_POST['field_' . $this->field_obj->id] ) && $option_value != $_POST['field_' . $this->field_obj->id] ) {
    128                 if ( ! empty( $_POST['field_' . $this->field_obj->id] ) ) {
    129                     $option_value = sanitize_text_field( $_POST['field_' . $this->field_obj->id] );
     127            if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $option_value != $_POST[ 'field_' . $this->field_obj->id ] ) {
     128                if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) {
     129                    $option_value = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ] );
    130130                }
    131131            }
     
    133133            // Run the allowed option name through the before_save filter, so
    134134            // we'll be sure to get a match.
    135             $allowed_options = xprofile_sanitize_data_value_before_save( $options[$k]->name, false, false );
     135            $allowed_options = xprofile_sanitize_data_value_before_save( $options[ $k ]->name, false, false );
    136136            $selected        = '';
    137137
    138             if ( $option_value === $allowed_options || ( empty( $option_value ) && ! empty( $options[$k]->is_default_option ) ) ) {
     138            if ( $option_value === $allowed_options || ( empty( $option_value ) && ! empty( $options[ $k ]->is_default_option ) ) ) {
    139139                $selected = ' checked="checked"';
    140140            }
     
    144144                esc_attr( bp_get_the_profile_field_input_name() ),
    145145                esc_attr( "option_{$options[$k]->id}" ),
    146                 esc_attr( stripslashes( $options[$k]->name ) ),
    147                 esc_html( stripslashes( $options[$k]->name ) )
     146                esc_attr( stripslashes( $options[ $k ]->name ) ),
     147                esc_html( stripslashes( $options[ $k ]->name ) )
    148148            );
    149149
     
    159159             * @param string $k        Current index in the foreach loop.
    160160             */
    161             $html .= apply_filters( 'bp_get_the_profile_field_options_radio', $new_html, $options[$k], $this->field_obj->id, $selected, $k );
     161            $html .= apply_filters( 'bp_get_the_profile_field_options_radio', $new_html, $options[ $k ], $this->field_obj->id, $selected, $k );
    162162        }
    163163
  • 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
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type.php

    r13372 r13392  
    370370                    $i       = 1;
    371371
    372                     while ( isset( $_POST[$type . '_option'][$i] ) ) {
     372                    while ( isset( $_POST[ $type . '_option' ][ $i ] ) ) {
    373373
    374374                        // Multiselectbox and checkboxes support MULTIPLE default options; all other core types support only ONE.
    375                         if ( $current_type_obj->supports_options && ! $current_type_obj->supports_multiple_defaults && isset( $_POST["isDefault_{$type}_option"][$i] ) && (int) $_POST["isDefault_{$type}_option"] === $i ) {
     375                        if ( $current_type_obj->supports_options && ! $current_type_obj->supports_multiple_defaults && isset( $_POST[ "isDefault_{$type}_option" ][ $i ] ) && (int) $_POST[ "isDefault_{$type}_option" ] === $i ) {
    376376                            $is_default_option = true;
    377                         } elseif ( isset( $_POST["isDefault_{$type}_option"][$i] ) ) {
    378                             $is_default_option = (bool) $_POST["isDefault_{$type}_option"][$i];
     377                        } elseif ( isset( $_POST[ "isDefault_{$type}_option" ][ $i ] ) ) {
     378                            $is_default_option = (bool) $_POST[ "isDefault_{$type}_option" ][ $i ];
    379379                        } else {
    380380                            $is_default_option = false;
     
    385385                            'id'                => -1,
    386386                            'is_default_option' => $is_default_option,
    387                             'name'              => sanitize_text_field( stripslashes( $_POST[$type . '_option'][$i] ) ),
     387                            'name'              => sanitize_text_field( stripslashes( $_POST[ $type . '_option' ][ $i ] ) ),
    388388                        );
    389389
     
    420420                                esc_html_e( 'Add an option', 'buddypress' );
    421421                            ?></label>
    422                             <input type="text" name="<?php echo esc_attr( "{$type}_option[{$j}]" ); ?>" id="<?php echo esc_attr( "{$type}_option{$j}" ); ?>" value="<?php echo esc_attr( stripslashes( $options[$i]->name ) ); ?>" />
     422                            <input type="text" name="<?php echo esc_attr( "{$type}_option[{$j}]" ); ?>" id="<?php echo esc_attr( "{$type}_option{$j}" ); ?>" value="<?php echo esc_attr( stripslashes( $options[ $i ]->name ) ); ?>" />
    423423                            <label for="<?php echo esc_attr( "{$type}_option{$default_name}" ); ?>">
    424                                 <input type="<?php echo esc_attr( $control_type ); ?>" id="<?php echo esc_attr( "{$type}_option{$default_name}" ); ?>" name="<?php echo esc_attr( "isDefault_{$type}_option{$default_name}" ); ?>" <?php checked( $options[$i]->is_default_option, true ); ?> value="<?php echo esc_attr( $j ); ?>" />
     424                                <input type="<?php echo esc_attr( $control_type ); ?>" id="<?php echo esc_attr( "{$type}_option{$default_name}" ); ?>" name="<?php echo esc_attr( "isDefault_{$type}_option{$default_name}" ); ?>" <?php checked( $options[ $i ]->is_default_option, true ); ?> value="<?php echo esc_attr( $j ); ?>" />
    425425                                <?php _e( 'Default Value', 'buddypress' ); ?>
    426426                            </label>
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php

    r13372 r13392  
    476476
    477477                // Allow plugins to filter the field's child options (i.e. the items in a selectbox).
    478                 $post_option  = ! empty( $_POST["{$this->type}_option"]           ) ? $_POST["{$this->type}_option"]           : '';
    479                 $post_default = ! empty( $_POST["isDefault_{$this->type}_option"] ) ? $_POST["isDefault_{$this->type}_option"] : '';
     478                $post_option  = ! empty( $_POST[ "{$this->type}_option" ]           ) ? $_POST[ "{$this->type}_option" ]           : '';
     479                $post_default = ! empty( $_POST[ "isDefault_{$this->type}_option" ] ) ? $_POST[ "isDefault_{$this->type}_option" ] : '';
    480480
    481481                /**
     
    12481248                $this->field_order = $_POST['field_order'];
    12491249
    1250                 if ( ! empty( $_POST["sort_order_{$this->type}"] ) ) {
    1251                     $this->order_by = $_POST["sort_order_{$this->type}"];
     1250                if ( ! empty( $_POST[ "sort_order_{$this->type}" ] ) ) {
     1251                    $this->order_by = $_POST[ "sort_order_{$this->type}" ];
    12521252                }
    12531253            }
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php

    r13372 r13392  
    214214            if ( ! empty( $this->fields ) ) {
    215215                for ( $i = 0, $count = count( $this->fields ); $i < $count; ++$i ) {
    216                     BP_XProfile_ProfileData::delete_for_field( $this->fields[$i]->id );
     216                    BP_XProfile_ProfileData::delete_for_field( $this->fields[ $i ]->id );
    217217                }
    218218            }
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-meta-query.php

    r10740 r13392  
    6868
    6969        // BP_XProfile_Query sets 'object_type' = '' by default.
    70         if ( isset( $qv[ 'object_type' ] ) && ( '' !== $qv[ 'object_type' ] ) && ( ! is_array( $qv[ 'object_type' ] ) || $qv[ 'object_type' ] ) ) {
    71             $meta_query[0]['object'] = $qv[ 'object_type' ];
     70        if ( isset( $qv['object_type'] ) && ( '' !== $qv['object_type'] ) && ( ! is_array( $qv['object_type'] ) || $qv['object_type'] ) ) {
     71            $meta_query[0]['object'] = $qv['object_type'];
    7272        }
    7373
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php

    r13372 r13392  
    641641            for ( $i = 0, $count = count( $fields ); $i < $count; ++$i ) {
    642642                if ( $i == 0 ) {
    643                     $field_sql .= $wpdb->prepare( "AND ( f.name = %s ", $fields[$i] );
     643                    $field_sql .= $wpdb->prepare( "AND ( f.name = %s ", $fields[ $i ] );
    644644                } else {
    645                     $field_sql .= $wpdb->prepare( "OR f.name = %s ", $fields[$i] );
     645                    $field_sql .= $wpdb->prepare( "OR f.name = %s ", $fields[ $i ] );
    646646                }
    647647            }
     
    664664            for ( $i = 0, $count = count( $values ); $i < $count; ++$i ) {
    665665                for ( $j = 0; $j < count( $fields ); $j++ ) {
    666                     if ( $values[$i]->name == $fields[$j] ) {
    667                         $new_values[$fields[$j]] = $values[$i]->value;
    668                     } elseif ( !array_key_exists( $fields[$j], $new_values ) ) {
    669                         $new_values[$fields[$j]] = NULL;
     666                    if ( $values[ $i ]->name == $fields[ $j ] ) {
     667                        $new_values[ $fields[ $j ] ] = $values[ $i ]->value;
     668                    } elseif ( !array_key_exists( $fields[ $j ], $new_values ) ) {
     669                        $new_values[ $fields[ $j ] ] = NULL;
    670670                    }
    671671                }
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-user-admin.php

    r13108 r13392  
    174174
    175175                $is_required[ $field_id ] = xprofile_check_is_required_field( $field_id ) && ! bp_current_user_can( 'bp_moderate' );
    176                 if ( $is_required[ $field_id ] && empty( $_POST['field_' . $field_id ] ) ) {
     176                if ( $is_required[ $field_id ] && empty( $_POST[ 'field_' . $field_id ] ) ) {
    177177                    $redirect_to = add_query_arg( 'error', '2', $redirect_to );
    178178                    bp_core_redirect( $redirect_to );
     
    192192                 * get overwritten by the default on the next edit.
    193193                 */
    194                 $value = isset( $_POST['field_' . $field_id] ) ? $_POST['field_' . $field_id] : '';
    195 
    196                 $visibility_level = ! empty( $_POST['field_' . $field_id . '_visibility'] ) ? $_POST['field_' . $field_id . '_visibility'] : 'public';
     194                $value = isset( $_POST[ 'field_' . $field_id ] ) ? $_POST[ 'field_' . $field_id ] : '';
     195
     196                $visibility_level = ! empty( $_POST[ 'field_' . $field_id . '_visibility' ] ) ? $_POST[ 'field_' . $field_id . '_visibility' ] : 'public';
    197197                /*
    198198                 * Save the old and new values. They will be
  • trunk/src/bp-xprofile/screens/edit.php

    r12869 r13392  
    5959
    6060            $is_required[ $field_id ] = xprofile_check_is_required_field( $field_id ) && ! bp_current_user_can( 'bp_moderate' );
    61             if ( $is_required[$field_id] && empty( $_POST['field_' . $field_id] ) ) {
     61            if ( $is_required[ $field_id ] && empty( $_POST[ 'field_' . $field_id ] ) ) {
    6262                $errors = true;
    6363            }
     
    7979
    8080                // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
    81                 $value = isset( $_POST['field_' . $field_id] ) ? $_POST['field_' . $field_id] : '';
     81                $value = isset( $_POST[ 'field_' . $field_id ] ) ? $_POST[ 'field_' . $field_id ] : '';
    8282
    83                 $visibility_level = !empty( $_POST['field_' . $field_id . '_visibility'] ) ? $_POST['field_' . $field_id . '_visibility'] : 'public';
     83                $visibility_level = !empty( $_POST[ 'field_' . $field_id . '_visibility' ] ) ? $_POST[ 'field_' . $field_id . '_visibility' ] : 'public';
    8484
    8585                // Save the old and new values. They will be
  • trunk/src/bp-xprofile/screens/settings-profile.php

    r12534 r13392  
    9393            $visibility_level = 'public';
    9494
    95             if ( !empty( $_POST['field_' . $field_id . '_visibility'] ) ) {
    96                 $visibility_level = $_POST['field_' . $field_id . '_visibility'];
     95            if ( !empty( $_POST[ 'field_' . $field_id . '_visibility' ] ) ) {
     96                $visibility_level = $_POST[ 'field_' . $field_id . '_visibility' ];
    9797            }
    9898
Note: See TracChangeset for help on using the changeset viewer.