From 7c3aec7ca2c88cec72cae7b8758ddefd2b34f6dd Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 14 Apr 2014 08:45:55 +0200 Subject: Added missing "static" keywords in TGettext; fix #518 (cherry picked from commit f550fd22072fb189762d45d8e9f077423c439c6b) --- framework/I18N/core/Gettext/TGettext.php | 66 ++++++++++++++++---------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'framework/I18N') diff --git a/framework/I18N/core/Gettext/TGettext.php b/framework/I18N/core/Gettext/TGettext.php index abf32392..2c5f91c7 100644 --- a/framework/I18N/core/Gettext/TGettext.php +++ b/framework/I18N/core/Gettext/TGettext.php @@ -32,7 +32,7 @@ /** * File::Gettext - * + * * @author Michael Wallner * @license PHP License */ @@ -42,11 +42,11 @@ */ //ini_set('track_errors', true); -/** +/** * File_Gettext - * + * * GNU gettext file reader and writer. - * + * * ################################################################# * # All protected members of this class are public in its childs. # * ################################################################# @@ -54,15 +54,15 @@ * @author Michael Wallner * @version $Revision: 1.4 $ * @access public - * @package System.I18N.core + * @package System.I18N.core */ class TGettext { /** * strings - * + * * associative array with all [msgid => msgstr] entries - * + * * @access protected * @var array */ @@ -70,40 +70,40 @@ class TGettext /** * meta - * - * associative array containing meta + * + * associative array containing meta * information like project name or content type - * + * * @access protected * @var array */ protected $meta = array(); - + /** * file path - * + * * @access protected * @var string */ protected $file = ''; - + /** * Factory * * @static * @access public - * @return object Returns File_Gettext_PO or File_Gettext_MO on success + * @return object Returns File_Gettext_PO or File_Gettext_MO on success * or PEAR_Error on failure. * @param string $format MO or PO * @param string $file path to GNU gettext file */ - function factory($format, $file = '') + static function factory($format, $file = '') { $format = strToUpper($format); $filename = dirname(__FILE__).'/'.$format.'.php'; if(is_file($filename) == false) throw new Exception ("Class file $file not found"); - + include_once $filename; $class = 'TGettext_' . $format; @@ -115,35 +115,35 @@ class TGettext * * That's a simple fake of the 'msgfmt' console command. It reads the * contents of a GNU PO file and saves them to a GNU MO file. - * + * * @static * @access public * @return mixed Returns true on success or PEAR_Error on failure. * @param string $pofile path to GNU PO file * @param string $mofile path to GNU MO file */ - function poFile2moFile($pofile, $mofile) + static function poFile2moFile($pofile, $mofile) { if (!is_file($pofile)) { throw new Exception("File $pofile doesn't exist."); } - + include_once dirname(__FILE__).'/PO.php'; - + $PO = new TGettext_PO($pofile); if (true !== ($e = $PO->load())) { return $e; } - + $MO = $PO->toMO(); if (true !== ($e = $MO->save($mofile))) { return $e; } unset($PO, $MO); - + return true; } - + /** * prepare * @@ -153,7 +153,7 @@ class TGettext * @param string $string * @param bool $reverse */ - function prepare($string, $reverse = false) + static function prepare($string, $reverse = false) { if ($reverse) { $smap = array('"', "\n", "\t", "\r"); @@ -166,7 +166,7 @@ class TGettext return (string) str_replace($smap, $rmap, $string); } } - + /** * meta2array * @@ -175,7 +175,7 @@ class TGettext * @return array * @param string $meta */ - function meta2array($meta) + static function meta2array($meta) { $array = array(); foreach (explode("\n", $meta) as $info) { @@ -189,7 +189,7 @@ class TGettext /** * toArray - * + * * Returns meta info and strings as an array of a structure like that: * * array( @@ -206,7 +206,7 @@ class TGettext * ) * ) * - * + * * @see fromArray() * @access protected * @return array @@ -215,10 +215,10 @@ class TGettext { return array('meta' => $this->meta, 'strings' => $this->strings); } - + /** * fromArray - * + * * Assigns meta info and strings from an array of a structure like that: * * array( @@ -235,7 +235,7 @@ class TGettext * ) * ) * - * + * * @see toArray() * @access protected * @return bool @@ -255,7 +255,7 @@ class TGettext } return true; } - + /** * toMO * @@ -269,7 +269,7 @@ class TGettext $MO->fromArray($this->toArray()); return $MO; } - + /** * toPO * -- cgit v1.2.3