當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WPSC_Countries::get_currency_data方法代碼示例

本文整理匯總了PHP中WPSC_Countries::get_currency_data方法的典型用法代碼示例。如果您正苦於以下問題:PHP WPSC_Countries::get_currency_data方法的具體用法?PHP WPSC_Countries::get_currency_data怎麽用?PHP WPSC_Countries::get_currency_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WPSC_Countries的用法示例。


在下文中一共展示了WPSC_Countries::get_currency_data方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: form_paypal_multiple

/**
 * form_paypal_multiple function.
 *
 * Use this for now, but it will eventually be replaced with a better form API for gateways
 * @access public
 * @return void
 */
function form_paypal_multiple()
{
    global $wpdb, $wpsc_gateways;
    $account_type = get_option('paypal_multiple_url');
    $account_types = array('https://www.paypal.com/cgi-bin/webscr' => __('Live Account', 'wp-e-commerce'), 'https://www.sandbox.paypal.com/cgi-bin/webscr' => __('Sandbox Account', 'wp-e-commerce'));
    $output = "\n\t<tr>\n\t\t<td>" . __('Username:', 'wp-e-commerce') . "</td>\n\t\t<td>\n\t\t\t<input type='text' size='40' value='" . get_option('paypal_multiple_business') . "' name='paypal_multiple_business' />\n\t\t\t<p class='description'>\n\t\t\t\t" . __('This is your PayPal email address.', 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n\n\t<tr>\n\t\t<td>" . __('Account Type:', 'wp-e-commerce') . "</td>\n\t\t<td>\n\t\t\t<select name='paypal_multiple_url'>\n";
    foreach ($account_types as $url => $label) {
        $output .= "<option value='{$url}' " . selected($url, $account_type, false) . ">" . esc_html($label) . "</option>";
    }
    $output .= "\n\t\t\t</select>\n\t\t\t<p class='description'>\n\t\t\t\t" . __('If you have a PayPal developers Sandbox account, please use Sandbox mode. If you just have a standard PayPal account, then you will want to use Live mode.', 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n";
    $paypal_ipn = get_option('paypal_ipn');
    $paypal_ipn1 = "";
    $paypal_ipn2 = "";
    switch ($paypal_ipn) {
        case 0:
            $paypal_ipn2 = "checked='checked'";
            break;
        case 1:
            $paypal_ipn1 = "checked='checked'";
            break;
    }
    $paypal_ship = get_option('paypal_ship');
    $paypal_ship1 = "";
    $paypal_ship2 = "";
    switch ($paypal_ship) {
        case 1:
            $paypal_ship1 = "checked='checked'";
            break;
        case 0:
        default:
            $paypal_ship2 = "checked='checked'";
            break;
    }
    $address_override = get_option('address_override');
    $address_override1 = "";
    $address_override2 = "";
    switch ($address_override) {
        case 1:
            $address_override1 = "checked='checked'";
            break;
        case 0:
        default:
            $address_override2 = "checked='checked'";
            break;
    }
    $output .= "\n\t<tr>\n\t\t<td>" . __("IPN", 'wp-e-commerce') . ":</td>\n\t\t<td>\n\t\t\t<input type='radio' value='1' name='paypal_ipn' id='paypal_ipn1' " . $paypal_ipn1 . " /> <label for='paypal_ipn1'>" . __('Yes', 'wp-e-commerce') . "</label> &nbsp;\n\t\t\t<input type='radio' value='0' name='paypal_ipn' id='paypal_ipn2' " . $paypal_ipn2 . " /> <label for='paypal_ipn2'>" . __('No', 'wp-e-commerce') . "</label>\n\t\t\t<p class='description'>\n\t\t\t\t" . __("IPN (instant payment notification) will automatically update your sales logs to 'Accepted payment' when a customer's payment is successful. For IPN to work you also need to have IPN turned on in your PayPal settings. If it is not turned on, the sales will remain as 'Order Pending' status until manually changed. It is highly recommended using IPN, especially if you are selling digital products.", 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td style='padding-bottom: 0px;'>" . __("Send shipping details", 'wp-e-commerce') . "</td>\n\t\t<td style='padding-bottom: 0px;'>\n\t\t\t<input type='radio' value='1' name='paypal_ship' id='paypal_ship1' " . $paypal_ship1 . " /> <label for='paypal_ship1'>" . __('Yes', 'wp-e-commerce') . "</label> &nbsp;\n\t\t\t<input type='radio' value='0' name='paypal_ship' id='paypal_ship2' " . $paypal_ship2 . " /> <label for='paypal_ship2'>" . __('No', 'wp-e-commerce') . "</label>\n\t\t\t<p class='description'>\n\t\t\t\t" . __("Note: If your checkout page does not have a shipping details section, or if you don't want to send PayPal shipping information, you should change the Send shipping details option to 'No'.", 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td>\n\t\t\t" . __('Address Override:', 'wp-e-commerce') . "\n\t\t</td>\n\t\t<td>\n\t\t\t<input type='radio' value='1' name='address_override' id='address_override1' " . $address_override1 . " /> <label for='address_override1'>" . __('Yes', 'wp-e-commerce') . "</label> &nbsp;\n\t\t\t<input type='radio' value='0' name='address_override' id='address_override2' " . $address_override2 . " /> <label for='address_override2'>" . __('No', 'wp-e-commerce') . "</label>\n\t\t\t<p class='description'>\n\t\t\t\t" . __("This setting affects your PayPal purchase log. If your customers already have a PayPal account, PayPal will try to populate your PayPal Purchase Log with their PayPal address. This setting tries to replace the address in the PayPal purchase log with the address customers enter on your Checkout page.", 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n";
    $store_currency_data = WPSC_Countries::get_currency_data(get_option('currency_type'), true);
    $current_currency = get_option('paypal_curcode');
    if ($current_currency == '' && in_array($store_currency_data['code'], $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'])) {
        update_option('paypal_curcode', $store_currency_data['code']);
        $current_currency = $store_currency_data['code'];
    }
    if ($current_currency != $store_currency_data['code']) {
        $output .= "\n\t\t<tr>\n\t\t\t<td>\n\t\t\t</td>\n\t\t\t<td><strong class='form_group'>" . __('Currency Converter', 'wp-e-commerce') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t" . sprintf(__('Your website uses <strong>%s</strong>. This currency is not supported by PayPal. Please select an accepted currency using the drop down menu below. Buyers on your site will still pay in your local currency. However, we will send the order through to PayPal using the currency you choose below.', 'wp-e-commerce'), $store_currency_data['currency']) . "\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t" . __('Select Currency:', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_curcode'>\n";
        $paypal_currency_list = array_map('esc_sql', $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list']);
        $currency_list = WPSC_Countries::get_currencies(true);
        foreach ($currency_list as $currency_item) {
            $selected_currency = '';
            if ($current_currency == $currency_item['code']) {
                $selected_currency = "selected='selected'";
            }
            $output .= "<option " . $selected_currency . " value='{$currency_item['code']}'>{$currency_item['name']}</option>";
        }
        $output .= "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n";
    }
    if (get_option('paypal_form_first_name', false)) {
        $output .= "\n\t\t<tr>\n\t\t\t<td colspan='2'>\n\t\t\t\t<strong class='form_group'>" . __('Forms Sent to Gateway', 'wp-e-commerce') . "</strong>\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t\t<td>" . __('First Name Field', 'wp-e-commerce') . "</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[first_name]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_first_name')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . __('Last Name Field', 'wp-e-commerce') . "</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[last_name]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_last_name')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('Address Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[address]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_address')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('City Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[city]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_city')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('State Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[state]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_state')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('Postal / ZIP Code Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[post_code]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_post_code')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('Country Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[country]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_country')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='2'>\n\t\t\t\t<p class='description'>\n\t\t\t\t" . sprintf(__("For more help configuring PayPal Standard, please read our documentation <a href='%s'>here</a>", 'wp-e-commerce'), esc_url('http://docs.wpecommerce.org/documentation/paypal-payments-standard/')) . "\n\t\t\t\t</p>\n\t\t\t</td>\n\t\t</tr>\n";
    }
    return $output;
}
開發者ID:ashik968,項目名稱:digiplot,代碼行數:77,代碼來源:paypal-standard.merchant.php

示例2: display


//.........這裏部分代碼省略.........
        ?>
" /></td>
						</tr>
						<tr>
							<th><?php 
        esc_html_e('Use Test Server?', 'wp-e-commerce');
        ?>
</th>
							<td><input type="checkbox" name='wpsc_options[shipwire_test_server]' value="0" <?php 
        checked('1', get_option('shipwire_test_server', '0'));
        ?>
 /></td>
						</tr>
						<tr>
							<th><?php 
        esc_html_e('Force Sync with Shipwire', 'wp-e-commerce');
        ?>
</th>
							<td>
								<a class="shipwire_sync button"><?php 
        esc_html_e('Update Tracking and Inventory', 'wp-e-commerce');
        ?>
</a>
								<img src="<?php 
        echo esc_url(wpsc_get_ajax_spinner());
        ?>
" class="ajax-feedback" title="" alt="" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<?php 
        $currency_data = WPSC_Countries::get_currency_data(get_option('currency_type'), true);
        if ($currency_data['symbol'] != '') {
            $currency_sign = $currency_data['symbol_html'];
        } else {
            $currency_sign = $currency_data['code'];
        }
        ?>
			<tr>
				<th><?php 
        _e('Free Shipping Discount', 'wp-e-commerce');
        ?>
</th>
				<td>
					<?php 
        if (get_option('shipping_discount') == 1) {
            $shipping_discount_settings = 'style=\'display: block;\'';
        } else {
            $shipping_discount_settings = '';
        }
        ?>
					<input type='hidden' value='0' name='wpsc_options[shipping_discount]' />
					<input type='checkbox' onclick='jQuery("#shipping_discount_value").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipping_discount]' id='shipping_discount' <?php 
        checked('1', get_option('shipping_discount'));
        ?>
 />
					<label for='shipping_discount'><?php 
        _e('Enable Free Shipping Discount', 'wp-e-commerce');
        ?>
</label>

				</td>
			</tr>
			<tr>
開發者ID:ashik968,項目名稱:digiplot,代碼行數:67,代碼來源:shipping.php

示例3: wpsc_currency_display

/**
 * wpsc_currency_display function.
 *
 * @access public
 * @param mixed $price_in
 * @param mixed $args
 * @return string
 */
function wpsc_currency_display($price_in, $args = null)
{
    global $wpdb;
    $currency_code = '';
    $args = apply_filters('wpsc_toggle_display_currency_code', $args);
    $query = shortcode_atts(array('display_currency_symbol' => true, 'display_decimal_point' => true, 'display_currency_code' => false, 'display_as_html' => true, 'isocode' => false), $args);
    // No decimal point, no decimals
    if (false == $query['display_decimal_point']) {
        $decimals = 0;
    } else {
        $decimals = 2;
    }
    // default is 2
    $decimals = apply_filters('wpsc_modify_decimals', $decimals);
    // Format the price for output
    $price_out = wpsc_format_number($price_in, $decimals);
    // Get currency settings
    $currency_type = get_option('currency_type');
    if (!$query['isocode']) {
        // @todo: can deprecate this caching because the WPSC_Countries class already caches the data
        if (!($wpsc_currency_data = wp_cache_get($currency_type, 'wpsc_currency_id'))) {
            $wpsc_currency_data = WPSC_Countries::get_currency_data($currency_type, true);
            wp_cache_set($currency_type, $wpsc_currency_data, 'wpsc_currency_id');
        }
    } elseif (!($wpsc_currency_data = wp_cache_get($query['isocode'], 'wpsc_currency_isocode'))) {
        $wpsc_currency_data = WPSC_Countries::get_currency_data($currency_type, true);
        wp_cache_set($query['isocode'], $wpsc_currency_data, 'wpsc_currency_isocode');
    }
    // Figure out the currency code
    if ($query['display_currency_code']) {
        $currency_code = $wpsc_currency_data['code'];
    }
    // Figure out the currency sign
    $currency_sign = '';
    if ($query['display_currency_symbol']) {
        if (!empty($wpsc_currency_data['symbol'])) {
            if ($query['display_as_html'] && !empty($wpsc_currency_data['symbol_html'])) {
                $currency_sign = $wpsc_currency_data['symbol_html'];
            } else {
                $currency_sign = $wpsc_currency_data['symbol'];
            }
        } else {
            $currency_sign = $wpsc_currency_data['code'];
            $currency_code = '';
        }
    }
    $currency_sign_location = get_option('currency_sign_location');
    // Rejig the currency sign location
    switch ($currency_sign_location) {
        case 1:
            $format_string = '%3$s%1$s%2$s';
            break;
        case 2:
            $format_string = '%3$s %1$s%2$s';
            break;
        case 4:
            $format_string = '%1$s%2$s  %3$s';
            break;
        case 3:
        default:
            $format_string = '%1$s %2$s%3$s';
            break;
    }
    // Compile the output
    $output = trim(sprintf($format_string, $currency_code, $currency_sign, $price_out));
    if (!$query['display_as_html']) {
        $output = "" . $output . "";
    } else {
        $output = "<span class='pricedisplay'>" . $output . "</span>";
    }
    // Return results
    return apply_filters('wpsc_currency_display', $output);
}
開發者ID:AngryBird3,項目名稱:WP-e-Commerce,代碼行數:81,代碼來源:processing.functions.php


注:本文中的WPSC_Countries::get_currency_data方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。