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-functions.php

    r12932 r13108  
    231231 *           'arg4' => false,
    232232 *       );
    233  *       $r = wp_parse_args( $args, $defaults ); // ...
     233 *       $r = bp_parse_args( $args, $defaults ); // ...
    234234 *
    235235 * The first argument, $old_args_keys, is an array that matches the parameter positions (keys) to
    … …  
    254254        $new_args = array();
    255255
    256         foreach( $old_args_keys as $arg_num => $arg_key ) {
    257                 if ( isset( $func_args[$arg_num] ) ) {
    258                         $new_args[$arg_key] = $func_args[$arg_num];
     256        foreach ( $old_args_keys as $arg_num => $arg_key ) {
     257                if ( isset( $func_args[ $arg_num ] ) ) {
     258                        $new_args[ $arg_key ] = $func_args[ $arg_num ];
    259259                }
    260260        }
    … …  
    291291
    292292        // Passively filter the args before the parse.
    293         if ( !empty( $filter_key ) ) {
     293        if ( ! empty( $filter_key ) ) {
    294294
    295295                /**
    … …  
    306306
    307307        // Parse.
    308         if ( is_array( $defaults ) && !empty( $defaults ) ) {
     308        if ( is_array( $defaults ) && ! empty( $defaults ) ) {
    309309                $r = array_merge( $defaults, $r );
    310310        }
    311311
    312312        // Aggressively filter the args after the parse.
    313         if ( !empty( $filter_key ) ) {
     313        if ( ! empty( $filter_key ) ) {
    314314
    315315                /**
    … …  
    11961196function bp_core_time_diff( $args = array() ) {
    11971197        $retval = null;
    1198         $r      = wp_parse_args(
     1198        $r      = bp_parse_args(
    11991199                $args,
    12001200                array(
    … …  
    28432843 */
    28442844function bp_core_get_suggestions( $args ) {
    2845         $args = bp_parse_args( $args, array(), 'get_suggestions' );
     2845        $args = bp_parse_args(
     2846                $args,
     2847                array(),
     2848                'get_suggestions'
     2849        );
    28462850
    28472851        if ( ! $args['type'] ) {
    … …  
    35323536        }
    35333537
    3534         $args = bp_parse_args( $args, array(
    3535                 'tokens' => array(),
    3536         ), 'send_email' );
    3537 
     3538        $args = bp_parse_args(
     3539                $args,
     3540                array(
     3541                        'tokens' => array(),
     3542                ),
     3543                'send_email'
     3544        );
    35383545
    35393546        /*
    35403547         * Build the email.
    35413548         */
    3542 
    35433549        $email = bp_get_email( $email_type );
    35443550        if ( is_wp_error( $email ) ) {
Note: See TracChangeset for help on using the changeset viewer.