cvs: pear /Translation2/Decorator CacheLiteFunction.php

From: Date: Tue, 14 Nov 2006 18:51:18 +0000
Subject: cvs: pear /Translation2/Decorator CacheLiteFunction.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-43074@lists.php.net to get a copy of this message
quipo Tue Nov 14 18:51:18 2006 UTC Modified files: /pear/Translation2/Decorator CacheLiteFunction.php Log: added setLang() and setCacheOption() in CacheLiteFunction decorator http://cvs.php.net/viewvc.cgi/pear/Translation2/Decorator/CacheLiteFunction.php?r1=1.14&r2=1.15&diff_format=u Index: pear/Translation2/Decorator/CacheLiteFunction.php diff -u pear/Translation2/Decorator/CacheLiteFunction.php:1.14 pear/Translation2/Decorator/CacheLiteFunction.php:1.15 --- pear/Translation2/Decorator/CacheLiteFunction.php:1.14 Sun May 28 15:05:09 2006 +++ pear/Translation2/Decorator/CacheLiteFunction.php Tue Nov 14 18:51:18 2006 @@ -30,9 +30,9 @@ * @category Internationalization * @package Translation2 * @author Lorenzo Alberton <l dot alberton at quipo dot it> - * @copyright 2004-2005 Lorenzo Alberton + * @copyright 2004-2006 Lorenzo Alberton * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) - * @version CVS: $Id: CacheLiteFunction.php,v 1.14 2006/05/28 15:05:09 quipo Exp $ + * @version CVS: $Id: CacheLiteFunction.php,v 1.15 2006/11/14 18:51:18 quipo Exp $ * @link http://pear.php.net/package/Translation2 */ @@ -49,9 +49,9 @@ * @category Internationalization * @package Translation2 * @author Lorenzo Alberton <l dot alberton at quipo dot it> - * @copyright 2004-2005 Lorenzo Alberton + * @copyright 2004-2006 Lorenzo Alberton * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) - * @version CVS: $Id: CacheLiteFunction.php,v 1.14 2006/05/28 15:05:09 quipo Exp $ + * @version CVS: $Id: CacheLiteFunction.php,v 1.15 2006/11/14 18:51:18 quipo Exp $ * @link http://pear.php.net/package/Translation2 */ class Translation2_Decorator_CacheLiteFunction extends Translation2_Decorator @@ -61,7 +61,6 @@ /** * Cache_Lite_Function object * @var object - * @access protected */ var $cacheLiteFunction = null; @@ -108,13 +107,13 @@ var $caching = true; /** - * Frequency of cache cleaning. + * Frequency of cache cleaning. * Higher values mean lower cleaning probability. * Set 0 to disable. Set 1 to clean at every request. * @var boolean $caching */ var $cleaningFrequency = 0; - + /** * Name of default cache group. * @var string $defaultGroup @@ -148,6 +147,51 @@ } // }}} + // {{{ setLang() + + /** + * Set default lang + * + * Set the language that shall be used when retrieving strings. + * + * @param string $langID language code (for instance, 'en' or 'it') + */ + function setLang($langID) + { + // WITHOUT THIS, IT DOESN'T WORK + global $translation2_storage_cachelitefunction_temp; + //generate temp variable + $translation2_storage_cachelitefunction_temp = $this->translation2->storage; + + $res = $this->cacheLiteFunction->call( + 'translation2_storage_cachelitefunction_temp->setLang', $langID); + if (PEAR::isError($res)) { + return $res; + } + $this->translation2->lang = $res; + + } + + // }}} + // {{{ setCacheOption() + + /** + * Set a Cache_Lite option + * + * passes a Cache_Lite option forward to the Cache_Lite object + * @see Cache_Lite constructor for available options + * + * @param string $name name of the option + * @param string $value new value of the option + * @access public + */ + function setCacheOption($name, $value) + { + $this->_prepare(); + $this->cacheLiteFunction->setOption($name, $value); + } + + // }}} // {{{ getRaw() /** @@ -169,7 +213,7 @@ global $translation2_cachelitefunction_temp; //generate temp variable $translation2_cachelitefunction_temp = $this->translation2; - + if ($pageID == TRANSLATION2_DEFAULT_PAGEID) { $pageID = $this->translation2->currentPageID; } @@ -203,7 +247,7 @@ global $translation2_cachelitefunction_temp; //generate temp variable $translation2_cachelitefunction_temp = $this->translation2->storage; - + if ($pageID == TRANSLATION2_DEFAULT_PAGEID) { $pageID = $this->translation2->currentPageID; }

« previous php.pear.cvs (#43074) next »