/**
  * 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);
 }
Beispiel #2
0
 /**
  * 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');
 }
 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);
 }
Beispiel #4
0
 /**
  * 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];
 }
Beispiel #5
0
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