本文整理汇总了PHP中Zend_Currency::setCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Currency::setCache方法的具体用法?PHP Zend_Currency::setCache怎么用?PHP Zend_Currency::setCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Currency
的用法示例。
在下文中一共展示了Zend_Currency::setCache方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates a currency instance.
*
* @param CacheInterface $appCache
* @param string|array $options Options array or currency short name when string is given
* @param string $locale Locale name
*/
public function __construct(CacheInterface $appCache, $options = null, $locale = null)
{
// set Zend cache to low level frontend app cache
$lowLevelFrontendCache = $appCache->getFrontend()->getLowLevelFrontend();
\Zend_Currency::setCache($lowLevelFrontendCache);
parent::__construct($options, $locale);
}
示例2: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @return void
*/
public function setUp()
{
$this->clearRegistry();
$this->_cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 120, 'automatic_serialization' => true), array('cache_dir' => dirname(__FILE__) . '/../../_files/'));
Zend_Currency::setCache($this->_cache);
$this->helper = new Zend_View_Helper_Currency('de_AT');
}
示例3: setUp
public function setUp()
{
require_once 'Zend/Cache.php';
$cache = Zend_Cache::factory('Core', 'File',
array('lifetime' => 120, 'automatic_serialization' => true),
array('cache_dir' => dirname(__FILE__) . '/_files/'));
Zend_Currency::setCache($cache);
}
示例4: getCurrency
/**
* Return Zend_Currency object
*
* @param string $code
* @return Zend_Currency
*/
public function getCurrency($code = '')
{
if (empty($code)) {
$code = $this->getCode();
}
if (!isset($this->_currency[$code])) {
$options = $this->_getCurrencyOptions($code);
Zend_Currency::setCache(Axis::cache());
try {
$currency = new Zend_Currency($options['currency'], $options['format'] === null ? Axis_Locale::getLocale() : $options['format']);
} catch (Zend_Currency_Exception $e) {
Axis::message()->addError($e->getMessage() . ": " . Axis::translate('locale')->__("Try to change the format of this currency to English (United States) - en_US"));
$options = $this->_getSystemSafeCurrencyOptions();
$currency = new Zend_Currency($options['currency'], $options['format']);
}
$currency->setFormat($options);
$this->_currency[$code] = $currency;
}
return $this->_currency[$code];
}
示例5:
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// the database adapter for the session
Zend_Registry::set("dbAdapter", $application->getBootstrap()->getPluginResource('db')->getDbAdapter());
$cache = $application->getBootstrap()->getPluginResource('cachemanager')->getCacheManager()->getCache('database');
Zend_Registry::set('cache', $cache);
# Zend Translate instance
$translate = new Zend_Translate(array('adapter' => 'ini', 'content' => APPLICATION_PATH . '/configs/en.language.ini'));
# $translate->setCache($cache); // the caching of the translate seems to cause an error, do not know why
Zend_Registry::set('translate', $translate);
# Zend Logger instance
Zend_Registry::set("logger", $application->getBootstrap()->getPluginResource('log')->getLog());
# currency object
$currency = new Zend_Currency('en_US');
$currency->setCache($cache);
Zend_Registry::set('currency', $currency);
# Zend Mail instance
// create a new instance
$mailer = new Zend_Mail('utf8');
// set the default transport configured in application.ini
$mailer->setDefaultTransport($application->getBootstrap()->getPluginResource('mail')->getMail());
// set the default to and from addresses
$mail_config = new Zend_Config($application->getBootstrap()->getPluginResource('mail')->getOptions());
$mailer->setDefaultFrom($mail_config->defaultFrom->email, $mail_config->defaultFrom->name);
$mailer->setDefaultReplyTo($mail_config->defaultReplyTo->email, $mail_config->defaultReplyTo->name);
// add the mail instance to the registry
Zend_Registry::set("mail", $mailer);
// add caching for Zend_Table which is used for Session information
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
# run the default page