当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeNumber::defaultCurrency方法代码示例

本文整理汇总了PHP中CakeNumber::defaultCurrency方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeNumber::defaultCurrency方法的具体用法?PHP CakeNumber::defaultCurrency怎么用?PHP CakeNumber::defaultCurrency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeNumber的用法示例。


在下文中一共展示了CakeNumber::defaultCurrency方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: defaultCurrency

 /**
  * 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);
 }
开发者ID:yuuicchan0912,项目名称:sample2,代码行数:11,代码来源:NumberHelper.php

示例2: _replaceCurrency

 /**
  * 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;
 }
开发者ID:gourmet,项目名称:common,代码行数:30,代码来源:TableHelper.php

示例3: define

 * 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'))
开发者ID:gourmet,项目名称:common,代码行数:31,代码来源:bootstrap.php

示例4: array

 * 		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
开发者ID:magooemp,项目名称:eramba,代码行数:31,代码来源:bootstrap.php


注:本文中的CakeNumber::defaultCurrency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。