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


PHP currency_convert函数代码示例

本文整理汇总了PHP中currency_convert函数的典型用法代码示例。如果您正苦于以下问题:PHP currency_convert函数的具体用法?PHP currency_convert怎么用?PHP currency_convert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: database

 $p->delete($permission, 'temp');
 //get the destination_uuid
 if (strlen($destination_response['uuid']) > 0) {
     $destination_uuid = $destination_response['uuid'];
 }
 //redirect the user
 if ($action == "add") {
     $_SESSION["message"] = $text['message-add'];
     // billing
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/billing/app_config.php")) {
         $db2 = new database();
         $db2->sql = "select currency, billing_uuid, balance from v_billings where type_value='{$destination_accountcode}'";
         $db2->result = $db2->execute();
         $default_currency = strlen($_SESSION['billing']['currency']['text']) ? $_SESSION['billing']['currency']['text'] : 'USD';
         $billing_currency = strlen($db2->result[0]['currency']) ? $db2->result[0]['currency'] : $default_currency;
         $destination_sell_current_currency = currency_convert($destination_sell, $billing_currency, $currency);
         $billing_uuid = $db2->result[0]['billing_uuid'];
         $balance = $db2->result[0]['balance'];
         unset($db2->sql, $db2->result);
         $balance -= $destination_sell_current_currency;
         $db2->sql = "update v_billings set balance = {$balance}, old_balance = {$balance} where type_value='{$destination_accountcode}'";
         $db2->result = $db2->execute();
         unset($db2->sql, $db2->result);
         $billing_invoice_uuid = uuid();
         $user_uuid = check_str($_SESSION['user_uuid']);
         $settled = 1;
         $mc_gross = -1 * $destination_sell_current_currency;
         $post_payload = serialize($_POST);
         $db2->sql = "insert into v_billing_invoices (billing_invoice_uuid, billing_uuid, payer_uuid, billing_payment_date, settled, amount, debt, post_payload,plugin_used, domain_uuid) values ('{$billing_invoice_uuid}', '{$billing_uuid}', '{$user_uuid}', NOW(), {$settled}, {$mc_gross}, {$balance}, '{$post_payload}', 'DID {$destination_number} Assigment', '" . $domain_uuid . "' )";
         $db2->result = $db2->execute();
         unset($db2->sql, $db2->result);
开发者ID:kevinlovesing,项目名称:fusionpbx,代码行数:31,代码来源:destination_edit.php

示例2: process_xml_cdr


//.........这里部分代码省略.........
        $call_sell = call_cost($lcr_user_rate, $lcr_user_first_increment, $lcr_user_second_increment, $time);
        // Costs/Sell call are in original LCR currency, they need to be converted
        $database->fields['call_buy'] = check_str($call_buy);
        $database->fields['call_sell'] = check_str($call_sell);
        $db2->table = "v_xml_cdr";
        $db2->sql = "SELECT currency FROM v_billings WHERE type_value='{$accountcode}' LIMIT 1";
        $db2->result = $db2->execute();
        $actual_currency = strlen($lcr_currency) ? $lcr_currency : (strlen($_SESSION['billing']['currency']['text']) ? $_SESSION['billing']['currency']['text'] : 'USD');
        $billing_currency = strlen($db2->result[0]['currency']) ? $db2->result[0]['currency'] : $default_currency;
        if ($debug) {
            echo "sql: " . $db2->sql . "\n";
            echo "c " . $database->fields['carrier_name'] . "\n";
            echo "t {$time}\n";
            echo "b r:{$lcr_rate} - {$lcr_first_increment} - {$lcr_first_increment} = {$call_buy}\n";
            echo "s r:{$lcr_user_rate} - {$lcr_user_first_increment} - {$lcr_user_second_increment} = {$call_sell}\n";
            echo "lcr currency {$lcr_currency}\n";
            echo "actual currency {$actual_currency}\n";
            echo "user currency {$lcr_user_currency}\n";
            echo "billing currency {$billing_currency}\n";
        }
        unset($database->sql);
        unset($database->result);
        $sql_balance = "SELECT balance, old_balance FROM v_billings WHERE type_value='" . check_str(urldecode($xml->variables->accountcode)) . "'";
        $db2->sql = $sql_balance;
        $db2->result = $db2->execute();
        $balance = $db2->result[0]['balance'];
        $old_balance = $db2->result[0]['old_balance'];
        if ($debug) {
            echo "sql_balance: {$sql_balance}\n";
            echo "bal: {$balance}\n";
            echo "old bal: {$old_balance}\n";
        }
        // Lets convert rate from lcr_currency to billing_currency
        $billing_call_sell = currency_convert($call_sell, $billing_currency, $lcr_user_currency);
        if ($debug) {
            echo "bcs: {$billing_call_sell} {$billing_currency}\n";
        }
        // Remember that old_balance is using billing_currency
        $updated_balance = (double) $old_balance - (double) $billing_call_sell;
        unset($db2->sql);
        unset($db2->result);
        $sql_update_balance = "UPDATE v_billings SET balance={$updated_balance}, old_balance={$updated_balance} WHERE type_value='" . check_str(urldecode($xml->variables->accountcode)) . "'";
        if ($debug) {
            echo "sql_update_balance: {$sql_update_balance}\n";
        }
        $db2->sql = $sql_update_balance;
        $db2->result = $db2->execute();
        unset($db2->sql);
        unset($db2->result);
    }
    //insert xml_cdr into the db
    if (strlen($start_stamp) > 0) {
        $database->add();
        if ($debug) {
            echo $database->sql . "\n";
        }
    }
    //insert the values
    if (strlen($uuid) > 0) {
        if ($debug) {
            $time5_insert = microtime(true);
            //echo $sql."<br />\n";
        }
        try {
            $error = "false";
            //$db->exec(check_sql($sql));
开发者ID:richbreton,项目名称:fusionpbx,代码行数:67,代码来源:v_xml_cdr_import.php

示例3: database

         //increment the extension number
         $extension++;
     }
     if ($billing_app_exists) {
         // Let's bill $j has the number of extensions to bill
         $db2 = new database();
         $db2->sql = "SELECT currency, billing_uuid, balance FROM v_billings WHERE type_value='{$destination_accountcode}'";
         $db2->result = $db2->execute();
         $default_currency = strlen($_SESSION['billing']['currency']['text']) ? $_SESSION['billing']['currency']['text'] : 'USD';
         $billing_currency = strlen($db2->result[0]['currency']) ? $db2->result[0]['currency'] : $default_currency;
         $billing_uuid = $db2->result[0]['billing_uuid'];
         $balance = $db2->result[0]['balance'];
         unset($db2->sql, $db2->result);
         $default_extension_pricing = strlen($_SESSION['billing']['extension.pricing']['numeric']) ? $_SESSION['billing']['extension.pricing']['numeric'] : '0';
         $total_price = $default_extension_pricing * $j;
         $total_price_current_currency = currency_convert($total_price, $billing_currency, $default_currency);
         $balance -= $total_price_current_currency;
         $db2->sql = "UPDATE v_billings SET balance = {$balance}, old_balance = {$balance} WHERE type_value='{$destination_accountcode}'";
         $db2->result = $db2->execute();
         unset($db2->sql, $db2->result);
         $billing_invoice_uuid = uuid();
         $user_uuid = check_str($_SESSION['user_uuid']);
         $settled = 1;
         $mc_gross = -1 * $total_price_current_currency;
         $post_payload = serialize($_POST);
         $db2->sql = "INSERT INTO v_billing_invoices (billing_invoice_uuid, billing_uuid, payer_uuid, billing_payment_date, settled, amount, debt, post_payload,plugin_used, domain_uuid) VALUES ('{$billing_invoice_uuid}', '{$billing_uuid}', '{$user_uuid}', NOW(), {$settled}, {$mc_gross}, {$balance}, '{$post_payload}', '{$j} extension(s) created', '" . $_SESSION['domain_uuid'] . "' )";
         $db2->result = $db2->execute();
         unset($db2->sql, $db2->result);
     }
 }
 //if ($action == "add")
开发者ID:reliberate,项目名称:fusionpbx,代码行数:31,代码来源:extension_edit.php

示例4: json_decode

             $array = json_decode(json_encode((array) simplexml_load_string($xml_string)), true);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $n = $lcr_direction == "inbound" ? check_str(urldecode($array["caller_profile"]["caller_id_number"])) : check_str(urldecode($array["variables"]["lcr_query_digits"]));
     $database->table = "v_lcr";
     $database->sql = "SELECT currency FROM v_lcr WHERE v_lcr.carrier_uuid IS NULL AND v_lcr.enabled='true' AND v_lcr.lcr_direction='{$lcr_direction}' AND v_lcr.digits IN (" . number_series($n) . ") ORDER BY digits DESC, rate ASC, date_start DESC LIMIT 1";
     $database->result = $database->execute();
     // print "<pre>"; print $database->sql . ":";print "[".$database->result[0]['currency']."]"; print_r($array); print "</pre>";
     $lcr_currency = is_string($database->result[0]['currency']) && strlen($database->result[0]['currency']) ? $database->result[0]['currency'] : (strlen($_SESSION['billing']['currency']['text']) ? $_SESSION['billing']['currency']['text'] : 'USD');
     //billed currency
     unset($database->sql);
     unset($database->result);
     if ($sell_price) {
         $price = currency_convert($sell_price, $billing_currency, $lcr_currency);
     } else {
         $price = 0;
     }
     echo "\t<td valign='top' class='" . $row_style[$c] . "'>" . number_format($price, 6) . " {$billing_currency}</td>\n";
     unset($sell_price, $price);
 }
 if (permission_exists("xml_cdr_pdd")) {
     echo "\t<td valign='top' class='" . $row_style[$c] . "' style='text-align: right;'>" . number_format($row['pdd_ms'] / 1000, 2) . "s</td>\n";
 }
 if (permission_exists("xml_cdr_mos")) {
     echo "\t<td valign='top' class='" . $row_style[$c] . "' " . (strlen($row['rtp_audio_in_mos']) > 0 ? "title='" . $row['rtp_audio_in_mos'] / 5 * 100 . "%'" : null) . " style='text-align: center;'>" . (strlen($row['rtp_audio_in_mos']) > 0 ? $row['rtp_audio_in_mos'] : "&nbsp;") . "</td>\n";
 }
 echo "\t<td valign='top' class='" . $row_style[$c] . "' nowrap='nowrap'>";
 if (if_group("admin") || if_group("superadmin") || if_group("cdr")) {
     echo "<a {$tr_link}>" . $hangup_cause . "</a>";
开发者ID:williambhadley,项目名称:fusionpbx,代码行数:31,代码来源:xml_cdr.php

示例5: unset

 unset($set);
 switch ($add_comand) {
     case 'prod_off':
         $set = 'enabled = 0';
         break;
     case 'prod_on':
         $set = 'enabled = 1';
         break;
     case 'set_currency':
         $from = (int) $v['currencyID'];
         $list_price = (int) $v['list_price'];
         $to = (int) $_POST['currencyID'];
         if ($from != $to) {
             $set = 'currencyID = ' . $to;
             $set .= ',Price = "' . currency_convert($price, $from, $to) . '"';
             $set .= ',list_price = "' . currency_convert($list_price, $from, $to) . '"';
         }
         break;
     case 'prod_move':
         $set = 'categoryID = ' . (int) $_POST['prod_categoryID'];
         break;
     case 'prod_dell':
         if (!DeleteProduct($k)) {
             Redirect(_getUrlToSubmit() . '&couldntToDelete = 1');
         }
         break;
 }
 if (!empty($set)) {
     $sql = '
 UPDATE ' . PRODUCTS_TABLE . '
 SET ' . $set . '
开发者ID:gblok,项目名称:rsc,代码行数:31,代码来源:catalog_products_categories.php

示例6: choose

 /**
  * Choose product step.
  *
  * @param  tempcode	The page title.
  * @return tempcode	The result of execution.
  */
 function choose($title)
 {
     breadcrumb_set_self(do_lang_tempcode('PURCHASING'));
     /*if (is_guest())
     		{
     			$register=$GLOBALS['FORUM_DRIVER']->join_url();
     			if (is_object($register)) $register=$register->evaluate();
     			$_redirect=build_url(array('page'=>'_SELF','type'=>'misc'),'_SELF');
     			$redirect=$_redirect->evaluate();
     			$_login=build_url(array('page'=>'login','redirect'=>$redirect));
     			$login=$_login->evaluate();
     			return $this->wrap(do_template('PURCHASE_WIZARD_STAGE_GUEST',array('_GUID'=>'accf475a1457f73d7280b14d774acc6e','TITLE'=>$title,'TEXT'=>do_lang_tempcode('PURCHASE_NOT_LOGGED_IN_2',escape_html($register),escape_html($login)))),$title,NULL);
     		}*/
     $url = build_url(array('page' => '_SELF', 'type' => 'message', 'id' => get_param_integer('id', -1)), '_SELF', NULL, true, true);
     require_code('form_templates');
     $list = new ocp_tempcode();
     $filter = get_param('filter', '');
     $products = find_all_products();
     foreach ($products as $product => $details) {
         if ($filter != '') {
             if (!is_string($product) || substr($product, 0, strlen($filter)) != $filter) {
                 continue;
             }
         }
         if (($details[0] == PRODUCT_PURCHASE_WIZARD || $details[0] == PRODUCT_SUBSCRIPTION || $details[0] == PRODUCT_CATALOGUE) && method_exists($details[count($details) - 1], 'is_available') && $details[count($details) - 1]->is_available($product, get_member())) {
             require_code('currency');
             $currency = get_option('currency');
             $price = currency_convert(floatval($details[1]), $currency, NULL, true);
             $description = $details[4];
             if (strpos($details[4], strpos($details[4], '.') === false ? preg_replace('#\\.00($|[^\\d])#', '', $price) : $price) === false) {
                 $description .= ' (' . $price . ')';
             }
             $list->attach(form_input_list_entry($product, false, protect_from_escaping($description)));
         }
     }
     if ($list->is_empty()) {
         inform_exit(do_lang_tempcode('NO_CATEGORIES'));
     }
     $fields = form_input_list(do_lang_tempcode('PRODUCT'), '', 'product', $list, NULL, true);
     return $this->wrap(do_template('PURCHASE_WIZARD_STAGE_CHOOSE', array('_GUID' => '47c22d48313ff50e6323f05a78342eae', 'FIELDS' => $fields, 'TITLE' => $title)), $title, $url, true);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:47,代码来源:purchase.php

示例7: get_types

 /**
  * Get transaction summaries.
  *
  * @param  TIME		Start of time range
  * @param  TIME		End of time range
  * @param  boolean	Whether to count unpaid invoices into this. This means any invoicing in transactions will be ignored, and instead invoicing will be read directly.
  * @return array		A template-ready list of maps of summary for multiple transaction types.
  */
 function get_types($from, $to, $unpaid_invoices_count = false)
 {
     $types = array('OPENING' => array('TYPE' => do_lang_tempcode('OPENING_BALANCE'), 'AMOUNT' => 0, 'SPECIAL' => true), 'INTEREST_PLUS' => array('TYPE' => do_lang_tempcode('M_INTEREST_PLUS'), 'AMOUNT' => 0, 'SPECIAL' => false));
     $products = find_all_products();
     foreach ($products as $product => $details) {
         $types[$product] = array('TYPE' => $details[4], 'AMOUNT' => 0, 'SPECIAL' => false);
     }
     $types += array('COST' => array('TYPE' => do_lang_tempcode('EXPENSES'), 'AMOUNT' => 0, 'SPECIAL' => false), 'TRANS' => array('TYPE' => do_lang_tempcode('TRANSACTION_FEES'), 'AMOUNT' => 0, 'SPECIAL' => false), 'WAGE' => array('TYPE' => do_lang_tempcode('WAGES'), 'AMOUNT' => 0, 'SPECIAL' => false), 'INTEREST_MINUS' => array('TYPE' => do_lang_tempcode('M_INTEREST_MINUS'), 'AMOUNT' => 0, 'SPECIAL' => false), 'TAX' => array('TYPE' => do_lang_tempcode('TAX_GENERAL'), 'AMOUNT' => 0, 'SPECIAL' => false), 'CLOSING' => array('TYPE' => do_lang_tempcode('CLOSING_BALANCE'), 'AMOUNT' => 0, 'SPECIAL' => true), 'PROFIT' => array('TYPE' => do_lang_tempcode('NET_PROFIT'), 'AMOUNT' => 0, 'SPECIAL' => true));
     require_code('currency');
     $transactions = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'transactions WHERE t_time<' . strval((int) $to) . ' AND ' . db_string_equal_to('status', 'Completed') . ' ORDER BY t_time');
     foreach ($transactions as $transaction) {
         if ($transaction['t_time'] > $from) {
             $types['TRANS']['AMOUNT'] += get_transaction_fee($transaction['amount'], $transaction['t_via']);
         }
         if ($unpaid_invoices_count) {
             foreach ($products as $product => $details) {
                 if ($transaction['item'] == $product && $details[0] == PRODUCT_INVOICE) {
                     continue 2;
                 }
             }
         }
         $product = $transaction['item'];
         $transaction['amount'] = currency_convert($transaction['amount'], $transaction['t_currency'], get_option('currency'));
         $types['CLOSING']['AMOUNT'] += $transaction['amount'];
         if ($transaction['t_time'] < $from) {
             $types['OPENING']['AMOUNT'] += $transaction['amount'] - get_transaction_fee($transaction['amount'], $transaction['t_via']);
             continue;
         }
         if ($transaction['item'] == 'OTHER' && $transaction['amount'] < 0) {
             $types['COST']['AMOUNT'] += $transaction['amount'];
         } elseif ($transaction['item'] == 'TAX') {
             $types['TAX']['AMOUNT'] += $transaction['amount'];
         } elseif ($transaction['item'] == 'INTEREST') {
             $types[$product][$transaction['amount'] < 0 ? 'INTEREST_MINUS' : 'INTEREST_PLUS']['AMOUNT'] += $transaction['amount'];
         } elseif ($transaction['item'] == 'WAGE') {
             $types['WAGE']['AMOUNT'] += $transaction['amount'];
         } else {
             if (!array_key_exists($product, $types)) {
                 $types[$product] = array('TYPE' => $product, 'AMOUNT' => 0, 'SPECIAL' => false);
             }
             // In case product no longer exists
             $types[$product]['AMOUNT'] += $transaction['amount'];
         }
     }
     if ($unpaid_invoices_count) {
         $invoices = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'invoices WHERE ' . db_string_equal_to('i_state', 'new') . ' AND i_time<' . strval((int) $to) . ' ORDER BY i_time');
         foreach ($invoices as $invoice) {
             $product = $invoice['i_type_code'];
             $types['CLOSING']['AMOUNT'] += intval($invoice['i_amount']);
             if ($invoice['i_time'] < $from) {
                 $types['OPENING']['AMOUNT'] += intval($invoice['i_amount']);
                 continue;
             }
             $types[$product]['AMOUNT'] += intval($invoice['i_amount']);
         }
     }
     // $types['PROFIT_GROSS'] is not calculated
     $types['PROFIT']['AMOUNT'] = $types['CLOSING']['AMOUNT'] - $types['OPENING']['AMOUNT'] + $types['TAX']['AMOUNT'];
     // $types['PROFIT_NET_TAXED'] is not calculated
     foreach ($types as $item => $details) {
         $types[$item]['AMOUNT'] = float_to_raw_string($types[$item]['AMOUNT']);
     }
     foreach ($types as $i => $t) {
         if (is_float($t['AMOUNT'])) {
             $types[$i]['AMOUNT'] = float_to_raw_string($t['AMOUNT']);
         } elseif (is_integer($t['AMOUNT'])) {
             $types[$i]['AMOUNT'] = strval($t['AMOUNT']);
         }
     }
     return $types;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:79,代码来源:admin_ecommerce.php

示例8: UpdateProduct

function UpdateProduct($productID, $categoryID, $name, $Price, $description, $in_stock, $customers_rating, $brief_description, $list_price, $product_code, $sort_order, $ProductIsProgram, $eproduct_filename, $eproduct_available_days, $eproduct_download_times, $weight, $meta_description, $meta_keywords, $free_shipping, $min_order_amount, $shipping_freight, $classID, $currencyID, $opt_margin, $sef, $title, $updateGCV = 1)
{
    if ($min_order_amount == 0) {
        $min_order_amount = 1;
    }
    if (!$ProductIsProgram) {
        $eproduct_filename = "";
    }
    if (!$free_shipping) {
        $free_shipping = 0;
    } else {
        $free_shipping = 1;
    }
    $sql = '
        SELECT eproduct_filename
        FROM ' . PRODUCTS_TABLE . '
        WHERE productID=' . (int) $productID;
    $q = db_query($sql);
    $old_file_name = db_fetch_row($q);
    $old_file_name = $old_file_name[0];
    if ($classID == null) {
        $classID = 'NULL';
    }
    if ($eproduct_filename != "" && $ProductIsProgram) {
        if (trim($_FILES[$eproduct_filename]["name"]) != "") {
            if (trim($old_file_name) != "" && file_exists("core/files/" . $old_file_name)) {
                unlink("core/files/{$old_file_name}");
            }
            if ($_FILES[$eproduct_filename]["size"] != 0) {
                $r = move_uploaded_file($_FILES[$eproduct_filename]["tmp_name"], "core/files/" . $_FILES[$eproduct_filename]["name"]);
            }
            $eproduct_filename = trim($_FILES[$eproduct_filename]["name"]);
            SetRightsToUploadedFile("core/files/" . $eproduct_filename);
        } else {
            $eproduct_filename = $old_file_name;
        }
    } elseif ($old_file_name != "") {
        unlink("core/files/" . $old_file_name);
    }
    if (isset($_POST['from_currencyID'])) {
        $from = (int) $_POST['from_currencyID'];
        $to = $currencyID;
        if ($from != $to && !empty($from)) {
            $Price = currency_convert($Price, $from, $to);
            $list_price = currency_convert($list_price, $from, $to);
        }
    }
    $sql = '
        UPDATE ' . PRODUCTS_TABLE . '
            SET
            categoryID = ' . (int) $categoryID . ',
            name = "' . xToText(trim($name)) . '",
            Price = "' . number_format($Price, 2, '.', '') . '",
            description = "' . xEscSQL($description) . '",
            in_stock = ' . (int) $in_stock . ',
            customers_rating  = "' . (double) $customers_rating . '",
            brief_description = "' . xEscSQL($brief_description) . '",
            list_price = "' . number_format($list_price, 2, '.', '') . '",
            product_code = "' . xToText(trim($product_code)) . '",
            sort_order = ' . (int) $sort_order . ',
            date_modified = "' . xEscSQL(get_current_time()) . '",
            eproduct_filename = "' . xEscSQL($eproduct_filename) . '",
            eproduct_available_days = ' . (int) $eproduct_available_days . ',
            eproduct_download_times = ' . (int) $eproduct_download_times . ',
            weight = "' . (double) $weight . '",
            meta_description = "' . xToText(trim($meta_description)) . '",
            meta_keywords = "' . xToText(trim($meta_keywords)) . '",
            free_shipping = ' . (int) $free_shipping . ',
            min_order_amount  = ' . (int) $min_order_amount . ',
            shipping_freight = "' . number_format($shipping_freight, 2, '.', '') . '",
            classID = "' . $classID . '",
            currencyID = ' . (int) $currencyID . ',
            opt_margin = ' . (int) $opt_margin . ',
            sef = "' . xToText(trim($sef)) . '",
            title = "' . xToText(trim($title)) . '"
            WHERE productID = ' . (int) $productID;
    db_query($sql);
    db_query('DELETE FROM ' . CATEGORIY_PRODUCT_TABLE . ' WHERE productID = ' . (int) $productID . ' AND categoryID = ' . (int) $categoryID);
    if ($updateGCV == 1 && CONF_UPDATE_GCV == '1') {
        //update goods count values for categories in case of regular file editing. do not update during import from excel
        update_psCount(1);
    }
}
开发者ID:gblok,项目名称:rsc,代码行数:83,代码来源:product_functions.php

示例9: ecv


//.........这里部分代码省略.........
                    }
                }
                break;
            case 'VERSION':
                $value = strval(ocp_version());
                break;
            case 'PREVIEW_VALIDATION':
                $value = get_option('is_on_preview_validation') == '1' ? '1' : '0';
                break;
            case 'BLOCK':
                if (isset($GLOBALS['NON_CACHEABLE_SYMBOLS']['SET_RAND'])) {
                    foreach ($param as $i => $p) {
                        if (is_object($p)) {
                            $param[$i] = $p->evaluate();
                        }
                    }
                    if (count($param) == 1 && strpos($param[0], ',') !== false) {
                        $param = preg_split('#((?<!\\\\)|(?<=\\\\\\\\)|(?<=^)),#', $param[0]);
                        foreach ($param as $key => $val) {
                            $param[$key] = str_replace('\\,', ',', $val);
                        }
                    }
                    global $LOADED_BLOCKS;
                    if (isset($LOADED_BLOCKS[serialize($param)])) {
                        // Will always be set
                        $value = $LOADED_BLOCKS[serialize($param)]->evaluate();
                    }
                }
                break;
            case 'CURRENCY':
                if (addon_installed('ecommerce')) {
                    if (isset($param[0])) {
                        require_code('currency');
                        $value = currency_convert(floatval(str_replace(',', '', $param[0])), isset($param[1]) && $param[1] != '' ? $param[1] : get_option('currency'), isset($param[2]) && $param[2] != '' ? $param[2] : NULL, isset($param[3]) && $param[3] == '1');
                        if (is_null($value)) {
                            $value = do_lang('INTERNAL_ERROR');
                        }
                    } else {
                        $value = get_option('currency');
                    }
                }
                break;
            case 'CURRENCY_SYMBOL':
                if (addon_installed('ecommerce')) {
                    require_code('ecommerce');
                    $value = ecommerce_get_currency_symbol();
                }
                break;
            case 'GEOLOCATE':
                $value = geolocate_ip(isset($param[0]) ? $param[0] : NULL);
                break;
            case 'NO_SAFE_MODE':
                $value = str_replace(array('on', 'true', 'yes'), array('1', '1', '1'), strtolower(ini_get('safe_mode'))) == '1' ? '0' : '1';
                break;
            case 'FORCE_PREVIEWS':
                if (get_option('forced_preview_option') == '1') {
                    if (get_forum_type() == 'ocf') {
                        if (is_guest() && get_option('default_preview_guests') == '0') {
                            $value = '0';
                        } else {
                            $value = $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_preview_posts') == 1 ? '1' : '0';
                        }
                    } else {
                        $value = get_option('default_preview_guests') == '0' ? '0' : '1';
                    }
                } else {
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:symbols.php


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