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


PHP WPSC_Countries::get_currencies方法代码示例

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


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

示例1: form_paypal_express

/**
 * Form Express Returns the Settings Form Fields
 * @access public
 *
 * @since 3.8
 * @return $output string containing Form Fields
 */
function form_paypal_express()
{
    global $wpdb, $wpsc_gateways;
    $serverType1 = '';
    $serverType2 = '';
    $select_currency[get_option('paypal_curcode')] = "selected='selected'";
    if (get_option('paypal_certified_server_type') == 'sandbox') {
        $serverType1 = "checked='checked'";
    } elseif (get_option('paypal_certified_server_type') == 'production') {
        $serverType2 = "checked='checked'";
    }
    $paypal_ipn = get_option('paypal_ipn');
    $output = "\n\t<tr>\n\t\t<td>" . __('API Username', 'wpsc') . "\n\t\t</td>\n\t\t<td>\n\t\t\t<input type='text' size='40' value='" . get_option('paypal_certified_apiuser') . "' name='paypal_certified_apiuser' />\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . __('API Password', 'wpsc') . "\n\t\t</td>\n\t\t<td>\n\t\t\t<input type='text' size='40' value='" . get_option('paypal_certified_apipass') . "' name='paypal_certified_apipass' />\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . __('API Signature', 'wpsc') . "\n\t\t</td>\n\t\t<td>\n\t\t\t<input type='text' size='70' value='" . get_option('paypal_certified_apisign') . "' name='paypal_certified_apisign' />\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . __('Server Type', 'wpsc') . "\n\t\t</td>\n\t\t<td>\n\t\t\t<input {$serverType1} type='radio' name='paypal_certified_server_type' value='sandbox' id='paypal_certified_server_type_sandbox' /> <label for='paypal_certified_server_type_sandbox'>" . __('Sandbox (For testing)', 'wpsc') . "</label> &nbsp;\n\t\t\t<input {$serverType2} type='radio' name='paypal_certified_server_type' value='production' id='paypal_certified_server_type_production' /> <label for='paypal_certified_server_type_production'>" . __('Production', 'wpsc') . "</label>\n\t\t\t<p class='description'>\n\t\t\t\t" . sprintf(__("Only use the sandbox server if you have a sandbox account with PayPal you can find out more about this <a href='%s'>here</a>", 'wpsc'), esc_url('https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_testing_sandbox')) . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n\n\t<tr>\n\t\t<td>\n\t\t" . __('IPN', 'wpsc') . "\n\t\t</td>\n\t\t<td>\n\t\t\t<input type='radio' value='1' name='paypal_ipn' id='paypal_ipn1' " . checked($paypal_ipn, 1, false) . " /> <label for='paypal_ipn1'>" . __('Yes', 'wpsc') . "</label> &nbsp;\n\t\t\t<input type='radio' value='0' name='paypal_ipn' id='paypal_ipn2' " . checked($paypal_ipn, 0, false) . " /> <label for='paypal_ipn2'>" . __('No', 'wpsc') . "</label>\n\t\t\t<p class='description'>\n\t\t\t" . __("IPN (instant payment notification) will automatically update your sales logs to 'Accepted payment' when a customers 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 sill remain as 'Order Pending' status until manually changed. It is highly recommend using IPN, especially if you are selling digital products.", 'wpsc') . "\n\t\t\t</p>\n\t\t</td>\n  \t</tr>\n";
    $paypal_ipn = get_option('paypal_ipn');
    $store_currency_code = WPSC_Countries::get_currency_code(absint(get_option('currency_type')));
    $current_currency = get_option('paypal_curcode');
    if ($current_currency == '' && in_array($store_currency_code, $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'])) {
        update_option('paypal_curcode', $store_currency_code);
        $current_currency = $store_currency_code;
    }
    if ($current_currency != $store_currency_code) {
        $output .= "<tr> <td colspan='2'><strong class='form_group'>" . __('Currency Converter', 'wpsc') . "</td> </tr>\n\t\t<tr>\n\t\t\t<td colspan='2'>\n\t\t\t" . __('Your website is using a currency not accepted by PayPal, select an accepted currency using the drop down menu bellow. Buyers on your site will still pay in your local currency however we will convert the currency and send the order through to PayPal using the currency you choose below.', 'wpsc') . "\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('Convert to', 'wpsc') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_curcode'>\n";
        if (!isset($wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'])) {
            $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list'] = array();
        }
        // TODO verify that this query is correct, the WPSC_Countries call that repalced it was coded to duplicate the results, but
        // why are currecies of inactive countries being returned??
        //$old_currency_list = $wpdb->get_results( "SELECT DISTINCT `code`, `currency` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `code` IN ('" . implode( "','", $paypal_currency_list ) . "')", ARRAY_A );
        $paypal_currency_list = array_map('esc_sql', $wpsc_gateways['wpsc_merchant_paypal_express']['supported_currencies']['currency_list']);
        $currency_list = WPSC_Countries::get_currencies(true);
        $currency_codes_in_commmon = array_intersect(array_keys($currency_list), $paypal_currency_list);
        foreach ($currency_codes_in_commmon as $currency_code) {
            $currency_item = $currency_list[$currency_code];
            if (in_array($currency_code, $paypal_currency_list)) {
                $selected_currency = '';
                if ($current_currency == $currency_item['code']) {
                    $selected_currency = "selected='selected'";
                }
                $output .= "<option " . $selected_currency . " value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
            }
        }
        $output .= "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n";
    }
    $output .= "\n\t<tr>\n\t\t<td colspan='2'>\n\t\t\t<p class='description'>\n\t \t\t" . sprintf(__("For more help configuring Paypal Express, please read our documentation <a href='%s'>here</a>", 'wpsc'), esc_url('http://docs.getshopped.org/documentation/paypal-express-checkout/')) . "\n\t \t\t</p>\n\t\t</td>\n   \t</tr>\n";
    return $output;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:53,代码来源:paypal-express.merchant.php

示例2: form_paypal_pro

function form_paypal_pro()
{
    global $wpsc_gateways, $wpdb;
    if (get_option('paypal_pro_testmode') == "on") {
        $selected = 'checked="checked"';
    } else {
        $selected = '';
    }
    $output = '
	<tr>
		<td>
			<label for="paypal_pro_username">' . __('API Username:', 'wpsc') . '</label>
		</td>
		<td>
			<input type="text" name="PayPalPro[username]" id="paypal_pro_username" value="' . get_option("paypal_pro_username") . '" size="30" />
		</td>
	</tr>
	<tr>
		<td>
			<label for="paypal_pro_password">' . __('API Password:', 'wpsc') . '</label>
		</td>
		<td>
			<input type="password" name="PayPalPro[password]" id="paypal_pro_password" value="' . get_option('paypal_pro_password') . '" size="16" />
		</td>
	</tr>
	<tr>
		<td>
			<label for="paypal_pro_signature">' . __('API Signature:', 'wpsc') . '</label>
		</td>
		<td>
			<input type="text" name="PayPalPro[signature]" id="paypal_pro_signature" value="' . get_option('paypal_pro_signature') . '" size="48" />
		</td>
	</tr>
	<tr>
		<td>
			<label for="paypal_pro_testmode">' . __('Test Mode Enabled:', 'wpsc') . '</label>
		</td>
		<td>
			<input type="hidden" name="PayPalPro[testmode]" value="off" />
			<label for="paypal_pro_testmode"><input type="checkbox" name="PayPalPro[testmode]" id="paypal_pro_testmode" value="on" ' . $selected . ' /> ' . __('Test Mode Enabled', 'wpsc') . '</label>
			<p class=" description">
  				' . sprintf(__("Only enable test mode if you have a sandbox account with PayPal you can find out more about this <a href='%s'>here</a>", 'wpsc'), esc_url('https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_testing_sandbox')) . '
  			</p>
  		</td>
  	</tr>';
    $store_currency_code = WPSC_Countries::get_currency_code(get_option('currency_type'));
    $current_currency = get_option('paypal_curcode');
    if ($current_currency == '' && in_array($store_currency_code, $wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'])) {
        update_option('paypal_curcode', $store_currency_code);
        $current_currency = $store_currency_code;
    }
    if ($current_currency != $store_currency_code) {
        $output .= "<tr> <td colspan='2'><strong class='form_group'>" . __('Currency Converter', 'wpsc') . "</td> </tr>\n\t\t<tr>\n\t\t\t<td colspan='2'>" . __('Your website is using a currency not accepted by PayPal, select an accepted currency using the drop down menu below. Buyers on your site will still pay in your local currency however we will convert the currency and send the order through to PayPal using the currency you choose below.', 'wpsc') . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t\t<td>" . __('Convert to', 'wpsc') . " </td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_curcode'>\n";
        if (!isset($wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'])) {
            $wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list'] = array();
        }
        $paypal_currency_list = array_map('esc_sql', $wpsc_gateways['wpsc_merchant_paypal_pro']['supported_currencies']['currency_list']);
        $currency_list = WPSC_Countries::get_currencies(true);
        $currency_codes_in_commmon = array_intersect(array_keys($currency_list), $paypal_currency_list);
        foreach ($currency_codes_in_commmon as $currency_code) {
            $selected_currency = '';
            $currency_item = $currency_list[$currency_code];
            if ($current_currency == $currency_item['code']) {
                $selected_currency = "selected='selected'";
            }
            $output .= "<option " . $selected_currency . " value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
        }
        $output .= "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n";
    }
    $output .= "\n\t<tr>\n\t\t<td colspan='2'>\n\t\t\t<p class='description'>\n\t\t\t\t" . sprintf(__("For more help configuring Paypal Pro, please read our documentation <a href='%s'>here</a>", 'wpsc'), esc_url('http://docs.getshopped.org/documentation/paypal-payments-pro/')) . "\n\t\t\t\t</p>\n\t\t</td>\n\t</tr>";
    return $output;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:72,代码来源:paypal-pro.merchant.php

示例3: 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


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