From: pdontthink Date: Thu, 9 Sep 2021 06:25:12 +0000 (+0000) Subject: Class constructor updates that were missed previously X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3741e45c786934b2411434847a2ffc2f1d7b34d5;p=squirrelmail.git Class constructor updates that were missed previously git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@14928 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/class/error.class.php b/class/error.class.php index 74441be3..37250043 100644 --- a/class/error.class.php +++ b/class/error.class.php @@ -34,12 +34,12 @@ if (ini_get('docref_root')=='') ini_set('docref_root','http://www.php.net/'); class ErrorHandler { /** - * Constructor + * Constructor (PHP5 style, required in some future version of PHP) * @param object $oTemplate Template object * @param string $sTemplateFile Template containing the error template * @since 1.5.1 */ - function ErrorHandler(&$oTemplate, $sTemplateFile) { + function __construct(&$oTemplate, $sTemplateFile) { # echo 'init error handler...'; $this->TemplateName = $sTemplateFile; $this->Template =& $oTemplate; @@ -49,6 +49,16 @@ class ErrorHandler { $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 * @since 1.5.1 diff --git a/class/l10n/gettext.class.php b/class/l10n/gettext.class.php index ad60bdc5..961965f3 100644 --- a/class/l10n/gettext.class.php +++ b/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 * @param object $Reader * @return boolean false, if some error with stream +TODO: Constructors should not return anything. */ function gettext_reader($Reader) { $MAGIC1 = (int) ((222) | (18<<8) | (4<<16) | (149<<24)); @@ -106,6 +108,17 @@ class gettext_reader { $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 */ diff --git a/class/l10n/streams.class.php b/class/l10n/streams.class.php index 1c0a131c..757b1e8a 100644 --- a/class/l10n/streams.class.php +++ b/class/l10n/streams.class.php @@ -58,11 +58,13 @@ class FileReader { var $error=0; /** + * Constructor (PHP5 style, required in some future version of PHP) * 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) { + function __construct($filename) { // disable stat warnings for unreadable directories 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 * @param integer $bytes number of bytes to read diff --git a/class/template/PHP_Template.class.php b/class/template/PHP_Template.class.php index d3b57a9f..f318796d 100644 --- a/class/template/PHP_Template.class.php +++ b/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(). * * @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 // from parent's construct_template() method (I doubt it // 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 * diff --git a/class/template/Template.class.php b/class/template/Template.class.php index 785b4aa1..68647922 100644 --- a/class/template/Template.class.php +++ b/class/template/Template.class.php @@ -127,14 +127,14 @@ class Template 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(). * * @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 // from the construct_template() method (I doubt it // 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 *