Skip to:
Content

BuddyPress.org

Changeset 7350


Ignore:
Timestamp:
08/19/2013 06:26:37 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Fix E_STRICT warnings in group creation code from using functions like array_shift() and array_pop() that expect references rather than results of array_keys(). See #5108.

Location:
trunk/bp-groups
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-actions.php

    r7207 r7350  
    4343
    4444        $reset_steps = true;
    45         bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . array_shift( array_keys( $bp->groups->group_creation_steps ) ) . '/' );
     45        $step        = array_keys( $bp->groups->group_creation_steps );
     46        $redirect_to = bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . $step[0] . '/';
     47        bp_core_redirect( $redirect_to );
    4648    }
    4749
     
    134136        // If we have completed all steps and hit done on the final step we
    135137        // can redirect to the completed group
    136         if ( count( $bp->groups->completed_create_steps ) == count( $bp->groups->group_creation_steps ) && bp_get_groups_current_create_step() == array_pop( array_keys( $bp->groups->group_creation_steps ) ) ) {
     138        $keys = array_keys( $bp->groups->group_creation_steps );
     139        if ( count( $bp->groups->completed_create_steps ) == count( $keys ) && bp_get_groups_current_create_step() == array_pop( $keys ) ) {
    137140            unset( $bp->groups->current_create_step );
    138141            unset( $bp->groups->completed_create_steps );
     
    153156             * we need to loop the step array and fetch the next step that way.
    154157             */
    155             foreach ( (array) $bp->groups->group_creation_steps as $key => $value ) {
     158            foreach ( $keys as $key ) {
    156159                if ( $key == bp_get_groups_current_create_step() ) {
    157160                    $next = 1;
  • trunk/bp-groups/bp-groups-template.php

    r7349 r7350  
    22052205        return false;
    22062206
    2207     if ( !bp_get_groups_current_create_step() )
    2208         $bp->groups->current_create_step = array_shift( array_keys( $bp->groups->group_creation_steps ) );
     2207    if ( !bp_get_groups_current_create_step() ) {
     2208        $keys = array_keys( $bp->groups->group_creation_steps );
     2209        $bp->groups->current_create_step = array_shift( $keys );
     2210    }
    22092211
    22102212    $counter = 1;
     
    22342236        global $bp;
    22352237
    2236         if ( !bp_action_variable( 1 ) )
    2237             $bp->action_variables[1] = array_shift( array_keys( $bp->groups->group_creation_steps ) );
     2238        if ( !bp_action_variable( 1 ) ) {
     2239            $keys = array_keys( $bp->groups->group_creation_steps );
     2240            $bp->action_variables[1] = array_shift( $keys );
     2241        }
    22382242
    22392243        return apply_filters( 'bp_get_group_creation_form_action', trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_action_variable( 1 ) ) );
     
    22482252
    22492253    /* If this the first step, we can just accept and return true */
    2250     if ( !bp_action_variable( 1 ) && array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
     2254    $keys = array_keys( $bp->groups->group_creation_steps );
     2255    if ( !bp_action_variable( 1 ) && array_shift( $keys ) == $step_slug )
    22512256        return true;
    22522257
     
    22902295
    22912296    /* If this is the first group creation step, return true */
    2292     if ( array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
     2297    $keys = array_keys( $bp->groups->group_creation_steps );
     2298    if ( array_shift( $keys ) == $step_slug )
    22932299        return true;
    22942300
     
    24342440    global $bp;
    24352441
    2436     $last_step = array_pop( array_keys( $bp->groups->group_creation_steps ) );
     2442    $keys      = array_keys( $bp->groups->group_creation_steps );
     2443    $last_step = array_pop( $keys );
    24372444
    24382445    if ( $last_step == bp_get_groups_current_create_step() )
     
    24452452    global $bp;
    24462453
    2447     $first_step = array_shift( array_keys( $bp->groups->group_creation_steps ) );
     2454    $keys       = array_keys( $bp->groups->group_creation_steps );
     2455    $first_step = array_shift( $keys );
    24482456
    24492457    if ( $first_step == bp_get_groups_current_create_step() )
Note: See TracChangeset for help on using the changeset viewer.