本文整理汇总了PHP中RGCurrency::to_number方法的典型用法代码示例。如果您正苦于以下问题:PHP RGCurrency::to_number方法的具体用法?PHP RGCurrency::to_number怎么用?PHP RGCurrency::to_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGCurrency
的用法示例。
在下文中一共展示了RGCurrency::to_number方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_value_submission
public function get_value_submission($field_values, $get_from_post_global_var = true)
{
$value = $this->get_input_value_submission('input_' . $this->id, $this->inputName, $field_values, $get_from_post_global_var);
$value = trim($value);
if ($this->numberFormat == 'currency') {
require_once GFCommon::get_base_path() . '/currency.php';
$currency = new RGCurrency(GFCommon::get_currency());
$value = $currency->to_number($value);
} else {
if ($this->numberFormat == 'decimal_comma') {
$value = GFCommon::clean_number($value, 'decimal_comma');
} else {
if ($this->numberFormat == 'decimal_dot') {
$value = GFCommon::clean_number($value, 'decimal_dot');
}
}
}
return $value;
}
示例2: to_number
public static function to_number($text, $currency_code = "")
{
if (!class_exists("RGCurrency")) {
require_once "currency.php";
}
if (empty($currency_code)) {
$currency_code = self::get_currency();
}
$currency = new RGCurrency($currency_code);
return $currency->to_number($text);
}
示例3: get_field_value
public static function get_field_value(&$field, $field_values = array(), $get_from_post = true)
{
if ($field['type'] == 'post_category') {
$field = GFCommon::add_categories_as_choices($field, '');
}
$value = array();
switch (RGFormsModel::get_input_type($field)) {
case "post_image":
$value[$field["id"] . ".1"] = self::get_input_value($field, "input_" . $field["id"] . "_1", $get_from_post);
$value[$field["id"] . ".4"] = self::get_input_value($field, "input_" . $field["id"] . "_4", $get_from_post);
$value[$field["id"] . ".7"] = self::get_input_value($field, "input_" . $field["id"] . "_7", $get_from_post);
break;
case "checkbox":
$parameter_values = self::get_parameter_value($field["inputName"], $field_values, $field);
if (!empty($parameter_values) && !is_array($parameter_values)) {
$parameter_values = explode(",", $parameter_values);
}
if (!is_array($field["inputs"])) {
return "";
}
$choice_index = 0;
foreach ($field["inputs"] as $input) {
if (!empty($_POST["is_submit_" . $field["formId"]]) && $get_from_post) {
$value[strval($input["id"])] = rgpost("input_" . str_replace('.', '_', strval($input["id"])));
} else {
if (is_array($parameter_values)) {
foreach ($parameter_values as $item) {
$item = trim($item);
if (self::choice_value_match($field, $field["choices"][$choice_index], $item)) {
$value[$input["id"] . ""] = $item;
break;
}
}
}
}
$choice_index++;
}
break;
case "list":
$value = self::get_input_value($field, "input_" . $field["id"], rgar($field, "inputName"), $field_values, $get_from_post);
$value = self::create_list_array($field, $value);
break;
case "number":
$value = self::get_input_value($field, "input_" . $field["id"], rgar($field, "inputName"), $field_values, $get_from_post);
$value = trim($value);
if ($field["numberFormat"] == "currency") {
require_once GFCommon::get_base_path() . '/currency.php';
$currency = new RGCurrency(GFCommon::get_currency());
$value = $currency->to_number($value);
}
break;
default:
if (isset($field["inputs"]) && is_array($field["inputs"])) {
foreach ($field["inputs"] as $input) {
$value[strval($input["id"])] = self::get_input_value($field, "input_" . str_replace('.', '_', strval($input["id"])), RGForms::get("name", $input), $field_values, $get_from_post);
}
} else {
$value = self::get_input_value($field, "input_" . $field["id"], rgar($field, "inputName"), $field_values, $get_from_post);
}
break;
}
return $value;
}
示例4: sanitize_settings
public function sanitize_settings()
{
parent::sanitize_settings();
$this->enableCalculation = (bool) $this->enableCalculation;
if ($this->numberFormat == 'currency') {
require_once GFCommon::get_base_path() . '/currency.php';
$currency = new RGCurrency(GFCommon::get_currency());
$this->rangeMin = $currency->to_number($this->rangeMin);
$this->rangeMax = $currency->to_number($this->rangeMax);
} elseif ($this->numberFormat == 'decimal_comma') {
$this->rangeMin = GFCommon::clean_number($this->rangeMin, 'decimal_comma');
$this->rangeMax = GFCommon::clean_number($this->rangeMax, 'decimal_comma');
} elseif ($this->numberFormat == 'decimal_dot') {
$this->rangeMin = GFCommon::clean_number($this->rangeMin, 'decimal_dot');
$this->rangeMin = GFCommon::clean_number($this->rangeMin, 'decimal_dot');
}
}