/**
  * wcj_country_select_drop_down_list.
  */
 function wcj_country_select_drop_down_list($atts, $content)
 {
     $html = '';
     $form_method = $atts['form_method'];
     //get_option( 'wcj_price_by_country_country_selection_box_method', 'get' );
     $select_class = $atts['class'];
     //get_option( 'wcj_price_by_country_country_selection_box_class', '' );
     $select_style = $atts['style'];
     //get_option( 'wcj_price_by_country_country_selection_box_style', '' );
     $html .= '<form action="" method="' . $form_method . '">';
     $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">';
     $countries = wcj_get_countries();
     /* if ( 'get' == $form_method ) {
     			$selected_country = ( isset( $_GET[ 'wcj-country' ] ) ) ? $_GET[ 'wcj-country' ] : '';
     		} else {
     			$selected_country = ( isset( $_POST[ 'wcj-country' ] ) ) ? $_POST[ 'wcj-country' ] : '';
     		} */
     $selected_country = isset($_SESSION['wcj-country']) ? $_SESSION['wcj-country'] : '';
     foreach ($countries as $country_code => $country_name) {
         $html .= '<option value="' . $country_code . '" ' . selected($country_code, $selected_country, false) . '>' . $country_name . '</option>';
     }
     $html .= '</select>';
     $html .= '</form>';
     return $html;
 }
 function wcj_get_country_name_by_code($country_code)
 {
     $countries = wcj_get_countries();
     if (isset($countries[$country_code])) {
         return $countries[$country_code];
     }
     return false;
 }
Example #3
0
 /**
  * Filters for post types
  */
 public function restrict_manage_posts()
 {
     global $typenow, $wp_query;
     if (in_array($typenow, wc_get_order_types('order-meta-boxes'))) {
         $selected_coutry = isset($_GET['country']) ? $_GET['country'] : 'all';
         $countries = array_merge(array('all' => __('All countries', 'woocommerce-jetpack')), wcj_get_countries());
         echo '<select id="country" name="country">';
         foreach ($countries as $code => $name) {
             echo '<option value="' . $code . '" ' . selected($code, $selected_coutry, false) . '>' . $name . '</option>';
         }
         echo '</select>';
     }
 }
 /**
  * Get country address formats
  * @return array
  */
 public function get_default_address_formats()
 {
     // Common formats
     $postcode_before_city = "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}";
     $default = "{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}\n{postcode}\n{country}";
     // Define address formats
     $formats = array('default' => $default, 'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}", 'AT' => $postcode_before_city, 'BE' => $postcode_before_city, 'CA' => "{company}\n{name}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}", 'CH' => $postcode_before_city, 'CL' => "{company}\n{name}\n{address_1}\n{address_2}\n{state}\n{postcode} {city}\n{country}", 'CN' => "{country} {postcode}\n{state}, {city}, {address_2}, {address_1}\n{company}\n{name}", 'CZ' => $postcode_before_city, 'DE' => $postcode_before_city, 'EE' => $postcode_before_city, 'FI' => $postcode_before_city, 'DK' => $postcode_before_city, 'FR' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city_upper}\n{country}", 'HK' => "{company}\n{first_name} {last_name_upper}\n{address_1}\n{address_2}\n{city_upper}\n{state_upper}\n{country}", 'HU' => "{name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}", 'IN' => "{company}\n{name}\n{address_1}\n{address_2}\n{city} - {postcode}\n{state}, {country}", 'IS' => $postcode_before_city, 'IT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode}\n{city}\n{state_upper}\n{country}", 'JP' => "{postcode}\n{state}{city}{address_1}\n{address_2}\n{company}\n{last_name} {first_name}\n{country}", 'TW' => "{company}\n{last_name} {first_name}\n{address_1}\n{address_2}\n{state}, {city} {postcode}\n{country}", 'LI' => $postcode_before_city, 'NL' => $postcode_before_city, 'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}", 'NO' => $postcode_before_city, 'PL' => $postcode_before_city, 'SK' => $postcode_before_city, 'SI' => $postcode_before_city, 'ES' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{state}\n{country}", 'SE' => $postcode_before_city, 'TR' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city} {state}\n{country}", 'US' => "{name}\n{company}\n{address_1}\n{address_2}\n{city}, {state_code} {postcode}\n{country}", 'VN' => "{name}\n{company}\n{address_1}\n{city}\n{country}");
     $all_countries = wcj_get_countries();
     foreach ($all_countries as $country_code => $country_name) {
         if (!isset($formats[$country_code])) {
             $formats[$country_code] = $default;
         }
     }
     ksort($formats);
     return $formats;
 }
 /**
  * wcj_country_select_drop_down_list.
  *
  * @version 2.4.0
  */
 function wcj_country_select_drop_down_list($atts, $content)
 {
     $html = '';
     $form_method = $atts['form_method'];
     //get_option( 'wcj_price_by_country_country_selection_box_method', 'get' );
     $select_class = $atts['class'];
     //get_option( 'wcj_price_by_country_country_selection_box_class', '' );
     $select_style = $atts['style'];
     //get_option( 'wcj_price_by_country_country_selection_box_style', '' );
     $html .= '<form action="" method="' . $form_method . '">';
     $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">';
     $countries = wcj_get_countries();
     /* $shortcode_countries = get_option( 'wcj_price_by_country_shortcode_countries', array() );
     		if ( '' == $shortcode_countries ) $shortcode_countries = array(); */
     $shortcode_countries = $atts['countries'];
     if ('' == $shortcode_countries) {
         $shortcode_countries = array();
     } else {
         $shortcode_countries = str_replace(' ', '', $shortcode_countries);
         $shortcode_countries = trim($shortcode_countries, ',');
         $shortcode_countries = explode(',', $shortcode_countries);
     }
     /* if ( 'get' == $form_method ) {
     			$selected_country = ( isset( $_GET[ 'wcj-country' ] ) ) ? $_GET[ 'wcj-country' ] : '';
     		} else {
     			$selected_country = ( isset( $_POST[ 'wcj-country' ] ) ) ? $_POST[ 'wcj-country' ] : '';
     		} */
     $selected_country = isset($_SESSION['wcj-country']) ? $_SESSION['wcj-country'] : '';
     if (empty($shortcode_countries)) {
         foreach ($countries as $country_code => $country_name) {
             $html .= '<option value="' . $country_code . '" ' . selected($country_code, $selected_country, false) . '>' . $country_name . '</option>';
         }
     } else {
         foreach ($shortcode_countries as $country_code) {
             if (isset($countries[$country_code])) {
                 $html .= '<option value="' . $country_code . '" ' . selected($country_code, $selected_country, false) . '>' . $countries[$country_code] . '</option>';
             }
         }
     }
     $html .= '</select>';
     $html .= '</form>';
     return $html;
 }
 /**
  * get_settings.
  *
  * @version 2.5.8
  */
 function get_settings()
 {
     //		global $wcj_notice;
     $settings = array(array('title' => __('Price by Country Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('Change product\'s price and currency by customer\'s country. Customer\'s country is detected automatically by IP, or selected by customer manually.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_options'), array('title' => __('Customer Country Detection Method', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_customer_country_detection_method', 'desc' => __('If you choose "by user selection", use [wcj_country_select_drop_down_list] shortcode to display country selection list on frontend.', 'woocommerce-jetpack'), 'default' => 'by_ip', 'type' => 'select', 'options' => array('by_ip' => __('by IP', 'woocommerce-jetpack'), 'by_ip_then_by_user_selection' => __('by IP, then by user selection', 'woocommerce-jetpack'), 'by_user_selection' => __('by user selection', 'woocommerce-jetpack'))), array('title' => __('Override Country Options', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_override_on_checkout_with_billing_country', 'default' => 'no', 'type' => 'select', 'options' => array('no' => __('No Override', 'woocommerce-jetpack'), 'yes' => __('Override Country with Customer\'s Checkout Billing Country', 'woocommerce-jetpack'), 'shipping_country' => __('Override Country with Customer\'s Checkout Shipping Country', 'woocommerce-jetpack'))), array('title' => __('Revert Currency to Default on Checkout', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_revert', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Price Rounding', 'woocommerce-jetpack'), 'desc' => __('If you choose to multiply price, set rounding options here.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_rounding', 'default' => 'none', 'type' => 'select', 'options' => array('none' => __('No rounding', 'woocommerce-jetpack'), 'round' => __('Round', 'woocommerce-jetpack'), 'floor' => __('Round down', 'woocommerce-jetpack'), 'ceil' => __('Round up', 'woocommerce-jetpack'))), array('title' => __('Price by Country on per Product Basis', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => __('This will add product data fields in product edit.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_local_enabled', 'default' => 'yes', 'type' => 'checkbox'), array('title' => __('Price Filter Widget and Sorting by Price Support', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => '<a href="' . add_query_arg('recalculate_price_filter_products_prices', '1', remove_query_arg(array('wcj_generate_country_groups', 'wcj_generate_country_groups_confirm'))) . '">' . __('Recalculate price filter widget and sorting by price product prices', 'woocommerce-jetpack') . '</a>', 'id' => 'wcj_price_by_country_price_filter_widget_support_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Add Countries Flags Images to Select Drop-Down Box', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'desc_tip' => __('If you are using [wcj_country_select_drop_down_list] shortcode or "Booster: Country Switcher" widget, this will add country flags to these select boxes.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_jquery_wselect_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Search Engine Bots', 'woocommerce-jetpack'), 'desc' => __('Disable Price by Country for Bots', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_for_bots_disabled', 'default' => 'no', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_price_by_country_options'), array('title' => __('Country Groups', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_price_by_country_country_groups_options'), array('title' => __('Countries Selection', 'woocommerce-jetpack'), 'desc' => __('Choose how do you want to enter countries groups in admin.', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_selection', 'default' => 'chosen_select', 'type' => 'select', 'options' => array('comma_list' => __('Comma separated list', 'woocommerce-jetpack'), 'multiselect' => __('Multiselect', 'woocommerce-jetpack'), 'chosen_select' => __('Chosen select', 'woocommerce-jetpack'))), array('title' => __('Autogenerate Groups', 'woocommerce-jetpack'), 'id' => 'wcj_' . $this->id . '_module_tools', 'type' => 'custom_link', 'link' => '<pre>' . __('Currencies supported in both PayPal and Yahoo Exchange Rates:', 'woocommerce-jetpack') . ' ' . '<a href="' . add_query_arg('wcj_generate_country_groups', 'paypal_and_yahoo_exchange_rates_only', remove_query_arg(array('wcj_generate_country_groups_confirm', 'recalculate_price_filter_products_prices'))) . '">' . __('Generate', 'woocommerce-jetpack') . '</a>.' . '</pre>' . '<pre>' . __('Currencies supported in Yahoo Exchange Rates:', 'woocommerce-jetpack') . ' ' . '<a href="' . add_query_arg('wcj_generate_country_groups', 'yahoo_exchange_rates_only', remove_query_arg(array('wcj_generate_country_groups_confirm', 'recalculate_price_filter_products_prices'))) . '">' . __('Generate', 'woocommerce-jetpack') . '</a>.' . '</pre>' . '<pre>' . __('All Countries and Currencies:', 'woocommerce-jetpack') . ' ' . '<a href="' . add_query_arg('wcj_generate_country_groups', 'all', remove_query_arg(array('wcj_generate_country_groups_confirm', 'recalculate_price_filter_products_prices'))) . '">' . __('Generate', 'woocommerce-jetpack') . '</a>' . '</pre>'), array('title' => __('Groups Number', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_total_groups_number', 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => array_merge(is_array(apply_filters('booster_get_message', '', 'readonly')) ? apply_filters('booster_get_message', '', 'readonly') : array(), array('step' => '1', 'min' => '1')), 'css' => 'width:100px;'));
     for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) {
         switch (get_option('wcj_price_by_country_selection', 'comma_list')) {
             case 'comma_list':
                 $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://booster.io/features/prices-and-currencies-by-customers-country" target="_blank">http://booster.io</a>', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i, 'default' => '', 'type' => 'textarea', 'css' => 'width:50%;min-width:300px;height:100px;');
                 break;
             case 'multiselect':
                 $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'id' => 'wcj_price_by_country_countries_group_' . $i, 'default' => '', 'type' => 'multiselect', 'options' => wcj_get_countries(), 'css' => 'width:50%;min-width:300px;height:100px;');
                 break;
             case 'chosen_select':
                 $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'id' => 'wcj_price_by_country_countries_group_chosen_select_' . $i, 'default' => '', 'type' => 'multiselect', 'options' => wcj_get_countries(), 'class' => 'chosen_select', 'css' => 'width:50%;min-width:300px;');
                 break;
         }
         $settings[] = array('title' => '', 'desc' => __('Currency', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_currency_group_' . $i, 'default' => 'EUR', 'type' => 'select', 'options' => wcj_get_currencies_names_and_symbols());
     }
     $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_country_groups_options');
     $settings[] = array('title' => __('Exchange Rates', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_exchange_rate_options');
     $settings[] = array('title' => __('Exchange Rates Updates', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_auto_exchange_rates', 'default' => 'manual', 'type' => 'select', 'options' => array('manual' => __('Enter Rates Manually', 'woocommerce-jetpack'), 'auto' => __('Automatically via Currency Exchange Rates module', 'woocommerce-jetpack')), 'desc' => '' == apply_filters('booster_get_message', '', 'desc') ? __('Visit', 'woocommerce-jetpack') . ' <a href="' . admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=prices_and_currencies&section=currency_exchange_rates') . '">' . __('Currency Exchange Rates module', 'woocommerce-jetpack') . '</a>' : apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'disabled'));
     $currency_from = apply_filters('woocommerce_currency', get_option('woocommerce_currency'));
     for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) {
         $currency_to = get_option('wcj_price_by_country_exchange_rate_currency_group_' . $i);
         $custom_attributes = array('currency_from' => $currency_from, 'currency_to' => $currency_to, 'multiply_by_field_id' => 'wcj_price_by_country_exchange_rate_group_' . $i);
         if ($currency_from == $currency_to) {
             $custom_attributes['disabled'] = 'disabled';
         }
         $settings[] = array('title' => __('Group', 'woocommerce-jetpack') . ' #' . $i, 'desc' => __('Multiply Price by', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_exchange_rate_group_' . $i, 'default' => 1, 'type' => 'exchange_rate', 'css' => 'width:100px;', 'custom_attributes' => array('step' => '0.000001', 'min' => '0'), 'custom_attributes_button' => $custom_attributes, 'value' => $currency_from . '/' . $currency_to, 'value_title' => sprintf(__('Grab %s rate from Yahoo.com', 'woocommerce-jetpack'), $currency_from . '/' . $currency_to));
         /* $settings[] = array(
         				'title'    => '',
         				//'id'       => 'wcj_price_by_country_exchange_rate_refresh_group_' . $i,
         				'class'    => 'exchage_rate_button',
         				'type'     => 'custom_number',
         				'css'      => 'width:300px;',
         				'value'    => sprintf( __( '%s rate from Yahoo.com', 'woocommerce-jetpack' ),  $currency_from . '/' . $currency_to ),
         				'custom_attributes'	=> $custom_attributes,
         			); */
         $settings[] = array('title' => '', 'desc' => __('Make empty price', 'woocommerce-jetpack'), 'id' => 'wcj_price_by_country_make_empty_price_group_' . $i, 'default' => 'no', 'type' => 'checkbox');
     }
     $settings[] = array('type' => 'sectionend', 'id' => 'wcj_price_by_country_exchange_rate_options');
     /* $settings = array_merge( $settings, array(
     
     			array(
     				'title' => __( 'Country Select Box Customization', 'woocommerce-jetpack' ),
     				'type'  => 'title',
     				'desc'  => __( 'Only if "by user selection" method selected in "Customer Country Detection Method"', 'woocommerce-jetpack' ),
     				'id'    => 'wcj_price_by_country_country_selection_box_options',
     			),
     
     			array(
     				'title'    => __( 'Position', 'woocommerce-jetpack' ),
     				'id'       => 'wcj_price_by_country_country_selection_box_position',
     				'default'  => 'woocommerce_get_price_html',
     				'type'     => 'select',
     				'options'  => array(
     					'woocommerce_get_price_html' => __( 'woocommerce_get_price_html', 'woocommerce-jetpack' ),
     				),
     			),
     
     			array(
     				'title'    => __( 'Position Priority (Order)', 'woocommerce-jetpack' ),
     				'id'       => 'wcj_price_by_country_country_selection_box_priority',
     				'default'  => 10,
     				'type'     => 'number',
     			),
     
     			array(
     				'title'    => __( 'Custom Class', 'woocommerce-jetpack' ),
     				'id'       => 'wcj_price_by_country_country_selection_box_class',
     				'default'  => '',
     				'type'     => 'text',
     			),
     
     			array(
     				'title'    => __( 'Custom Style', 'woocommerce-jetpack' ),
     				'id'       => 'wcj_price_by_country_country_selection_box_style',
     				'default'  => '',
     				'type'     => 'text',
     			),
     
     			array(
     				'title'    => __( 'Method (GET/POST)', 'woocommerce-jetpack' ),
     				'id'       => 'wcj_price_by_country_country_selection_box_method',
     				'default'  => 'get',
     				'type'     => 'select',
     				'options'  => array(
     					'get'  => __( 'GET', 'woocommerce-jetpack' ),
     					'post' => __( 'POST', 'woocommerce-jetpack' ),
     				),
     			),
     
     			array(
     				'type' => 'sectionend',
     				'id'   => 'wcj_price_by_country_country_selection_box_options'
     			),
     		) ); */
     return $this->add_standard_settings($settings);
 }
 /**
  * get_meta_box_options.
  *
  * @version 2.5.0
  * @since   2.5.0
  */
 function get_meta_box_options()
 {
     $options = array(array('name' => 'wcj_product_by_country_visible', 'default' => '', 'type' => 'select', 'options' => wcj_get_countries(), 'multiple' => true, 'title' => __('Visible in Countries', 'woocommerce-jetpack')));
     return $options;
 }
 /**
  * wcj_country_select_drop_down_list.
  *
  * @version 2.5.9
  */
 function wcj_country_select_drop_down_list($atts, $content)
 {
     $html = '';
     $form_method = $atts['form_method'];
     // get_option( 'wcj_price_by_country_country_selection_box_method', 'get' );
     $select_class = $atts['class'];
     // get_option( 'wcj_price_by_country_country_selection_box_class', '' );
     $select_style = $atts['style'];
     // get_option( 'wcj_price_by_country_country_selection_box_style', '' );
     $html .= '<form action="" method="' . $form_method . '">';
     $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">';
     $countries = wcj_get_countries();
     /* $shortcode_countries = get_option( 'wcj_price_by_country_shortcode_countries', array() );
     		if ( '' == $shortcode_countries ) $shortcode_countries = array(); */
     $shortcode_countries = $atts['countries'];
     if ('' == $shortcode_countries) {
         $shortcode_countries = array();
     } else {
         $shortcode_countries = str_replace(' ', '', $shortcode_countries);
         $shortcode_countries = trim($shortcode_countries, ',');
         $shortcode_countries = explode(',', $shortcode_countries);
     }
     /* if ( 'get' == $form_method ) {
     			$selected_country = ( isset( $_GET[ 'wcj-country' ] ) ) ? $_GET[ 'wcj-country' ] : '';
     		} else {
     			$selected_country = ( isset( $_POST[ 'wcj-country' ] ) ) ? $_POST[ 'wcj-country' ] : '';
     		} */
     $selected_country = isset($_SESSION['wcj-country']) ? $_SESSION['wcj-country'] : '';
     if ('yes' === $atts['replace_with_currency']) {
         $currencies_names_and_symbols = wcj_get_currencies_names_and_symbols();
     }
     if (empty($shortcode_countries)) {
         foreach ($countries as $country_code => $country_name) {
             $data_icon = '';
             if ('yes' === get_option('wcj_price_by_country_jquery_wselect_enabled', 'no')) {
                 $data_icon = ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower($country_code) . '.png"';
             }
             $option_label = 'yes' === $atts['replace_with_currency'] ? $currencies_names_and_symbols[wcj_get_currency_by_country($country_code)] : $country_name;
             $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected($country_code, $selected_country, false) . '>' . $option_label . '</option>';
         }
     } else {
         foreach ($shortcode_countries as $country_code) {
             if (isset($countries[$country_code])) {
                 $data_icon = '';
                 if ('yes' === get_option('wcj_price_by_country_jquery_wselect_enabled', 'no')) {
                     $data_icon = ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower($country_code) . '.png"';
                 }
                 $option_label = 'yes' === $atts['replace_with_currency'] ? $currencies_names_and_symbols[wcj_get_currency_by_country($country_code)] : $countries[$country_code];
                 $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected($country_code, $selected_country, false) . '>' . $option_label . '</option>';
             }
         }
     }
     $html .= '</select>';
     $html .= '</form>';
     return $html;
 }
 /**
  * add_countries_settings.
  *
  * @version 2.4.4
  */
 function add_countries_settings($settings)
 {
     $settings = array();
     $settings[] = array('title' => __('Payment Gateways', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('Leave empty to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_payment_gateways_by_country_gateways_options');
     $countries = wcj_get_countries();
     $states = wcj_get_states();
     $gateways = WC()->payment_gateways->payment_gateways();
     foreach ($gateways as $key => $gateway) {
         $default_gateways = array('bacs');
         if (!empty($default_gateways) && !in_array($key, $default_gateways)) {
             $custom_attributes = apply_filters('booster_get_message', '', 'disabled');
             if ('' == $custom_attributes) {
                 $custom_attributes = array();
             }
             $desc_tip = apply_filters('booster_get_message', '', 'desc_no_link');
         } else {
             $custom_attributes = array();
             $desc_tip = '';
         }
         $settings[] = array('title' => $gateway->title, 'desc_tip' => $desc_tip, 'desc' => __('Include Countries', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_countries_include_' . $key, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $countries, 'custom_attributes' => $custom_attributes);
         $settings[] = array('title' => '', 'desc_tip' => $desc_tip, 'desc' => __('Exclude Countries', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_countries_exclude_' . $key, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $countries, 'custom_attributes' => $custom_attributes);
         $settings[] = array('title' => '', 'desc_tip' => $desc_tip, 'desc' => __('Include States (Base Country)', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_states_include_' . $key, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $states, 'custom_attributes' => $custom_attributes);
         $settings[] = array('title' => '', 'desc_tip' => $desc_tip, 'desc' => __('Exclude States (Base Country)', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_states_exclude_' . $key, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $states, 'custom_attributes' => $custom_attributes);
     }
     $settings[] = array('type' => 'sectionend', 'id' => 'wcj_payment_gateways_by_country_gateways_options');
     return $settings;
 }