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-core/bp-core-avatars.php

    r12943 r13108  
    232232
    233233        // Set the default variables array and parse it against incoming $args array.
    234         $params = wp_parse_args( $args, array(
    235                 'item_id'       => false,
    236                 'object'        => 'user',
    237                 'type'          => 'thumb',
    238                 'avatar_dir'    => false,
    239                 'width'         => false,
    240                 'height'        => false,
    241                 'class'         => 'avatar',
    242                 'css_id'        => false,
    243                 'alt'           => '',
    244                 'email'         => false,
    245                 'no_grav'       => null,
    246                 'html'          => true,
    247                 'title'         => '',
    248                 'extra_attr'    => '',
    249                 'scheme'        => null,
    250                 'rating'        => get_option( 'avatar_rating' ),
    251                 'force_default' => false,
    252         ) );
     234        $params = bp_parse_args(
     235                $args,
     236                array(
     237                        'item_id'       => false,
     238                        'object'        => 'user',
     239                        'type'          => 'thumb',
     240                        'avatar_dir'    => false,
     241                        'width'         => false,
     242                        'height'        => false,
     243                        'class'         => 'avatar',
     244                        'css_id'        => false,
     245                        'alt'           => '',
     246                        'email'         => false,
     247                        'no_grav'       => null,
     248                        'html'          => true,
     249                        'title'         => '',
     250                        'extra_attr'    => '',
     251                        'scheme'        => null,
     252                        'rating'        => get_option( 'avatar_rating' ),
     253                        'force_default' => false,
     254                )
     255        );
    253256
    254257        /* Set item_id ***********************************************************/
    … …  
    766769        );
    767770
    768         $args = wp_parse_args( $args, $defaults );
     771        $args = bp_parse_args(
     772                $args,
     773                $defaults
     774        );
    769775
    770776        /**
    … …  
    12551261function bp_core_avatar_handle_crop( $args = '' ) {
    12561262
    1257         $r = wp_parse_args( $args, array(
    1258                 'object'        => 'user',
    1259                 'avatar_dir'    => 'avatars',
    1260                 'item_id'       => false,
    1261                 'original_file' => false,
    1262                 'crop_w'        => bp_core_avatar_full_width(),
    1263                 'crop_h'        => bp_core_avatar_full_height(),
    1264                 'crop_x'        => 0,
    1265                 'crop_y'        => 0
    1266         ) );
     1263        $r = bp_parse_args(
     1264                $args,
     1265                array(
     1266                        'object'        => 'user',
     1267                        'avatar_dir'    => 'avatars',
     1268                        'item_id'       => false,
     1269                        'original_file' => false,
     1270                        'crop_w'        => bp_core_avatar_full_width(),
     1271                        'crop_h'        => bp_core_avatar_full_height(),
     1272                        'crop_x'        => 0,
     1273                        'crop_y'        => 0,
     1274                )
     1275        );
    12671276
    12681277        /**
    … …  
    13081317        check_admin_referer( 'bp_avatar_cropstore', 'nonce' );
    13091318
    1310         $avatar_data = wp_parse_args( $_POST, array(
    1311                 'crop_w' => bp_core_avatar_full_width(),
    1312                 'crop_h' => bp_core_avatar_full_height(),
    1313                 'crop_x' => 0,
    1314                 'crop_y' => 0
    1315         ) );
     1319        $avatar_data = bp_parse_args(
     1320                $_POST,
     1321                array(
     1322                        'crop_w' => bp_core_avatar_full_width(),
     1323                        'crop_h' => bp_core_avatar_full_height(),
     1324                        'crop_x' => 0,
     1325                        'crop_y' => 0,
     1326                )
     1327        );
    13161328
    13171329        if ( empty( $avatar_data['object'] ) || empty( $avatar_data['item_id'] ) || empty( $avatar_data['original_file'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.