Skip to:
Content

bbPress.org

Changeset 6157


Ignore:
Timestamp:
12/12/2016 01:51:49 PM (7 years ago)
Author:
xknown
Message:

Add PHP 5.x style constructors.

Keep also the PHP 4.x style constructors to avoid breaking code that depends on these methods.

See #3033

Location:
branches/0.9
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9/bb-admin/class-install.php

    r1909 r6157  
    9595     * @return boolean
    9696     **/
    97     function BB_Install($caller)
     97    function __construct($caller)
    9898    {
    9999        $this->caller = $caller;
     
    103103       
    104104        return true;
     105    }
     106
     107    function BB_Install($caller)
     108    {
     109        $this->__construct($caller);
    105110    }
    106111   
  • branches/0.9/bb-includes/cache.php

    r1221 r6157  
    66    var $flush_time = 172800; // 2 days
    77
    8     function BB_Cache() {
     8    function __construct() {
    99        if ( false === bb_get_option( 'use_cache' ) || !is_writable(BB_PATH . 'bb-cache/') )
    1010            $this->use_cache = false;
    1111        else
    1212            $this->flush_old();
     13    }
     14
     15    function BB_Cache() {
     16        $this->__construct();
    1317    }
    1418
  • branches/0.9/bb-includes/class-phpass.php

    r1078 r6157  
    3131    var $random_state;
    3232
    33     function PasswordHash($iteration_count_log2, $portable_hashes)
     33    function __construct($iteration_count_log2, $portable_hashes)
    3434    {
    3535        $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
     
    4242
    4343        $this->random_state = microtime() . getmypid();
     44    }
     45
     46    function PasswordHash($iteration_count_log2, $portable_hashes)
     47    {
     48        $this->__construct($iteration_count_log2, $portable_hashes);
    4449    }
    4550
  • branches/0.9/bb-includes/classes.php

    r1894 r6157  
    1717
    1818    // Can optionally pass unique id string to help out filters
    19     function BB_Query( $type = 'topic', $query = '', $id = '' ) {
     19    function __construct( $type = 'topic', $query = '', $id = '' ) {
    2020        if ( !empty($query) )
    2121            $this->query($type, $query, $id);
     22    }
     23
     24    function BB_Query( $type = 'topic', $query = '', $id = '' ) {
     25        $this->__construct( $type, $query, $id );
    2226    }
    2327
     
    782786
    783787    // Can optionally pass unique id string to help out filters
    784     function BB_Query_Form( $type = 'topic', $defaults = '', $allowed = '', $id = '' ) {
     788    function __construct( $type = 'topic', $defaults = '', $allowed = '', $id = '' ) {
    785789        $this->defaults = wp_parse_args( $defaults );
    786790        $this->allowed  = wp_parse_args( $allowed );
    787791        if ( !empty($defaults) || !empty($allowed) )
    788792            $this->query_from_env($type, $defaults, $allowed, $id);
     793    }
     794
     795    function BB_Query_Form( $type = 'topic', $defaults = '', $allowed = '', $id = '' ) {
     796        $this->__construct( $type, $defaults, $allowed, $id );
    789797    }
    790798
     
    933941    var $_current_file;
    934942
    935     function BB_DIR_MAP( $root, $args = '' ) {
     943    function __construct( $root, $args = '' ) {
    936944        if ( !is_dir( $root ) ) {
    937945            $this->error = new WP_Error( 'bb_dir_map', __('Not a valid directory') );
     
    946954        $this->_current_root = $this->root = rtrim($root, '/\\');
    947955        $this->map();
     956    }
     957
     958    function BB_Dir_Map( $root, $args = '' ) {
     959        $this->__construct( $root, $args );
    948960    }
    949961
     
    11841196    }
    11851197
    1186     function BB_Loop( &$elements ) {
     1198    function __construct( &$elements ) {
    11871199        $this->elements = $elements;
    11881200        if ( !is_array($this->elements) || empty($this->elements) )
    11891201            return $this->elements = false;
     1202    }
     1203
     1204    function BB_Loop( &$elements ) {
     1205        $this->__construct( $elements );
    11901206    }
    11911207
  • branches/0.9/bb-includes/locale.php

    r1386 r6157  
    165165    }
    166166
    167     function BB_Locale() {
     167    function __construct() {
    168168        $this->init();
    169169        $this->register_globals();
     170    }
     171
     172    function BB_Locale() {
     173        $this->__construct();
    170174    }
    171175}
  • branches/0.9/bb-includes/script-loader.php

    r1559 r6157  
    77    var $to_print = array();
    88
     9    function __construct() {
     10        $this->default_scripts();
     11    }
     12
    913    function BB_Scripts() {
    10         $this->default_scripts();
     14        $this->__construct();
    1115    }
    1216
     
    209213    var $l10n = array();
    210214
    211     function _BB_Script() {
     215    function __construct() {
    212216        @list($this->handle, $this->src, $this->deps, $this->ver ) = func_get_args();
    213217        if ( !is_array($this->deps) )
     
    215219        if ( !$this->ver )
    216220            $this->ver = false;
     221    }
     222
     223    function _BB_Script() {
     224        $this->__construct();
    217225    }
    218226
  • branches/0.9/bb-includes/streams.php

    r1363 r6157  
    5656  var $_str;
    5757
    58   function StringReader($str='') {
     58  function __construct($str='') {
    5959    $this->_str = $str;
    6060    $this->_pos = 0;
     61  }
     62
     63  function StringReader($str='') {
     64      $this->__construct($str);
    6165  }
    6266
     
    9397  var $_length;
    9498
    95   function FileReader($filename) {
     99  function __construct($filename) {
    96100    if (file_exists($filename)) {
    97101
     
    107111      return false;
    108112    }
     113  }
     114
     115  function FileReader($filename) {
     116    $this->__construct($filename);
    109117  }
    110118
     
    149157// over it (it assumes knowledge of StringReader internals)
    150158class CachedFileReader extends StringReader {
    151   function CachedFileReader($filename) {
     159  function __construct($filename) {
    152160    if (file_exists($filename)) {
    153161
     
    167175    }
    168176  }
     177
     178  function CachedFileReader($filename) {
     179    $this->__construct($filename);
     180  }
    169181}
    170182
  • branches/0.9/bb-includes/wp-classes.php

    r995 r6157  
    66    var $error_data = array();
    77
    8     function WP_Error($code = '', $message = '', $data = '') {
     8    function __construct($code = '', $message = '', $data = '') {
    99        if ( empty($code) )
    1010            return;
     
    1414        if ( ! empty($data) )
    1515            $this->error_data[$code] = $data;
     16    }
     17
     18    function WP_Error($code = '', $message = '', $data = '') {
     19        $this->__construct($code, $message, $data);
    1620    }
    1721
     
    9397    var $responses = array();
    9498
    95     function WP_Ajax_Response( $args = '' ) {
     99    function __construct( $args = '' ) {
    96100        if ( !empty($args) )
    97101            $this->add($args);
     102    }
     103
     104    function WP_Ajax_Response( $args = '' ) {
     105        $this->__construct( $args );
    98106    }
    99107
  • branches/0.9/bb-plugins/bozo.php

    r1386 r6157  
    278278        var $title = '';
    279279
    280         function BB_Bozo_Users( $page = '' ) { // constructor
     280        function __construct( $page = '' ) { // constructor
    281281            $this->raw_page = ( '' == $page ) ? false : (int) $page;
    282282            $this->page = (int) ( '' == $page ) ? 1 : $page;
     
    286286            $this->query();
    287287            $this->do_paging();
     288        }
     289
     290        function BB_Bozo_Users( $page = '' ) {
     291            $this->__construct( $page );
    288292        }
    289293
Note: See TracChangeset for help on using the changeset viewer.