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


PHP WPSC_Countries::get_countries_array方法代碼示例

本文整理匯總了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;
}
開發者ID:ashik968,項目名稱:digiplot,代碼行數:54,代碼來源:checkout.class.php

示例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>&lt;?php echo wpsc_display_products_page( array( 'category_url_name' => '<?php 
    echo $category["slug"];
    ?>
' ) ); ?&gt;</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>&nbsp; <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 
開發者ID:RJHanson292,項目名稱:WP-e-Commerce,代碼行數:67,代碼來源:save-data.functions.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 
            }
            ?>
//.........這裏部分代碼省略.........
開發者ID:VanessaGarcia-Freelance,項目名稱:ButtonHut,代碼行數:101,代碼來源:general.php


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