本文整理汇总了PHP中Currency::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Currency::config方法的具体用法?PHP Currency::config怎么用?PHP Currency::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Currency
的用法示例。
在下文中一共展示了Currency::config方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
// Send default settings according to locale
$locale = i18n::get_locale();
$symbols = Zend_Locale_Data::getList($locale, 'symbols');
$currency = Currency::config()->currency_symbol;
$decimals = $symbols['decimal'];
$thousands = $decimals == ',' ? ' ' : ',';
// Accouting needs to be initialized globally
FormExtraJquery::include_accounting();
Requirements::customScript(<<<EOT
window.accounting.settings = {
currency: {
symbol : "{$currency}",
format: "%s%v",
decimal : "{$decimals}",
thousand: "{$thousands}",
precision : 2
},
number: {
precision : 0,
thousand: "{$thousands}",
decimal : "{$decimals}"
}
}
EOT
, 'accountingInit');
}
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-form-extras,代码行数:28,代码来源:FormExtraLeftAndMainExtension.php
示例2: init
/**
* Init actions that happen globally to all commerce interfaces.
*
* At the moment this is used to set config where database access is required
*/
public function init()
{
// Set the default currency symbol
if ($siteconfig = SiteConfig::current_site_config()) {
Currency::config()->currency_symbol = $siteconfig->Currency()->HTMLNotation;
}
parent::init();
}
示例3: onBeforeInit
public function onBeforeInit()
{
$controller = $this->owner->request->param("Controller");
$action = $this->owner->request->param("Action");
if ($controller != "DevelopmentAdmin" && $action != "build") {
$config = SiteConfig::current_site_config();
// Set the default currency symbol for this site
Currency::config()->currency_symbol = Checkout::config()->currency_symbol;
// Auto inject the order prefix to the orders module if it exists
if (class_exists("Order") && class_exists("SiteConfig") && $config) {
Order::config()->order_prefix = $config->PaymentNumberPrefix;
}
}
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-checkout,代码行数:14,代码来源:CheckoutControllerExtension.php
示例4: setCurrencySymbol
/**
* @deprecated 4.0 Use the "Currency.currency_symbol" config setting instead
* @param [type] $value [description]
*/
public static function setCurrencySymbol($value)
{
Deprecation::notice('4.0', 'Use the "Currency.currency_symbol" config setting instead');
Currency::config()->currency_symbol = $value;
}
示例5: include_accounting
public static function include_accounting()
{
if (self::$disabled || in_array('accounting', self::$included)) {
return;
}
if (Director::isDev()) {
Requirements::block(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.min.js');
Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.js');
} else {
Requirements::block(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.js');
Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.min.js');
}
if (Controller::has_curr() && Controller::curr() instanceof LeftAndMain) {
// In admin we rely on extension because of ajax architecture
self::$included[] = 'accounting';
return;
}
// Send default settings according to locale
$locale = i18n::get_locale();
$symbols = Zend_Locale_Data::getList($locale, 'symbols');
$currency = Currency::config()->currency_symbol;
$decimals = $symbols['decimal'];
$thousands = $decimals == ',' ? ' ' : ',';
Requirements::customScript(<<<JS
window.accounting.settings = {
currency: {
symbol : "{$currency}",
format: "%s%v",
decimal : "{$decimals}",
thousand: "{$thousands}",
precision : 2
},
number: {
precision : 0,
thousand: "{$thousands}",
decimal : "{$decimals}"
}
}
JS
, 'accountingInit');
self::$included[] = 'accounting';
}