當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Currency::setCache方法代碼示例

本文整理匯總了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);
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:14,代碼來源:Currency.php

示例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');
 }
開發者ID:bradley-holt,項目名稱:zf2,代碼行數:13,代碼來源:CurrencyTest.php

示例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);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:8,代碼來源:CurrencyTest.php

示例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];
 }
開發者ID:rommmka,項目名稱:axiscommerce,代碼行數:26,代碼來源:Currency.php

示例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
開發者ID:7thZoneTechnology,項目名稱:hrms-1,代碼行數:31,代碼來源:index.php


注:本文中的Zend_Currency::setCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。