本文整理汇总了PHP中Zend_Translate::hasCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Translate::hasCache方法的具体用法?PHP Zend_Translate::hasCache怎么用?PHP Zend_Translate::hasCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Translate
的用法示例。
在下文中一共展示了Zend_Translate::hasCache方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleartranslationcacheAction
/**
* Clears the translation cache
*
* @return void
*/
public function cleartranslationcacheAction()
{
if (Zend_Translate::hasCache()) {
Zend_Translate::clearCache();
}
$this->_redirect($_SERVER['HTTP_REFERER'], array('code' => 302));
}
示例2: updateTransAction
public function updateTransAction()
{
foreach ($this->getRequest()->getParam('trans') as $lang => $trans) {
$toReplace = array();
$toReplace[$this->getRequest()->getParam('text')] = $trans;
$this->getDi()->translationTable->replaceTranslation($toReplace, $lang);
}
Zend_Translate::hasCache() && Zend_Translate::clearCache();
}
示例3: testSetCacheThroughOptions
/**
* ZF-9877
*/
public function testSetCacheThroughOptions()
{
require_once 'Zend/Cache.php';
$cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 120, 'automatic_serialization' => true), array('cache_dir' => dirname(__FILE__) . '/_files/'));
$translate = new Zend_Translate(array('adapter' => Zend_Translate::AN_ARRAY, 'content' => array('msg1' => 'Message 1 (en)'), 'locale' => 'en', 'cache' => $cache));
$return = Zend_Translate::getCache();
$this->assertTrue($return instanceof Zend_Cache_Core);
$this->assertTrue(Zend_Translate::hasCache());
}
示例4: testTestingCacheHandling
public function testTestingCacheHandling()
{
require_once 'Zend/Cache.php';
$cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 120, 'automatic_serialization' => true), array('cache_dir' => dirname(__FILE__) . '/_files/'));
Zend_Translate::setCache($cache);
$cache = Zend_Translate::getCache();
$this->assertTrue($cache instanceof Zend_Cache_Core);
$this->assertTrue(Zend_Translate::hasCache());
$lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1 (en)'), 'en');
$adapter = $lang->getAdapter();
$this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array);
$adaptercache = $adapter->getCache();
$this->assertTrue($adaptercache instanceof Zend_Cache_Core);
Zend_Translate::clearCache();
$this->assertTrue(Zend_Translate::hasCache());
Zend_Translate::removeCache();
$this->assertFalse(Zend_Translate::hasCache());
}
示例5: saveAction
function saveAction()
{
$trans = $this->getRequest()->getParam('trans', array());
$translationData = $this->grid->getDataSource()->getTDataSource()->getTranslationData($this->getLanguage(), TranslationDataSource_Abstract::FETCH_MODE_ALL);
$toReplace = array();
foreach ($trans as $k => $v) {
$k = base64_decode($k);
if ($v != $translationData[$k]) {
$toReplace[$k] = $v;
}
}
if (count($toReplace)) {
$this->getDi()->translationTable->replaceTranslation($toReplace, $this->language);
if (Zend_Translate::hasCache()) {
Zend_Translate::clearCache();
}
}
$_POST['trans'] = $_GET['trans'] = null;
$this->grid->getRequest()->setParam('trans', null);
$this->grid->getCompleteRequest()->setParam('trans', null);
$this->getRequest()->setParam('trans', null);
$url = $this->makeUrl(null, 'index', null, $this->getRequest()->toArray());
$this->isAjax() ? $this->redirectAjax($url, ___('Redirect')) : $this->redirectLocation($url);
}