get_current_url())) { $my_country = admin_block_country_get_country_from_ip($_SERVER['REMOTE_ADDR']); if ($my_country != "") { foreach(admin_block_country_current_countries_blocked() as $country) { if ($country == $my_country) { exit; } } } } } add_action( 'admin_init', 'AdminBlockCountry\register_admin_block_country_settings' ); function register_admin_block_country_settings() { register_setting( 'admin-block-country-settings-group', 'admin_block_country_list' ); register_setting( 'admin-block-country-settings-group', 'admin_block_country_method' ); } add_action('admin_menu', 'AdminBlockCountry\register_admin_block_country_page'); function register_admin_block_country_page() { add_menu_page('Block Country', 'Block Country', 'manage_options', 'admin-block-country/admin-block-country.php', 'AdminBlockCountry\admin_block_country_initial_page'); } function admin_block_country_initial_page() { $abcTom = new ABCTomM8(); wp_register_script("admin_block_countries", plugins_url("/js/application.js", __FILE__)); wp_enqueue_script("admin_block_countries"); wp_register_style("admin_block_countries", plugins_url("/css/style.css", __FILE__)); wp_enqueue_style("admin_block_countries"); if (isset($_POST["action"]) && sanitize_text_field($_POST["action"]) == "Upload") { $abc_verify_upload = wp_verify_nonce($_REQUEST["_wpnonce"], "abc-upload-abc"); $allowedExts = array("dat"); $temp = explode(".", $_FILES["block_country_upload_file"]["name"][0]); $extension = end($temp); if ($abc_verify_upload && $_FILES["block_country_upload_file"]["name"][0] == "GeoLiteCity.dat" && in_array($extension, $allowedExts)) { move_uploaded_file($_FILES["block_country_upload_file"]["tmp_name"][0], ABSPATH."/wp-content/uploads/".$_FILES["block_country_upload_file"]["name"][0]); echo("

Upload was a success.

"); } else { echo("

Invalid upload, can only upload GeoLityCity.dat file.

"); } } else if (isset($_POST["action"]) && sanitize_text_field($_POST["action"]) == "Update") { update_option("admin_block_country_method", sanitize_text_field($_POST["block_country_method"])); echo("

Service Updated

"); } else if (isset($_POST["action"]) && sanitize_text_field($_POST["action"]) == "Block") { update_option("admin_block_country_list", $abcTom->get_query_string_value("block_countries")); echo("

Admin Block Was Successful.

"); } foreach(admin_block_country_current_countries_blocked() as $country) { $i=0; foreach(admin_block_country_checkbox_list() as $key => $value) { if (str_replace(" ", "", $key) == str_replace(" ", "", $country)) { $_POST["block_countries_".$i] = sanitize_text_field($country); } $i++; } } ?>
add_form_field(null, "radio", "IP to Country Service", "block_country_method", "block_country_method", array(), "p", array("class" => "radio"), "3" => "Use marketingmix IP to Country service - http://ipcountry.marketingmix.com.au", "4" => "Use utrace IP to Country service - http://xml.utrace.de")); ?>

Please choose which countries you wish to exclude from accessing the admin site.

You cannot block your own country, for your own protection. has been taken off the list.

add_form_field(null, "checkbox", "Block Countries", "block_countries", "block_countries", array(), "p", array("class" => "checkbox"), admin_block_country_checkbox_list()); ?>

add_social_share_links("http://wordpress.org/extend/plugins/admin-block-country/"); } function admin_block_country_current_countries_blocked() { return explode(" ", esc_html(get_option("admin_block_country_list"))); } function admin_block_country_checkbox_list() { global $geoipcountry; $first = array("select_all" => "Select All"); $my_country = admin_block_country_get_country_from_ip($_SERVER['REMOTE_ADDR']); $countries = array_merge($first, $geoipcountry); unset($countries[$my_country]); return $countries; } ?>