Skip to:
Content

bbPress.org

Changeset 6165


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

Branch 1.2: Fix PHP 7 compat issue.

  • func_get_arg() returns the current (modified) value of the given argument.
  • Add also PHP 5.x style constructors.

See #3033

File:
1 edited

Legend:

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

    r2801 r6165  
    739739    var $paging_text_bottom;
    740740
    741     function BB_User_Search ($search_term = false, $page = 1, $roles = false ) { // constructor
     741    function __construct($search_term = false, $page = 1, $roles = false ) { // constructor
    742742        $this->search_term = $search_term ? stripslashes($search_term) : false;
    743743        $this->raw_page = ( '' == $page ) ? false : (int) $page;
     
    757757        $this->prepare_vars_for_template_usage();
    758758        $this->do_paging();
     759    }
     760
     761    function BB_User_Search( $search_term = false, $page = 1, $roles = false ) {
     762        $this->__construct( $search_term, $page, $roles );
    759763    }
    760764
     
    949953    var $title = '';
    950954
    951     function BB_Users_By_Role($role = '', $page = '') { // constructor
     955    function __construct($role = '', $page = '') { // constructor
    952956        $this->role = $role ? $role : 'member';
    953957        $this->raw_page = ( '' == $page ) ? false : (int) $page;
     
    957961        $this->query();
    958962        $this->do_paging();
     963    }
     964
     965    function BB_Users_By_Role($role = '', $page = '') {
     966        $this->__construct($role, $page);
    959967    }
    960968
     
    979987        return false;
    980988
     989    $func_args = func_get_args();
    981990    $defaults = array( 'forum_name' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => false, 'forum_is_category' => 0 );
    982991    $args = wp_parse_args( $args, $defaults );
    983992    if ( 1 < func_num_args() ) : // For back compat
    984         $args['forum_name']  = func_get_arg(0);
    985         $args['forum_desc']  = func_get_arg(1);
    986         $args['forum_order'] = 2 < func_num_args() ? func_get_arg(2) : 0;
     993        $args['forum_name']  = $func_args[0];
     994        $args['forum_desc']  = $func_args[1];
     995        $args['forum_order'] = 2 < func_num_args() ? $func_args[2] : 0;
    987996    endif;
    988997
     
    10261035        return false;
    10271036
     1037    $func_args = func_get_args();
    10281038    $defaults = array( 'forum_id' => 0, 'forum_name' => '', 'forum_slug' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => 0, 'forum_is_category' => 0 );
    10291039    $fields = array( 'forum_name', 'forum_desc', 'forum_parent', 'forum_order' );
    10301040    $args = wp_parse_args( $args, $defaults );
    10311041    if ( 1 < func_num_args() ) : // For back compat
    1032         $args['forum_id']    = func_get_arg(0);
    1033         $args['forum_name']  = func_get_arg(1);
    1034         $args['forum_desc']  = 2 < func_num_args() ? func_get_arg(2) : '';
    1035         $args['forum_order'] = 3 < func_num_args() && is_numeric(func_get_arg(3)) ? func_get_arg(3) : 0;
     1042        $args['forum_id']    = $func_args[0];
     1043        $args['forum_name']  = $func_args[1];
     1044        $args['forum_desc']  = 2 < func_num_args() ? $func_args[2] : '';
     1045        $args['forum_order'] = 3 < func_num_args() && is_numeric($func_args[3]) ? $func_args[3] : 0;
    10361046    endif;
    10371047
Note: See TracChangeset for help on using the changeset viewer.