/** * Sets tfls data form country. * * @access public * * @param mixed $country */ public function set_country($country) { $this->_data = array(); foreach (TFLS()->get_regions() as $key => $group_data) { if (in_array($country, $group_data['countries'])) { $this->_data = array_merge($group_data, array('group_key' => $key, 'timestamp' => time())); break; } } $this->_changed = true; }
/** * Output manual country select form */ public function country_select() { $all_countries = WC()->countries->get_countries(); $base_country = wc_get_base_location(); $countries[$base_country['country']] = $all_countries[$base_country['country']]; foreach (TFLS()->get_regions() as $region) { foreach ($region['countries'] as $country) { if (!array_key_exists($country, $countries)) { $countries[$country] = $all_countries[$country]; } } } asort($countries); $other_country = key(array_diff_key($all_countries, $countries)); $countries[$other_country] = apply_filters('tfls_other_countries_text', __('Other countries')); wc_get_template('country-selector.php', array('countries' => $countries), 'woocommerce-the-fairy-light-shop/', untrailingslashit(plugin_dir_path(TFLS_FILE)) . '/templates/'); }
$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); return preg_match("/googlebot|adsbot|yahooseeker|yahoobot|msnbot|watchmouse|pingdom\\.com|feedfetcher-google/", $user_agent); } } } // End class /** * Returns the main instance of WC_Fairy_Light_Shop so as to avoid the need to use globals. * * @return WC_Fairy_Light_Shop */ function TFLS() { return WC_Fairy_Light_Shop::instance(); } $wc_the_fairy_light_shop = TFLS(); } // ! class_exists ( 'WC_The_Fairy_Light_Shop' ) } else { add_action('admin_init', 'oga_tfls_deactivate'); function oga_tfls_deactivate() { deactivate_plugins(plugin_basename(__FILE__)); } add_action('admin_notices', 'oga_tfls_no_woocommerce_admin_notice'); function oga_tfls_no_woocommerce_admin_notice() { ?> <div class="updated"> <p><strong>The Fairy Light Shop Site Plugin </strong>has been deactivated because <a href="http://woothemes.com/">Woocommerce plugin</a> is required</p>