Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/12/2021 08:43:39 PM (5 years ago)
Author:
espellcaste
Message:

Update all references from wp_parse_args to bp_parse_args.

Also, add WPCS improvements to align bp_parse_args correctly.

Props imath
Fixes #8564

File:
1 edited

Legend:

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

    r12885 r13108  
    5858
    5959        // Parse arguments.
    60         $r = bp_parse_args( $args, array(
    61                 'user_id'                => bp_displayed_user_id(),
    62                 'member_type'            => 'any',
    63                 'profile_group_id'       => false,
    64                 'hide_empty_groups'      => true,
    65                 'hide_empty_fields'      => $hide_empty_fields_default,
    66                 'fetch_fields'           => true,
    67                 'fetch_field_data'       => true,
    68                 'fetch_visibility_level' => $fetch_visibility_level_default,
    69                 'exclude_groups'         => false, // Comma-separated list of profile field group IDs to exclude.
    70                 'exclude_fields'         => false, // Comma-separated list of profile field IDs to exclude.
    71                 'hide_field_types'       => array(), // List of field types to hide from profile fields loop.
    72                 'signup_fields_only'     => false, // Whether to only return signup fields.
    73                 'update_meta_cache'      => true,
    74         ), 'has_profile' );
     60        $r = bp_parse_args(
     61                $args,
     62                array(
     63                        'user_id'                => bp_displayed_user_id(),
     64                        'member_type'            => 'any',
     65                        'profile_group_id'       => false,
     66                        'hide_empty_groups'      => true,
     67                        'hide_empty_fields'      => $hide_empty_fields_default,
     68                        'fetch_fields'           => true,
     69                        'fetch_field_data'       => true,
     70                        'fetch_visibility_level' => $fetch_visibility_level_default,
     71                        'exclude_groups'         => false, // Comma-separated list of profile field group IDs to exclude.
     72                        'exclude_fields'         => false, // Comma-separated list of profile field IDs to exclude.
     73                        'hide_field_types'       => array(), // List of field types to hide from profile fields loop.
     74                        'signup_fields_only'     => false, // Whether to only return signup fields.
     75                        'update_meta_cache'      => true,
     76                ),
     77                'has_profile'
     78        );
    7579
    7680        // Populate the template loop global.
     
    764768                global $field;
    765769
    766                 $args = bp_parse_args( $args, array(
    767                         'type'    => false,
    768                         'user_id' => bp_displayed_user_id(),
    769                 ), 'get_the_profile_field_options' );
     770                $args = bp_parse_args(
     771                        $args,
     772                        array(
     773                                'type'    => false,
     774                                'user_id' => bp_displayed_user_id(),
     775                        ),
     776                        'get_the_profile_field_options'
     777                );
    770778
    771779                /**
     
    955963        function bp_get_profile_field_data( $args = '' ) {
    956964
    957                 $r = wp_parse_args( $args, array(
    958                         'field'   => false, // Field name or ID.
    959                         'user_id' => bp_displayed_user_id()
    960                 ) );
     965                $r = bp_parse_args(
     966                        $args,
     967                        array(
     968                                'field'   => false, // Field name or ID.
     969                                'user_id' => bp_displayed_user_id(),
     970                        )
     971                );
    961972
    962973                /**
     
    12641275
    12651276                // Parse optional arguments.
    1266                 $r = bp_parse_args( $args, array(
    1267                         'field_id'     => bp_get_the_profile_field_id(),
    1268                         'before'       => '<div class="radio">',
    1269                         'after'        => '</div>',
    1270                         'before_radio' => '',
    1271                         'after_radio'  => '',
    1272                         'class'        => 'bp-xprofile-visibility'
    1273                 ), 'xprofile_visibility_radio_buttons' );
     1277                $r = bp_parse_args(
     1278                        $args,
     1279                        array(
     1280                                'field_id'     => bp_get_the_profile_field_id(),
     1281                                'before'       => '<div class="radio">',
     1282                                'after'        => '</div>',
     1283                                'before_radio' => '',
     1284                                'after_radio'  => '',
     1285                                'class'        => 'bp-xprofile-visibility',
     1286                        ),
     1287                        'xprofile_visibility_radio_buttons'
     1288                );
    12741289
    12751290                // Empty return value, filled in below if a valid field ID is found.
     
    13541369
    13551370                // Parse optional arguments.
    1356                 $r = bp_parse_args( $args, array(
    1357                         'field_id'         => bp_get_the_profile_field_id(),
    1358                         'before'           => '',
    1359                         'before_controls'  => '',
    1360                         'after'            => '',
    1361                         'after_controls'   => '',
    1362                         'class'            => 'bp-xprofile-visibility',
    1363                         'label_class'      => 'bp-screen-reader-text',
    1364                         'notoggle_tag'     => 'span',
    1365                         'notoggle_class'   => 'field-visibility-settings-notoggle',
    1366                 ), 'xprofile_settings_visibility_select' );
     1371                $r = bp_parse_args(
     1372                        $args,
     1373                        array(
     1374                                'field_id'        => bp_get_the_profile_field_id(),
     1375                                'before'          => '',
     1376                                'before_controls' => '',
     1377                                'after'           => '',
     1378                                'after_controls'  => '',
     1379                                'class'           => 'bp-xprofile-visibility',
     1380                                'label_class'     => 'bp-screen-reader-text',
     1381                                'notoggle_tag'    => 'span',
     1382                                'notoggle_class'  => 'field-visibility-settings-notoggle',
     1383                        ),
     1384                        'xprofile_settings_visibility_select'
     1385                );
    13671386
    13681387                // Empty return value, filled in below if a valid field ID is found.
Note: See TracChangeset for help on using the changeset viewer.