本文整理汇总了PHP中WPSC_Countries::get_countries_array方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Countries::get_countries_array方法的具体用法?PHP WPSC_Countries::get_countries_array怎么用?PHP WPSC_Countries::get_countries_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSC_Countries
的用法示例。
在下文中一共展示了WPSC_Countries::get_countries_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpsc_get_acceptable_countries
/**
* Cycles through the categories represented by the products in the cart.
* Retrieves their target markets and returns an array of acceptable markets
* We're only listing target markets that are acceptable for ALL categories in the cart
*
* @since 3.8.9
* @return array Countries that can be shipped to. If empty, sets session variable with appropriate error message
*/
function wpsc_get_acceptable_countries()
{
global $wpdb;
$cart_category_ids = array_unique(wpsc_cart_item_categories(true));
$target_market_ids = array();
foreach ($cart_category_ids as $category_id) {
$target_markets = wpsc_get_meta($category_id, 'target_market', 'wpsc_category');
if (!empty($target_markets)) {
$target_market_ids[$category_id] = $target_markets;
}
}
$have_target_market = !empty($target_market_ids);
//If we're comparing multiple categories
if (count($target_market_ids) > 1) {
$target_market_ids = call_user_func_array('array_intersect', $target_market_ids);
} elseif ($have_target_market) {
$target_market_ids = array_values($target_market_ids);
$target_market_ids = $target_market_ids[0];
}
$country_data = WPSC_Countries::get_countries_array();
$have_target_market = $have_target_market && count($country_data) != count($target_market_ids);
$GLOBALS['wpsc_country_data'] = $country_data;
// TODO Is this ever used?
$conflict_error = wpsc_get_customer_meta('category_shipping_conflict');
$target_conflict = wpsc_get_customer_meta('category_shipping_target_market_conflict');
// Return true if there are no restrictions
if (!$have_target_market) {
// clear out the target market messages
if (!empty($target_conflict)) {
wpsc_delete_customer_meta('category_shipping_conflict');
}
wpsc_update_customer_meta('category_shipping_target_market_conflict', false);
wpsc_update_customer_meta('category_shipping_conflict', false);
return true;
}
// temporarily hijack this session variable to display target market restriction warnings
if (!empty($target_conflict) || !wpsc_has_category_and_country_conflict()) {
wpsc_update_customer_meta('category_shipping_target_market_conflict', true);
wpsc_update_customer_meta('category_shipping_conflict', __("Some of your cart items are targeted specifically to certain markets. As a result, you can only select those countries as your shipping destination.", 'wp-e-commerce'));
}
if (empty($target_market_ids)) {
wpsc_update_customer_meta('category_shipping_target_market_conflict', true);
wpsc_update_customer_meta('category_shipping_conflict', __('It appears that some products in your cart have conflicting target market restrictions. As a result, there is no common destination country where your cart items can be shipped to. Please contact the site administrator for more information.', 'wp-e-commerce'));
}
return $target_market_ids;
}
示例2: wpsc_admin_category_forms_edit
//.........这里部分代码省略.........
</span>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top">
<label for="image"><?php
esc_html_e('Display Category Template Tag', 'wpsc');
?>
</label>
</th>
<td>
<code><?php echo wpsc_display_products_page( array( 'category_url_name' => '<?php
echo $category["slug"];
?>
' ) ); ?></code><br />
<span class="description"><?php
esc_html_e('Template tags are used to display a particular category or group within your theme / template.', 'wpsc');
?>
</span>
</td>
</tr>
<!-- START OF TARGET MARKET SELECTION -->
<tr>
<td colspan="2">
<h4><?php
esc_html_e('Target Market Restrictions', 'wpsc');
?>
</h4>
</td>
</tr>
<?php
$countrylist = WPSC_Countries::get_countries_array(true, true);
$selectedCountries = wpsc_get_meta($category_id, 'target_market', 'wpsc_category');
?>
<tr>
<th scope="row" valign="top">
<label for="image"><?php
esc_html_e('Target Markets', 'wpsc');
?>
</label>
</th>
<td>
<?php
if (wpsc_is_suhosin_enabled()) {
?>
<em><?php
esc_html_e('The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.', 'wpsc');
?>
</em>
<?php
} else {
?>
<span><?php
esc_html_e('Select', 'wpsc');
?>
: <a href='' class='wpsc_select_all'><?php
esc_html_e('All', 'wpsc');
?>
</a> <a href='' class='wpsc_select_none'><?php
esc_html_e('None', 'wpsc');
?>
</a></span><br />
<div id='resizeable' class='ui-widget-content multiple-select'>
<?php
示例3: display
public function display()
{
global $wpdb;
?>
<h3><?php
echo esc_html_e('General Settings', 'wpsc');
?>
</h3>
<table class='wpsc_options form-table'>
<tr>
<th scope="row"><label for="wpsc-base-country-drop-down"><?php
esc_html_e('Base Country/Region', 'wpsc');
?>
</label></th>
<td>
<?php
wpsc_country_dropdown(array('id' => 'wpsc-base-country-drop-down', 'name' => 'wpsc_options[base_country]', 'selected' => get_option('base_country'), 'include_invisible' => true));
?>
<span id='wpsc-base-region-drop-down'>
<?php
$this->display_region_drop_down();
?>
<img src="<?php
echo esc_url(wpsc_get_ajax_spinner());
?>
" class="ajax-feedback" title="" alt="" />
</span>
<p class='description'><?php
esc_html_e('Select your primary business location.', 'wpsc');
?>
</p>
</td>
</tr>
<?php
/* START OF TARGET MARKET SELECTION */
$countrylist = WPSC_Countries::get_countries_array(true, true);
?>
<tr>
<th scope="row">
<?php
esc_html_e('Target Markets', 'wpsc');
?>
</th>
<td>
<?php
// check for the suhosin module
if (wpsc_is_suhosin_enabled()) {
echo "<em>" . __("The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature then disable the suhosin extension, if you can not do this, you will need to contact your hosting provider.", 'wpsc') . "</em>";
} else {
?>
<span>
<?php
printf(__('Select: <a href="%1$s" class="wpsc-select-all" title="All">All</a> <a href="%2$s" class="wpsc-select-none" title="None">None</a>', 'wpsc'), esc_url(add_query_arg(array('selected_all' => 'all'))), esc_url(add_query_arg(array('selected_all' => 'none'))));
?>
</span><br />
<div id='wpsc-target-markets' class='ui-widget-content multiple-select'>
<?php
foreach ((array) $countrylist as $country) {
?>
<?php
if ($country['visible'] == 1) {
?>
<input type='checkbox' id="countrylist2-<?php
echo $country['id'];
?>
" name='countrylist2[]' value='<?php
echo $country['id'];
?>
' checked='checked' />
<label for="countrylist2-<?php
echo $country['id'];
?>
"><?php
esc_html_e($country['country']);
?>
</label><br />
<?php
} else {
?>
<input type='checkbox' id="countrylist2-<?php
echo $country['id'];
?>
" name='countrylist2[]' value='<?php
echo $country['id'];
?>
' />
<label for="countrylist2-<?php
echo $country['id'];
?>
"><?php
esc_html_e($country['country']);
?>
</label><br />
<?php
}
?>
<?php
}
?>
//.........这里部分代码省略.........