initialize (); } function __set ($name, $value) { $this->setParam ($name, $value); } function __get ($name) { return $this->getParam ($name); } function setParam ($name, $value) { $this->params [$name] = $value; } function getParam ($name) { return $this->params [$name]; } function getParams () { return $this->params; } function getApplicationVersion () { return file_get_contents (DOCROOT . 'version'); } function getCurrencyId () { if (! isset ($this->cache_currency_id)) { $setting = ORM::factory ('setting', Setting_Model::S_CURRENCY_ID); if ($setting->isExist ()) { $this->cache_currency_id = $setting->value; } if (strlen ($this->cache_currency_id) == 0) { $this->cache_currency_id = $currecy_id = Kohana::config ('core.currency_id'); } $this->cache_currency_id = (int) $this->cache_currency_id; } return $this->cache_currency_id; } function getCurrencySymbol () { if (! isset ($this->cache_currency_symbol)) { $setting = ORM::factory ('setting', Setting_Model::S_CURRENCY_SYMBOL); if ($setting->isExist ()) { $this->cache_currency_symbol = $setting->value; } if (strlen ($this->cache_currency_symbol) == 0) { $this->cache_currency_symbol = Kohana::config ('core.currency_symbol'); } if (strlen ($this->cache_currency_symbol) == 0) { $this->cache_currency_symbol = '$'; } } return $this->cache_currency_symbol; } function getCurrencyCode ($currency_id = null) { $currencies = array ( 1 => 'EUR', 2 => 'CAD', 3 => 'GBP', 4 => 'JPY', 5 => 'AUD', 9 => 'SEK', 12 => 'BRL' ); if ($currency_id == null) { $currency_id = $this->getCurrencyId (); } if (array_key_exists ($currency_id, $currencies)) { return $currencies [$currency_id]; } return 'USD'; } function getCurrencyRate () { if (! isset ($this->cache_currency_rate)) { $setting = ORM::factory ('setting', Setting_Model::S_CURRENCY_RATE); $this->cache_currency_rate = 0; if ($setting->exists () && ($setting->value > 0)) { $this->cache_currency_rate = $setting->value; } if (! $this->cache_currency_rate) { $this->cache_currency_rate = Kohana::config ('core.currency_rate'); } if (! $this->cache_currency_rate) { $this->cache_currency_rate = 1; } } return $this->cache_currency_rate; } }