本文整理汇总了PHP中edd_get_shop_states函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_shop_states函数的具体用法?PHP edd_get_shop_states怎么用?PHP edd_get_shop_states使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_get_shop_states函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_shipping_details
/**
* Display shipping details in the View Details popup
*
* @since 1.0
*
* @access public
* @return void
*/
public function show_shipping_details($payment_id = 0)
{
if (empty($payment_id)) {
$payment_id = isset($_GET['id']) ? absint($_GET['id']) : 0;
}
$user_info = edd_get_payment_meta_user_info($payment_id);
$address = !empty($user_info['shipping_info']) ? $user_info['shipping_info'] : false;
if (!$address) {
return;
}
$status = get_post_meta($payment_id, '_edd_payment_shipping_status', true);
$shipped = $status == '2' ? true : false;
?>
<div id="edd-shipping-details" class="postbox">
<h3 class="hndle">
<span><?php
_e('Shipping Address', 'edd');
?>
</span>
</h3>
<div class="inside edd-clearfix">
<div id="edd-order-shipping-address">
<div class="order-data-address">
<div class="data column-container">
<div class="column">
<p>
<strong class="order-data-address-line"><?php
_e('Street Address Line 1:', 'edd');
?>
</strong><br/>
<input type="text" name="edd-payment-shipping-address[0][address]" value="<?php
esc_attr_e($address['address']);
?>
" class="medium-text" />
</p>
<p>
<strong class="order-data-address-line"><?php
_e('Street Address Line 2:', 'edd');
?>
</strong><br/>
<input type="text" name="edd-payment-shipping-address[0][address2]" value="<?php
esc_attr_e($address['address2']);
?>
" class="medium-text" />
</p>
</div>
<div class="column">
<p>
<strong class="order-data-address-line"><?php
echo _x('City:', 'Address City', 'edd');
?>
</strong><br/>
<input type="text" name="edd-payment-shipping-address[0][city]" value="<?php
esc_attr_e($address['city']);
?>
" class="medium-text"/>
</p>
<p>
<strong class="order-data-address-line"><?php
echo _x('Zip / Postal Code:', 'Zip / Postal code of address', 'edd');
?>
</strong><br/>
<input type="text" name="edd-payment-shipping-address[0][zip]" value="<?php
esc_attr_e($address['zip']);
?>
" class="medium-text"/>
</p>
</div>
<div class="column">
<p id="edd-order-address-country-wrap">
<strong class="order-data-address-line"><?php
echo _x('Country:', 'Address country', 'edd');
?>
</strong><br/>
<?php
echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'edd-payment-shipping-address[0][country]', 'selected' => $address['country'], 'show_option_all' => false, 'show_option_none' => false));
?>
</p>
<p id="edd-order-address-state-wrap">
<strong class="order-data-address-line"><?php
echo _x('State / Province:', 'State / province of address', 'edd');
?>
</strong><br/>
<?php
$states = edd_get_shop_states($address['country']);
if (!empty($states)) {
echo EDD()->html->select(array('options' => $states, 'name' => 'edd-payment-shipping-address[0][state]', 'selected' => $address['state'], 'show_option_all' => false, 'show_option_none' => false));
//.........这里部分代码省略.........
示例2: _x
<p id="edd-order-address-country-wrap">
<strong class="order-data-address-line"><?php
echo _x('Country:', 'Address country', 'edd');
?>
</strong><br/>
<?php
echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'edd-payment-address[0][country]', 'selected' => $address['country'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a country', 'edd')));
?>
</p>
<p id="edd-order-address-state-wrap">
<strong class="order-data-address-line"><?php
echo _x('State / Province:', 'State / province of address', 'edd');
?>
</strong><br/>
<?php
$states = edd_get_shop_states($address['country']);
if (!empty($states)) {
echo EDD()->html->select(array('options' => $states, 'name' => 'edd-payment-address[0][state]', 'selected' => $address['state'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a state', 'edd')));
} else {
?>
<input type="text" name="edd-payment-address[0][state]" value="<?php
echo esc_attr($address['state']);
?>
" class="medium-text"/>
<?php
}
?>
</p>
</div>
</div>
</div>
示例3: edd_customers_view
//.........这里部分代码省略.........
<span class="customer-address info-item edit-item">
<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php
_e('Address 1', 'edd');
?>
" value="<?php
echo $address['line1'];
?>
" />
<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php
_e('Address 2', 'edd');
?>
" value="<?php
echo $address['line2'];
?>
" />
<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php
_e('City', 'edd');
?>
" value="<?php
echo $address['city'];
?>
" />
<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country edd-select edit-item">
<?php
$selected_country = $address['country'];
$countries = edd_get_country_list();
foreach ($countries as $country_code => $country) {
echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>';
}
?>
</select>
<?php
$selected_state = edd_get_shop_state();
$states = edd_get_shop_states($selected_country);
$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
if (!empty($states)) {
?>
<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state edd-select info-item">
<?php
foreach ($states as $state_code => $state) {
echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>';
}
?>
</select>
<?php
} else {
?>
<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state edd-input info-item" placeholder="<?php
_e('State / Province', 'edd');
?>
"/>
<?php
}
?>
<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php
_e('Postal', 'edd');
?>
" value="<?php
echo $address['zip'];
?>
" />
</span>
<?php
}
?>
</div>
示例4: edd_default_cc_address_fields
//.........这里部分代码省略.........
}
?>
" placeholder="<?php
_e('Zip / Postal code', 'edd');
?>
" value="<?php
echo $customer['address']['zip'];
?>
"/>
</p>
<p id="edd-card-country-wrap">
<label for="billing_country" class="edd-label">
<?php
_e('Billing Country', 'edd');
?>
<?php
if (edd_field_is_required('billing_country')) {
?>
<span class="edd-required-indicator">*</span>
<?php
}
?>
</label>
<span class="edd-description"><?php
_e('The country for your billing address.', 'edd');
?>
</span>
<select name="billing_country" id="billing_country" class="billing_country edd-select<?php
if (edd_field_is_required('billing_country')) {
echo ' required';
}
?>
">
<?php
$selected_country = edd_get_shop_country();
if (!empty($customer['address']['country']) && '*' !== $customer['address']['country']) {
$selected_country = $customer['address']['country'];
}
$countries = edd_get_country_list();
foreach ($countries as $country_code => $country) {
echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>';
}
?>
</select>
</p>
<p id="edd-card-state-wrap">
<label for="card_state" class="edd-label">
<?php
_e('Billing State / Province', 'edd');
?>
<?php
if (edd_field_is_required('card_state')) {
?>
<span class="edd-required-indicator">*</span>
<?php
}
?>
</label>
<span class="edd-description"><?php
_e('The state or province for your billing address.', 'edd');
?>
</span>
<?php
$selected_state = edd_get_shop_state();
$states = edd_get_shop_states($selected_country);
if (!empty($customer['address']['state'])) {
$selected_state = $customer['address']['state'];
}
if (!empty($states)) {
?>
<select name="card_state" id="card_state" class="card_state edd-select<?php
if (edd_field_is_required('card_state')) {
echo ' required';
}
?>
">
<?php
foreach ($states as $state_code => $state) {
echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>';
}
?>
</select>
<?php
} else {
?>
<input type="text" size="6" name="card_state" id="card_state" class="card_state edd-input" placeholder="<?php
_e('State / Province', 'edd');
?>
"/>
<?php
}
?>
</p>
<?php
do_action('edd_cc_billing_bottom');
?>
</fieldset>
<?php
echo ob_get_clean();
}
示例5: edd_tax_rates_callback
/**
* Tax Rates Callback
*
* Renders tax rates table
*
* @since 1.6
* @param array $args Arguments passed by the setting
* @global $edd_options Array of all the EDD Options
* @return void
*/
function edd_tax_rates_callback($args)
{
global $edd_options;
$rates = edd_get_tax_rates();
ob_start();
?>
<p><?php
echo $args['desc'];
?>
</p>
<table id="edd_tax_rates" class="wp-list-table widefat fixed posts">
<thead>
<tr>
<th scope="col" class="edd_tax_country"><?php
_e('Country', 'easy-digital-downloads');
?>
</th>
<th scope="col" class="edd_tax_state"><?php
_e('State / Province', 'easy-digital-downloads');
?>
</th>
<th scope="col" class="edd_tax_global" title="<?php
_e('Apply rate to whole country, regardless of state / province', 'easy-digital-downloads');
?>
"><?php
_e('Country Wide', 'easy-digital-downloads');
?>
</th>
<th scope="col" class="edd_tax_rate"><?php
_e('Rate', 'easy-digital-downloads');
?>
</th>
<th scope="col"><?php
_e('Remove', 'easy-digital-downloads');
?>
</th>
</tr>
</thead>
<?php
if (!empty($rates)) {
?>
<?php
foreach ($rates as $key => $rate) {
?>
<tr>
<td class="edd_tax_country">
<?php
echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'tax_rates[' . $key . '][country]', 'selected' => $rate['country'], 'show_option_all' => false, 'show_option_none' => false, 'class' => 'edd-select edd-tax-country', 'chosen' => false, 'placeholder' => __('Choose a country', 'easy-digital-downloads')));
?>
</td>
<td class="edd_tax_state">
<?php
$states = edd_get_shop_states($rate['country']);
if (!empty($states)) {
echo EDD()->html->select(array('options' => $states, 'name' => 'tax_rates[' . $key . '][state]', 'selected' => $rate['state'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => false, 'placeholder' => __('Choose a state', 'easy-digital-downloads')));
} else {
echo EDD()->html->text(array('name' => 'tax_rates[' . $key . '][state]', $rate['state'], 'value' => !empty($rate['state']) ? $rate['state'] : ''));
}
?>
</td>
<td class="edd_tax_global">
<input type="checkbox" name="tax_rates[<?php
echo $key;
?>
][global]" id="tax_rates[<?php
echo $key;
?>
][global]" value="1"<?php
checked(true, !empty($rate['global']));
?>
/>
<label for="tax_rates[<?php
echo $key;
?>
][global]"><?php
_e('Apply to whole country', 'easy-digital-downloads');
?>
</label>
</td>
<td class="edd_tax_rate"><input type="number" class="small-text" step="0.0001" min="0.0" max="99" name="tax_rates[<?php
echo $key;
?>
][rate]" value="<?php
echo $rate['rate'];
?>
"/></td>
<td><span class="edd_remove_tax_rate button-secondary"><?php
_e('Remove Rate', 'easy-digital-downloads');
?>
</span></td>
//.........这里部分代码省略.........
示例6: edd_ajax_get_states_field
/**
* Retrieve a states drop down
*
* @since 1.6
* @return void
*/
function edd_ajax_get_states_field()
{
if (empty($_POST['country'])) {
$_POST['country'] = edd_get_shop_country();
}
$states = edd_get_shop_states($_POST['country']);
if (!empty($states)) {
$args = array('name' => $_POST['field_name'], 'id' => $_POST['field_name'], 'class' => $_POST['field_name'] . ' edd-select', 'options' => $states, 'show_option_all' => false, 'show_option_none' => false);
$response = EDD()->html->select($args);
} else {
$response = 'nostates';
}
echo $response;
edd_die();
}
示例7: edd_purchase_form_required_fields
/**
* Purchase Form Required Fields
*
* @access private
* @since 1.5
* @return array
*/
function edd_purchase_form_required_fields()
{
$required_fields = array('edd_email' => array('error_id' => 'invalid_email', 'error_message' => __('Please enter a valid email address', 'easy-digital-downloads')), 'edd_first' => array('error_id' => 'invalid_first_name', 'error_message' => __('Please enter your first name', 'easy-digital-downloads')));
// Let payment gateways and other extensions determine if address fields should be required
$require_address = apply_filters('edd_require_billing_address', edd_use_taxes() && edd_get_cart_total());
if ($require_address) {
$required_fields['card_zip'] = array('error_id' => 'invalid_zip_code', 'error_message' => __('Please enter your zip / postal code', 'easy-digital-downloads'));
$required_fields['card_city'] = array('error_id' => 'invalid_city', 'error_message' => __('Please enter your billing city', 'easy-digital-downloads'));
$required_fields['billing_country'] = array('error_id' => 'invalid_country', 'error_message' => __('Please select your billing country', 'easy-digital-downloads'));
$required_fields['card_state'] = array('error_id' => 'invalid_state', 'error_message' => __('Please enter billing state / province', 'easy-digital-downloads'));
// Check if the Customer's Country has been passed in and if it has no states.
if (isset($_POST['billing_country']) && isset($required_fields['card_state'])) {
$customer_billing_country = sanitize_text_field($_POST['billing_country']);
$states = edd_get_shop_states($customer_billing_country);
// If this country has no states, remove the requirement of a card_state.
if (empty($states)) {
unset($required_fields['card_state']);
}
}
}
return apply_filters('edd_purchase_form_required_fields', $required_fields);
}
示例8: get_customer_address
<?php
/**
* @package Yoast\YoastCom
*/
namespace Yoast\YoastCom\Theme;
$customer = get_customer_address();
$states = edd_get_shop_states($customer['address']['country']);
?>
<fieldset id="edd_cc_address" class="cc-address">
<?php
if ('stripe' === $_GET['payment-mode']) {
?>
<span><legend><?php
_e('Credit Card Billing Details', 'yoast-theme');
?>
</legend></span>
<p><?php
_e('Your billing address details are used for verification of your credit card, so please use your credit card\'s billing address.', 'yoast-theme');
?>
</p>
<?php
} else {
?>
<span><legend><?php
_e('Billing Details', 'yoast-theme');
?>
</legend></span>
<p><?php
_e('Your billing address details are required for tax purposes.', 'yoast-theme');