cvs: pear /Translation2/Decorator CacheLiteFunction.php
| From: | Lorenzo Alberton | Date: | Thu, 16 Dec 2004 18:32:32 +0000 |
| Subject: | cvs: pear /Translation2/Decorator CacheLiteFunction.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-27496@lists.php.net to get a copy of this message | ||
quipo Thu Dec 16 13:32:32 2004 EDT
Modified files:
/pear/Translation2/Decorator CacheLiteFunction.php
Log:
- simpler $this->tempVarName generation
- fixed bug #2972, cache_lite decorator not handling param sub as expected. Thanks to michael dot
caplan at lechateau dot ca
http://cvs.php.net/diff.php/pear/Translation2/Decorator/CacheLiteFunction.php?r1=1.7&r2=1.8&ty=u
Index: pear/Translation2/Decorator/CacheLiteFunction.php
diff -u pear/Translation2/Decorator/CacheLiteFunction.php:1.7
pear/Translation2/Decorator/CacheLiteFunction.php:1.8
--- pear/Translation2/Decorator/CacheLiteFunction.php:1.7 Thu Oct 28 06:16:25 2004
+++ pear/Translation2/Decorator/CacheLiteFunction.php Thu Dec 16 13:32:32 2004
@@ -16,11 +16,11 @@
// | Authors: Lorenzo Alberton <l dot alberton at quipo dot it> |
// +----------------------------------------------------------------------+
//
-// $Id: CacheLiteFunction.php,v 1.7 2004/10/28 10:16:25 quipo Exp $
+// $Id: CacheLiteFunction.php,v 1.8 2004/12/16 18:32:32 quipo Exp $
//
/**
* @package Translation2
- * @version $Id: CacheLiteFunction.php,v 1.7 2004/10/28 10:16:25 quipo Exp $
+ * @version $Id: CacheLiteFunction.php,v 1.8 2004/12/16 18:32:32 quipo Exp $
*/
/**
* Load Translation2 decorator base class
@@ -119,13 +119,7 @@
$this->_cleanCache();
//generate temp variable
if (is_null($this->tempVarName)) {
- $prefix = 'translation2_temp_';
- $var = $this->tempVarNameGenerator++;
- if ($var > 26) {
- $this->tempVarName = $prefix. chr(64 + $var % 26) . chr(64 + $var / 26);
- } else {
- $this->tempVarName = $prefix. chr(64 + $var);
- }
+ $this->tempVarName = 'translation2_temp_' .
$this->tempVarNameGenerator++;
}
}
@@ -154,10 +148,14 @@
$this->_prepare();
global ${$this->tempVarName}; // WITHOUT THIS, IT DOESN'T WORK
- ${$this->tempVarName} = $this->translation2;
+ ${$this->tempVarName} = $this->translation2->storage;
- return $this->cacheLiteFunction->call($this->tempVarName.'->get',
- $stringID, $pageID, $langID, $defaultText);
+ $string =
$this->cacheLiteFunction->call($this->tempVarName.'->getOne',
+ $stringID, $pageID, $langID);
+ if (empty($string)) {
+ return $defaultText;
+ }
+ return $this->translation2->_replaceParams($string);
}
// }}}