Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/13/2016 09:16:20 AM (8 years ago)
Author:
xknown
Message:

Branch 1.2: Fix PHP 7 compat issues w.r.t. the use of func_get_arg().

func_get_arg() returns the current (modified) value of the given argument. Let's make sure the code behaves the same.

See #3033

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bb-includes/functions.bb-template.php

    r3847 r6167  
    916916    global $bb_forums_loop;
    917917
     918    $_args = func_get_args();
    918919    $default_type = 'flat';
    919920
     
    922923    } elseif ( func_num_args() > 1 ) { // bb_forums( 'ul', $args ); Deprecated
    923924        $default_type = $args;
    924         $args = func_get_arg(1);
     925        $args = $_args[1];
    925926    } elseif ( $args && is_string($args) && false === strpos($args, '=') ) {
    926927        $args = array( 'type' => $args );
     
    32253226
    32263227function bb_tag_heat_map( $args = '' ) {
     3228    $_args = func_get_args();
    32273229    $defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'limit' => 40, 'format' => 'flat' );
    32283230    $args = wp_parse_args( $args, $defaults );
    32293231
    32303232    if ( 1 < $fn = func_num_args() ) : // For back compat
    3231         $args['smallest'] = func_get_arg(0);
    3232         $args['largest']  = func_get_arg(1);
    3233         $args['unit']     = 2 < $fn ? func_get_arg(2) : $unit;
    3234         $args['limit']    = 3 < $fn ? func_get_arg(3) : $limit;
     3233        $args['smallest'] = $_args[0];
     3234        $args['largest']  = $_args[1];
     3235        $args['unit']     = 2 < $fn ? $_args[2] : $unit;
     3236        $args['limit']    = 3 < $fn ? $_args[3] : $limit;
    32353237    endif;
    32363238
     
    33123314
    33133315function bb_forum_dropdown( $args = '' ) {
     3316    $_args = func_get_args();
    33143317    if ( $args && is_string($args) && false === strpos($args, '=') )
    33153318        $args = array( 'callback' => $args );
    33163319    if ( 1 < func_num_args() )
    3317         $args['callback_args'] = func_get_arg(1);
     3320        $args['callback_args'] = $_args[1];
    33183321    echo bb_get_forum_dropdown( $args );
    33193322}
    33203323
    33213324function bb_get_forum_dropdown( $args = '' ) {
     3325    $_args = func_get_args();
    33223326    $defaults = array( 'callback' => false, 'callback_args' => false, 'id' => 'forum_id', 'none' => false, 'selected' => false, 'tab' => false, 'hierarchical' => 1, 'depth' => 0, 'child_of' => 0, 'disable_categories' => 1, 'options_only' => false );
    33233327    if ( $args && is_string($args) && false === strpos($args, '=') )
    33243328        $args = array( 'callback' => $args );
    33253329    if ( 1 < func_num_args() )
    3326         $args['callback_args'] = func_get_arg(1);
     3330        $args['callback_args'] = $_args[1];
    33273331
    33283332    $args = wp_parse_args( $args, $defaults );
Note: See TracChangeset for help on using the changeset viewer.