Browse Source

Class constructor updates that were missed previously

pdontthink 3 years ago
parent
commit
ac0c27aef6

+ 12 - 2
class/error.class.php

@@ -34,12 +34,12 @@ if (ini_get('docref_root')=='') ini_set('docref_root','http://www.php.net/');
 class ErrorHandler {
 class ErrorHandler {
 
 
     /**
     /**
-     * Constructor
+     * Constructor (PHP5 style, required in some future version of PHP)
      * @param  object $oTemplate Template object
      * @param  object $oTemplate Template object
      * @param  string $sTemplateFile Template containing the error template
      * @param  string $sTemplateFile Template containing the error template
      * @since 1.5.1
      * @since 1.5.1
      */
      */
-    function ErrorHandler(&$oTemplate, $sTemplateFile) {
+    function __construct(&$oTemplate, $sTemplateFile) {
 #        echo 'init error handler...';
 #        echo 'init error handler...';
         $this->TemplateName = $sTemplateFile;
         $this->TemplateName = $sTemplateFile;
         $this->Template =& $oTemplate;
         $this->Template =& $oTemplate;
@@ -49,6 +49,16 @@ class ErrorHandler {
         $this->Template->assign('delayed_errors', $this->delayed_errors);
         $this->Template->assign('delayed_errors', $this->delayed_errors);
     }
     }
 
 
+    /**
+     * Constructor (PHP4 style, kept for compatibility reasons)
+     * @param  object $oTemplate Template object
+     * @param  string $sTemplateFile Template containing the error template
+     * @since 1.5.1
+     */
+    function ErrorHandler(&$oTemplate, $sTemplateFile) {
+        self::__construct($oTemplate, $sTemplateFile);
+    }
+
     /**
     /**
      * Sets the error template
      * Sets the error template
      * @since 1.5.1
      * @since 1.5.1

+ 13 - 0
class/l10n/gettext.class.php

@@ -68,9 +68,11 @@ class gettext_reader {
     }
     }
 
 
     /**
     /**
+     * Constructor (PHP5 style, required in some future version of PHP)
      * constructor that requires StreamReader object
      * constructor that requires StreamReader object
      * @param object $Reader
      * @param object $Reader
      * @return boolean false, if some error with stream
      * @return boolean false, if some error with stream
+TODO: Constructors should not return anything.
      */
      */
     function gettext_reader($Reader) {
     function gettext_reader($Reader) {
         $MAGIC1 = (int) ((222) | (18<<8) | (4<<16) | (149<<24));
         $MAGIC1 = (int) ((222) | (18<<8) | (4<<16) | (149<<24));
@@ -106,6 +108,17 @@ class gettext_reader {
         $this->_HASHED = array();
         $this->_HASHED = array();
     }
     }
 
 
+    /**
+     * Constructor (PHP4 style, kept for compatibility reasons)
+     * constructor that requires StreamReader object
+     * @param object $Reader
+     * @return boolean false, if some error with stream
+TODO: Constructors should not return anything.
+     */
+    function gettext_reader($Reader) {
+        return self::__construct($Reader);
+    }
+
     /**
     /**
      * @param boolean $translations do translation have to be loaded
      * @param boolean $translations do translation have to be loaded
      */
      */

+ 14 - 1
class/l10n/streams.class.php

@@ -58,11 +58,13 @@ class FileReader {
     var $error=0;
     var $error=0;
 
 
     /**
     /**
+     * Constructor (PHP5 style, required in some future version of PHP)
      * reads translation file and fills translation input object properties
      * reads translation file and fills translation input object properties
      * @param string $filename path to file
      * @param string $filename path to file
      * @return boolean false there is a problem with $filename
      * @return boolean false there is a problem with $filename
+TODO: Constructors should not return anything.
      */
      */
-    function FileReader($filename) {
+    function __construct($filename) {
         // disable stat warnings for unreadable directories
         // disable stat warnings for unreadable directories
         if (@file_exists($filename)) {
         if (@file_exists($filename)) {
 
 
@@ -79,6 +81,17 @@ class FileReader {
         }
         }
     }
     }
 
 
+    /**
+     * Constructor (PHP4 style, kept for compatibility reasons)
+     * reads translation file and fills translation input object properties
+     * @param string $filename path to file
+     * @return boolean false there is a problem with $filename
+TODO: Constructors should not return anything.
+     */
+    function FileReader($filename) {
+        return self::__construct($filename);
+     }
+
     /**
     /**
      * reads data from current position
      * reads data from current position
      * @param integer $bytes number of bytes to read
      * @param integer $bytes number of bytes to read

+ 14 - 2
class/template/PHP_Template.class.php

@@ -40,14 +40,14 @@ class PHP_Template extends Template
 
 
 
 
     /**
     /**
-      * Constructor
+      * Constructor (PHP5 style, required in some future version of PHP)
       *
       *
       * Please do not call directly.  Use Template::construct_template().
       * Please do not call directly.  Use Template::construct_template().
       *
       *
       * @param string $template_id the template ID
       * @param string $template_id the template ID
       *
       *
       */
       */
-    function PHP_Template($template_id) {
+    function __construct($template_id) {
 //FIXME: find a way to test that this is ONLY ever called 
 //FIXME: find a way to test that this is ONLY ever called 
 //       from parent's construct_template() method (I doubt it
 //       from parent's construct_template() method (I doubt it
 //       is worth the trouble to parse the current stack trace)
 //       is worth the trouble to parse the current stack trace)
@@ -58,6 +58,18 @@ class PHP_Template extends Template
 
 
     }
     }
 
 
+    /**
+      * Constructor (PHP4 style, kept for compatibility reasons)
+      *
+      * Please do not call directly.  Use Template::construct_template().
+      *
+      * @param string $template_id the template ID
+      *
+      */
+    function PHP_Template($template_id) {
+        self::__construct($template_id);
+    }
+
     /**
     /**
       * Assigns values to template variables
       * Assigns values to template variables
       *
       *

+ 14 - 2
class/template/Template.class.php

@@ -127,14 +127,14 @@ class Template
     var $other_template_engine_objects = array();
     var $other_template_engine_objects = array();
 
 
     /**
     /**
-      * Constructor
+      * Constructor (PHP5 style, required in some future version of PHP)
       *
       *
       * Please do not call directly.  Use Template::construct_template().
       * Please do not call directly.  Use Template::construct_template().
       *
       *
       * @param string $template_set_id the template ID
       * @param string $template_set_id the template ID
       *
       *
       */
       */
-    function Template($template_set_id) {
+    function __construct($template_set_id) {
 //FIXME: find a way to test that this is ONLY ever called
 //FIXME: find a way to test that this is ONLY ever called
 //       from the construct_template() method (I doubt it
 //       from the construct_template() method (I doubt it
 //       is worth the trouble to parse the current stack trace)
 //       is worth the trouble to parse the current stack trace)
@@ -145,6 +145,18 @@ class Template
 
 
     }
     }
 
 
+    /**
+      * Constructor (PHP4 style, kept for compatibility reasons)
+      *
+      * Please do not call directly.  Use Template::construct_template().
+      *
+      * @param string $template_set_id the template ID
+      *
+      */
+    function Template($template_set_id) {
+        self::__construct($template_set_id);
+    }
+
     /**
     /**
       * Construct Template
       * Construct Template
       *
       *