/** * Getter/setter for default currency * * @param string $currency The currency to be used in the future. * @return string Currency * @see CakeNumber::defaultCurrency() */ public function defaultCurrency($currency) { return $this->_engine->defaultCurrency($currency); }
/** * Replace by formatted currency string. * * Examples: * - [currency]50[/currency] * - [currency zero="$0.00"]0[/currency] * * @param string $str String to check and modify. * @return string Modified string. */ protected function _replaceCurrency($str) { if (!preg_match_all('/\\[currency(.*?)\\](.*)\\[\\/currency\\]/i', $str, $matches)) { // Fallback regex for when no options are passed. if (!preg_match_all('/\\[currency(.*?)\\](.[^\\[]*)\\[\\/currency\\]/i', $str, $matches)) { return $str; } } foreach ($matches[0] as $i => $find) { $opts = $this->_extractAttributes(trim($matches[1][$i])); $currency = CakeNumber::defaultCurrency(); if (isset($opts['currency'])) { $currency = $opts['currency']; unset($opts['currency']); } $replace = empty($matches[2][$i]) || !is_numeric($matches[2][$i]) ? '' : CakeNumber::currency($matches[2][$i], $currency, $opts); $str = str_replace($find, $replace, $str); } return $str; }
* Configure routing default class. */ if (CakePlugin::loaded('I18n')) { App::uses('I18nRoute', 'I18n.Routing/Route'); Router::defaultRouteClass('I18nRoute'); Configure::write('Config.language', Configure::read('L10n.language')); Configure::write('Config.languages', Configure::read('L10n.languages')); if (!defined('DEFAULT_LANGUAGE')) { define('DEFAULT_LANGUAGE', Configure::read('L10n.language')); } } /** * Configure `CakeNumber` currencies. */ if (class_exists('CakeNumber')) { CakeNumber::defaultCurrency(Common::read('L10n.currency', 'USD')); foreach (Common::read('L10n.currencies', array()) as $currencyName => $currencyFormat) { CakeNumber::addFormat($currencyName, $currencyFormat); } } if (!function_exists('__t')) { /** * Translates different type of strings depending on the number of arguments it is passed and their types. Supports: * * - all of `__()`, `__n()`, `__d()`, `__dn()` * - placeholders for `String::insert()` * * Examples: * * - __t('Hello world!') * - __t('Hello :name!', array('name' => 'world'))
* array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch * * )); */ Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher')); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug')); CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error')); App::uses('CakeTime', 'Utility'); App::uses('CakeNumber', 'Utility'); CakeNumber::addFormat('EUR', array('wholeSymbol' => ' €', 'wholePosition' => 'after', 'fractionSymbol' => false, 'fractionPosition' => 'after', 'zero' => 0, 'places' => 0, 'thousands' => ' ', 'decimals' => ',', 'negative' => '-', 'escape' => false)); CakeNumber::defaultCurrency('USD'); /** * All available languages in format (except the default which is defined in constants.php): * ISO-639-1 => ISO-639-2 * napriklad 'sk' => 'slo' * * @see ISO link: http://www.loc.gov/standards/iso639-2/php/code_list.php */ function availableLocals() { return array(); } /** * Return local in format ISO-639-2. * * @param string $lang locale ISO-639-1