Created
July 15, 2015 12:07
-
-
Save tokkonopapa/c16fe2dfe31e28b092ce to your computer and use it in GitHub Desktop.
IP Geo Block Emergency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* IP Geo Block | |
* | |
* A WordPress plugin that blocks undesired access based on geolocation of IP address. | |
* | |
* @package IP_Geo_Block | |
* @author tokkonopapa <[email protected]> | |
* @license GPL-2.0+ | |
* @link https://github.com/tokkonopapa | |
* @copyright 2013-2015 tokkonopapa | |
* | |
* Plugin Name: IP Geo Block | |
* Plugin URI: http://wordpress.org/plugins/ip-geo-block/ | |
* Description: It blocks any spams, login attempts and malicious access to the admin area posted from outside your nation, and also prevents zero-day exploit. | |
* Version: 2.1.1 | |
* Author: tokkonopapa | |
* Author URI: https://github.com/tokkonopapa/WordPress-IP-Geo-Block | |
* Text Domain: ip-geo-block | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | |
* Domain Path: /languages | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} | |
/*----------------------------------------------------------------------------* | |
* Global definition | |
*----------------------------------------------------------------------------*/ | |
define( 'IP_GEO_BLOCK_PATH', plugin_dir_path( __FILE__ ) ); // @since 2.8 | |
define( 'IP_GEO_BLOCK_BASE', plugin_basename( __FILE__ ) ); // @since 1.5 | |
/*----------------------------------------------------------------------------* | |
* Public-Facing Functionality | |
*----------------------------------------------------------------------------*/ | |
/** | |
* Load class | |
* | |
*/ | |
require_once( IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block.php' ); | |
/** | |
* Register hooks that are fired when the plugin is activated or deactivated. | |
* When the plugin is deleted, the uninstall.php file is loaded. | |
*/ | |
register_activation_hook( __FILE__, array( 'IP_Geo_Block', 'activate' ) ); | |
register_deactivation_hook( __FILE__, array( 'IP_Geo_Block', 'deactivate' ) ); | |
/** | |
* Instantiate class | |
* | |
*/ | |
add_action( 'plugins_loaded', array( 'IP_Geo_Block', 'get_instance' ) ); | |
/*----------------------------------------------------------------------------* | |
* Dashboard and Administrative Functionality | |
*----------------------------------------------------------------------------*/ | |
/** | |
* Load class in case of wp-admin/*.php | |
* | |
*/ | |
if ( is_admin() ) { | |
require_once( IP_GEO_BLOCK_PATH . 'admin/class-ip-geo-block-admin.php' ); | |
add_action( 'plugins_loaded', array( 'IP_Geo_Block_Admin', 'get_instance' ) ); | |
} | |
/** | |
* When an emergency of yourself being locked out | |
* | |
*/ | |
function ip_geo_block_emergency( $validate ) { | |
$validate['result'] = 'passed'; | |
return $validate; | |
} | |
add_filter( 'ip-geo-block-login', 'ip_geo_block_emergency' ); | |
add_filter( 'ip-geo-block-admin', 'ip_geo_block_emergency' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Substitute the original
ip-geo-block.php
to this file by FTP when you are banned out.