Forgot to change constructor name
[squirrelmail.git] / class / l10n / gettext.class.php
index bb9c6422bae95ccab07a30cb50f8cafb79f4535e..0692a536c91bb4a1b28abeaa855ecd4fec2e6ff4 100644 (file)
@@ -1,23 +1,27 @@
 <?php
+
 /**
  * Copyright (c) 2003 Danilo Segan <danilo@kvota.net>.
  *
  * This file is part of PHP-gettext.
  *
- *  PHP-gettext is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * PHP-gettext is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
- *  PHP-gettext is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * PHP-gettext is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with PHP-gettext; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * You should have received a copy of the GNU General Public License
+ * along with PHP-gettext; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
+ * @copyright 2004-2021 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
  * @package squirrelmail
  * @subpackage i18n
  */
@@ -64,11 +68,13 @@ 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) {
+    function __construct($Reader) {
         $MAGIC1 = (int) ((222) | (18<<8) | (4<<16) | (149<<24));
         $MAGIC2 = (int) ((149) | (4<<8) | (18<<16) | (222<<24));
 
@@ -102,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
      */
@@ -225,7 +242,7 @@ class gettext_reader {
         else {
             $header = $this->get_translation_number(0);
 
-            if (eregi("plural-forms: (.*)\n",$header,$regs)) {
+            if (preg_match('/plural-forms: (.*)\n/i',$header,$regs)) {
                 $expr = $regs[1];
             } else {
                 $expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
@@ -284,4 +301,3 @@ class gettext_reader {
         }
     }
 }
-?>
\ No newline at end of file