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


PHP WPSC_Countries::get_currency_code方法代码示例

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


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

示例1: get_local_currency_code

 function get_local_currency_code()
 {
     if (empty($this->local_currency_code)) {
         $this->local_currency_code = WPSC_Countries::get_currency_code(get_option('currency_type'));
     }
     return $this->local_currency_code;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:7,代码来源:paypal-standard.merchant.php

示例2: getQuote

 function getQuote()
 {
     global $wpdb, $wpec_ash, $wpsc_cart, $wpec_ash_tools;
     // Arguments array for various functions to use
     $args = array();
     $args['dest_ccode'] = wpsc_get_customer_meta('shippingcountry');
     // Get the ups settings from the ups account info page (Shipping tab)
     $wpsc_ups_settings = get_option('wpsc_ups_settings', array());
     //Disable International Shipping. Default: Enabled, as it currently is.
     $args['intl_rate'] = isset($wpsc_ups_settings['intl_rate']) && !empty($wpsc_ups_settings['intl_rate']) ? FALSE : TRUE;
     if (!$args['intl_rate'] && $args['dest_ccode'] != get_option('base_country')) {
         return array();
     }
     // Destination zip code
     $args['dest_pcode'] = (string) wpsc_get_customer_meta('shippingpostcode');
     if (!is_object($wpec_ash_tools)) {
         $wpec_ash_tools = new ASHTools();
     }
     if (empty($args['dest_pcode']) && $wpec_ash_tools->needs_post_code($args['dest_ccode'])) {
         // We cannot get a quote without a zip code so might as well return!
         return array();
     }
     // Get the total weight from the shopping cart
     $args['weight'] = wpsc_cart_weight_total();
     if (empty($args['weight'])) {
         return array();
     }
     $args['dest_state'] = '';
     $wpsc_country = new WPSC_Country(wpsc_get_customer_meta('shippingcountry'));
     if ($wpsc_country->has_regions()) {
         $wpsc_region = $wpsc_country->get_region(wpsc_get_customer_meta('shippingregion'));
         if (is_a($wpsc_region, 'WPSC_Region')) {
             $args['dest_state'] = $wpsc_region->get_code();
         }
     }
     if (empty($args['dest_state'])) {
         $args['dest_state'] = wpsc_get_customer_meta('shippingstate');
     }
     if (!is_object($wpec_ash)) {
         $wpec_ash = new ASH();
     }
     $shipping_cache_check['state'] = $args['dest_state'];
     //The destination is needed for cached shipment check.
     $shipping_cache_check['country'] = $args['dest_ccode'];
     $shipping_cache_check['zipcode'] = $args['dest_pcode'];
     $this->shipment = $wpec_ash->get_shipment();
     $this->shipment->set_destination($this->internal_name, $shipping_cache_check);
     //Set this shipment's destination.
     $this->shipment->rates_expire = date('Y-m-d');
     $args['shipper'] = $this->internal_name;
     $args['singular_shipping'] = array_key_exists('singular_shipping', $wpsc_ups_settings) ? $wpsc_ups_settings['singular_shipping'] : '0';
     if ($args['weight'] > 150 && !(bool) $args['singular_shipping']) {
         // This is where shipping breaks out of UPS if weight is higher than 150 LBS
         $over_weight_txt = apply_filters('wpsc_shipment_over_weight', __('Your order exceeds the standard shipping weight limit. Please contact us to quote other shipping alternatives.', 'wpsc'), $args);
         $shipping_quotes[$over_weight_txt] = 0;
         // yes, a constant.
         $wpec_ash->cache_results($this->internal_name, array($shipping_quotes), $this->shipment);
         //Update shipment cache.
         return array($shipping_quotes);
     }
     $cache = $wpec_ash->check_cache($this->internal_name, $this->shipment);
     //And now, we're ready to check cache.
     // We do not want to spam UPS (and slow down our process) if we already
     // have a shipping quote!
     if (count($cache['rate_table']) >= 1) {
         return $cache['rate_table'];
     }
     // Final rate table
     $rate_table = array();
     // API Auth settings //
     $args['username'] = array_key_exists('upsaccount', $wpsc_ups_settings) ? $wpsc_ups_settings['upsusername'] : '';
     $args['password'] = array_key_exists('upspassword', $wpsc_ups_settings) ? $wpsc_ups_settings['upspassword'] : '';
     $args['api_id'] = array_key_exists('upsid', $wpsc_ups_settings) ? $wpsc_ups_settings['upsid'] : '';
     $args['account_number'] = array_key_exists('upsaccount', $wpsc_ups_settings) ? $wpsc_ups_settings['upsaccount'] : '';
     $args['negotiated_rates'] = array_key_exists('ups_negotiated_rates', $wpsc_ups_settings) ? $wpsc_ups_settings['ups_negotiated_rates'] : '';
     $args['residential'] = $wpsc_ups_settings['49_residential'];
     $args['insured_shipment'] = array_key_exists('insured_shipment', $wpsc_ups_settings) ? $wpsc_ups_settings['insured_shipment'] : '0';
     // What kind of pickup service do you use ?
     $args['DropoffType'] = $wpsc_ups_settings['DropoffType'];
     $args['packaging'] = $wpsc_ups_settings['48_container'];
     // Preferred Currency to display
     $currency_data = WPSC_Countries::get_currency_code(get_option('currency_type'));
     if (!empty($currency_data)) {
         $args['currency'] = $currency_data;
     } else {
         $args['currency'] = 'USD';
     }
     // Shipping billing / account address
     $region = new WPSC_Region(get_option('base_country'), get_option('base_region'));
     $args['shipr_state'] = $region->get_code();
     $args['shipr_city'] = get_option('base_city');
     $args['shipr_ccode'] = get_option('base_country');
     $args['shipr_pcode'] = get_option('base_zipcode');
     // Physical Shipping address being shipped from
     $args['shipf_state'] = $args['shipr_state'];
     $args['shipf_city'] = $args['shipr_city'];
     $args['shipf_ccode'] = $args['shipr_ccode'];
     $args['shipf_pcode'] = $args['shipr_pcode'];
     $args['units'] = 'LBS';
     $args['cart_total'] = $wpsc_cart->calculate_subtotal(true);
//.........这里部分代码省略.........
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:101,代码来源:ups_20.php

示例3: gateway_chronopay

function gateway_chronopay($separator, $sessionid)
{
    global $wpdb;
    $purchase_log_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= %s LIMIT 1", $sessionid);
    $purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A);
    $cart_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='" . $purchase_log[0]['id'] . "'";
    $cart = $wpdb->get_results($cart_sql, ARRAY_A);
    // ChronoPay post variables
    $chronopay_url = get_option('chronopay_url');
    $data['product_id'] = get_option('chronopay_product_id');
    $data['product_name'] = get_option('chronopay_product_name');
    $data['product_price_currency'] = get_option('chronopay_curcode');
    $data['language'] = get_option('chronopay_language');
    $data['cb_url'] = add_query_arg('chronopay_callback', 'true', home_url('/'));
    $data['cb_type'] = 'P';
    $data['decline_url'] = home_url('/?chronopay_callback=true');
    $data['cs1'] = $sessionid;
    $data['cs2'] = 'chronopay';
    $salt = get_option('chronopay_salt');
    $data['cs3'] = md5($salt . md5($sessionid . $salt));
    // placed in here for security so that the return call can be validated as 'real'
    // User details
    if ($_POST['collected_data'][get_option('chronopay_form_first_name')] != '') {
        $data['f_name'] = $_POST['collected_data'][get_option('chronopay_form_first_name')];
    }
    if ($_POST['collected_data'][get_option('chronopay_form_last_name')] != "") {
        $data['s_name'] = $_POST['collected_data'][get_option('chronopay_form_last_name')];
    }
    if ($_POST['collected_data'][get_option('chronopay_form_address')] != '') {
        $data['street'] = str_replace("\n", ', ', $_POST['collected_data'][get_option('chronopay_form_address')]);
    }
    if ($_POST['collected_data'][get_option('chronopay_form_city')] != '') {
        $data['city'] = $_POST['collected_data'][get_option('chronopay_form_city')];
    }
    $data['country'] = (string) wpsc_get_customer_meta('billingcountry');
    // Change suggested by waxfeet@gmail.com, if email to be sent is not there, dont send an email address
    $email_data = $wpdb->get_results("SELECT `id`,`type` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1'", ARRAY_A);
    foreach ((array) $email_data as $email) {
        $data['email'] = $_POST['collected_data'][$email['id']];
    }
    if ($_POST['collected_data'][get_option('email_form_field')] != null && $data['email'] == null) {
        $data['email'] = $_POST['collected_data'][get_option('email_form_field')];
    }
    // Get Currency details abd price
    $currency_code = WPSC_Countries::get_currency_code(get_option('currency_type'));
    $local_currency_code = $currency_code[0]['code'];
    $chronopay_currency_code = get_option('chronopay_curcode');
    // ChronoPay only processes in the set currency.  This is USD or EUR dependent on what the Chornopay account is set up with.
    // This must match the ChronoPay settings set up in wordpress.  Convert to the chronopay currency and calculate total.
    $curr = new CURRENCYCONVERTER();
    $decimal_places = 2;
    $total_price = 0;
    $i = 1;
    $all_donations = true;
    $all_no_shipping = true;
    foreach ($cart as $item) {
        $product_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . $wpdb->posts . "` WHERE `id`= %d LIMIT 1", $item['prodid']), ARRAY_A);
        $product_data = $product_data[0];
        $variation_count = count($product_variations);
        //Does this even still work in 3.8? We're not using this table.
        $variation_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CART_ITEM_VARIATIONS . "` WHERE `cart_id` = %d", $item['id']);
        $variation_data = $wpdb->get_results($variation_sql, ARRAY_A);
        $variation_count = count($variation_data);
        if ($variation_count >= 1) {
            $variation_list = " (";
            $j = 0;
            foreach ($variation_data as $variation) {
                if ($j > 0) {
                    $variation_list .= ", ";
                }
                $value_id = $variation['venue_id'];
                $value_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_VARIATION_VALUES . "` WHERE `id`= %d LIMIT 1", $value_id), ARRAY_A);
                $variation_list .= $value_data[0]['name'];
                $j++;
            }
            $variation_list .= ")";
        } else {
            $variation_list = '';
        }
        $local_currency_productprice = $item['price'];
        $local_currency_shipping = $item['pnp'];
        $chronopay_currency_productprice = $local_currency_productprice;
        $chronopay_currency_shipping = $local_currency_shipping;
        $data['item_name_' . $i] = $product_data['name'] . $variation_list;
        $data['amount_' . $i] = number_format(sprintf("%01.2f", $chronopay_currency_productprice), $decimal_places, '.', '');
        $data['quantity_' . $i] = $item['quantity'];
        $data['item_number_' . $i] = $product_data['id'];
        if ($item['donation'] != 1) {
            $all_donations = false;
            $data['shipping_' . $i] = number_format($chronopay_currency_shipping, $decimal_places, '.', '');
            $data['shipping2_' . $i] = number_format($chronopay_currency_shipping, $decimal_places, '.', '');
        } else {
            $data['shipping_' . $i] = number_format(0, $decimal_places, '.', '');
            $data['shipping2_' . $i] = number_format(0, $decimal_places, '.', '');
        }
        if ($product_data['no_shipping'] != 1) {
            $all_no_shipping = false;
        }
        $total_price = $total_price + $data['amount_' . $i] * $data['quantity_' . $i];
        if ($all_no_shipping != false) {
//.........这里部分代码省略.........
开发者ID:ashik968,项目名称:digiplot,代码行数:101,代码来源:chronopay.php

示例4: collate_data

 /**
  * collate_data method, collate purchase data, like addresses, like country
  * @access public
  */
 function collate_data()
 {
     global $wpdb;
     // Get purchase data, regardless of being fed the ID or the sessionid
     if ($this->purchase_id > 0) {
         $purchase_id =& $this->purchase_id;
         $purchase_logs = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = %d LIMIT 1", $purchase_id), ARRAY_A);
     } else {
         if ($this->session_id != null) {
             $purchase_logs = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid` = %s LIMIT 1", $this->session_id), ARRAY_A);
             $this->purchase_id = $purchase_logs['id'];
             $purchase_id =& $this->purchase_id;
         }
     }
     $email_address = $wpdb->get_var("SELECT `value` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` AS `form_field` INNER JOIN `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` AS `collected_data` ON `form_field`.`id` = `collected_data`.`form_id` WHERE `form_field`.`type` IN ( 'email' ) AND `collected_data`.`log_id` IN ( '{$purchase_id}' )");
     $currency_code = WPSC_Countries::get_currency_code(get_option('currency_type'));
     $collected_form_data = $wpdb->get_results("SELECT `data_names`.`id`, `data_names`.`unique_name`, `collected_data`.`value` FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` AS `collected_data` JOIN `" . WPSC_TABLE_CHECKOUT_FORMS . "` AS `data_names` ON `collected_data`.`form_id` = `data_names`.`id` WHERE `log_id` = '" . $purchase_id . "'", ARRAY_A);
     $address_data = array('billing' => array(), 'shipping' => array());
     foreach ($collected_form_data as $collected_form_row) {
         $address_data_set = 'billing';
         $address_key = array_search($collected_form_row['unique_name'], $this->address_keys['billing']);
         if ($address_key == null) {
             $address_data_set = 'shipping';
             $address_key = array_search($collected_form_row['unique_name'], $this->address_keys['shipping']);
         }
         if ($address_key == null) {
             continue;
         }
         switch ($collected_form_row['unique_name']) {
             case 'billingcountry':
             case 'shippingcountry':
                 $country = maybe_unserialize($collected_form_row['value']);
                 if (is_array($country)) {
                     $address_data[$address_data_set]['state'] = wpsc_get_state_by_id($country[1], 'code');
                     $country = $country[0];
                 }
                 $address_data[$address_data_set][$address_key] = $country;
                 break;
             case 'billingstate':
             case 'shippingstate':
                 if (empty($address_data[$address_data_set]['state'])) {
                     $address_data[$address_data_set]['state'] = is_numeric($collected_form_row['value']) ? wpsc_get_state_by_id($collected_form_row['value'], 'code') : $collected_form_row['value'];
                 }
                 break;
             default:
                 $address_data[$address_data_set][$address_key] = $collected_form_row['value'];
                 break;
         }
     }
     if (count($address_data['shipping']) < 1) {
         $address_data['shipping'] = $address_data['billing'];
     }
     if (!empty($purchase_logs['discount_value']) && $purchase_logs['discount_value'] > 0) {
         $has_discount = true;
     } else {
         $has_discount = false;
     }
     $this->cart_data = array('software_name' => 'WP eCommerce/' . WPSC_PRESENTABLE_VERSION . '', 'store_location' => get_option('base_country'), 'store_currency' => $currency_code, 'is_subscription' => false, 'has_discounts' => $has_discount, 'cart_discount_value' => $purchase_logs['discount_value'], 'cart_discount_coupon' => $purchase_logs['discount_data'], 'cart_tax' => $purchase_logs['wpec_taxes_total'], 'notification_url' => add_query_arg('wpsc_action', 'gateway_notification', home_url('/')), 'transaction_results_url' => get_option('transact_url'), 'shopping_cart_url' => get_option('shopping_cart_url'), 'products_page_url' => get_option('product_list_url'), 'base_shipping' => $purchase_logs['base_shipping'], 'total_price' => $purchase_logs['totalprice'], 'session_id' => $purchase_logs['sessionid'], 'transaction_id' => $purchase_logs['transactid'], 'email_address' => $email_address, 'billing_address' => $address_data['billing'], 'shipping_address' => $address_data['shipping']);
 }
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:63,代码来源:merchant.class.php

示例5: wpsc_get_currency_code

/**
 *	wpsc_get_currency_code
 *
 *	@param does not receive anything
 *  @return returns the currency code used for the shop
*/
function wpsc_get_currency_code()
{
    return WPSC_Countries::get_currency_code(get_option('currency_type'));
}
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:10,代码来源:processing.functions.php

示例6: cryptocoin_payment

 /**
  * 3.4
  */
 public static function cryptocoin_payment($arr)
 {
     global $gourl, $wpdb;
     static $flag = false;
     if ($flag) {
         return false;
     }
     $flag = true;
     // Initialize
     // ------------------------
     if (class_exists('gourlclass') && defined('GOURL') && is_object($gourl)) {
         $payments = $gourl->payments();
         // Activated Payments
         $coin_names = $gourl->coin_names();
         // All Coins
         $languages = $gourl->languages();
         // All Languages
     } else {
         $payments = array();
         $coin_names = array();
         $languages = array();
     }
     $statuses = array(2 => 'Order Received', 3 => 'Accepted Payment', 4 => 'Job Dispatched', 5 => 'Closed Order');
     $mainplugin_url = admin_url("plugin-install.php?tab=search&type=term&s=GoUrl+Bitcoin+Payment+Gateway+Downloads");
     $defcoin = get_option(GOURLWPSC . 'defcoin');
     if (!in_array($defcoin, array_keys($payments))) {
         $defcoin = current(array_keys($payments));
     }
     $deflang = get_option(GOURLWPSC . 'deflang');
     if (!in_array($deflang, array_keys($languages))) {
         $deflang = current(array_keys($languages));
     }
     $emultiplier = str_replace("%", "", get_option(GOURLWPSC . 'emultiplier'));
     if (!$emultiplier || !is_numeric($emultiplier) || $emultiplier <= 0) {
         $emultiplier = "1.00";
     }
     $ostatus = get_option(GOURLWPSC . 'ostatus');
     if (!in_array($ostatus, array_keys($statuses))) {
         $ostatus = 3;
     }
     // Accepted Payment
     $ostatus2 = get_option(GOURLWPSC . 'ostatus2');
     if (!in_array($ostatus2, array_keys($statuses))) {
         $ostatus2 = 3;
     }
     // Accepted Payment
     $iconwidth = str_replace("px", "", get_option(GOURLWPSC . 'iconwidth'));
     if (!$iconwidth || !is_numeric($iconwidth) || $iconwidth < 30 || $iconwidth > 250) {
         $iconwidth = 60;
     }
     $iconwidth = $iconwidth . "px";
     // Current Order
     // -----------------
     $order_id = $arr["purchase_id"];
     $order_total = $arr["purchase_log"]["totalprice"];
     $order_currency = version_compare(WPSC_VERSION, '3.8.14', '<') ? current($wpdb->get_results("SELECT code FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE id = " . intval(get_option('currency_type')) . " LIMIT 1", ARRAY_A))["code"] : WPSC_Countries::get_currency_code(get_option('currency_type'));
     $order_user_id = $arr["purchase_log"]["user_ID"];
     if ($order_currency == "DOG") {
         $order_currency = "DOGE";
     }
     // WP eCommerce allow max 3 symbols for coin symbol
     if ($order_currency == "DAS") {
         $order_currency = "DASH";
     }
     // WP eCommerce allow max 3 symbols for coin symbol
     // Security
     // -------------
     if (!$order_id) {
         throw new Exception('The GoUrl payment plugin was called to process a payment but could not retrieve the order details for order_id. Cannot continue!');
     }
     if ($arr["purchase_log"]["gateway"] != "wpsc_gourl_gateway" || $order_user_id && $order_user_id != get_current_user_id()) {
         return false;
     }
     if (!class_exists('gourlclass') || !defined('GOURL') || !is_object($gourl)) {
         echo '<h2>' . __('Information', GOURLWPSC) . '</h2>' . PHP_EOL;
         echo "<div style='border:1px solid #eee;margin:20px 10px;padding:10px'>" . __("Please try a different payment method. Admin need to install and activate wordpress plugin 'GoUrl Bitcoin Gateway' (https://gourl.io/bitcoin-wordpress-plugin.html) to accept Bitcoin/Altcoin Payments online", GOURLWPSC) . "</div>";
     } elseif (!$payments || !$defcoin || true === version_compare(WPSC_VERSION, '3.8.10', '<') || true === version_compare(GOURL_VERSION, '1.3', '<') || array_key_exists($order_currency, $coin_names) && !array_key_exists($order_currency, $payments)) {
         echo '<h2>' . __('Information', GOURLWPSC) . '</h2>' . PHP_EOL;
         echo "<div style='border:1px solid #eee;margin:20px 10px;padding:10px'>" . sprintf(__('Sorry, but there was an error processing your order. Please try a different payment method or contact us if you need assistance. (GoUrl Bitcoin Plugin not configured - %s not activated)', GOURLWPSC), !$payments || !$defcoin ? "Cryptocurrency" : $coin_names[$order_currency]) . "</div>";
     } else {
         $plugin = "gourlwpecommerce";
         $amount = $order_total;
         $currency = $order_currency;
         $orderID = "order" . $order_id;
         $userID = $order_user_id;
         $period = "NOEXPIRY";
         $language = $deflang;
         $coin = $coin_names[$defcoin];
         $affiliate_key = "gourl";
         $crypto = array_key_exists($currency, $coin_names);
         if (!$userID) {
             $userID = "guest";
         }
         // allow guests to make checkout (payments)
         if (!$userID) {
             echo '<h2>' . __('Information', GOURLWPSC) . '</h2>' . PHP_EOL;
             echo "<div align='center'><a href='" . wp_login_url(get_permalink()) . "'>\n\t\t\t\t\t<img style='border:none;box-shadow:none;' title='" . __('You need first to login or register on the website to make Bitcoin/Altcoin Payments', GOURLWPSC) . "' vspace='10'\n\t\t\t\t\tsrc='" . $gourl->box_image() . "' border='0'></a></div>";
//.........这里部分代码省略.........
开发者ID:Artea,项目名称:Bitcoin-Payments-WP-eCommerce,代码行数:101,代码来源:gourl-wp-ecommerce.php


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