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
/** | |
* Example : Validate specific actions of admin-ajax.php at front-end | |
* Use case: Give permission to ajax with specific action at public facing page | |
* | |
* @global array $_GET and $_POST requested queries | |
* @param array $queries array of admin queries which should bypass WP-ZEP. | |
* @return array $queries array of admin queries which should bypass WP-ZEP. | |
*/ | |
function my_bypass_admins( $queries ) { | |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) ) { |
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
/** | |
* SQL Error handling | |
* | |
*/ | |
private static function error( $line ) { | |
if ( class_exists( 'IP_Geo_Block_Admin' ) ) { | |
global $wpdb; | |
if ( $wpdb->last_error ) | |
IP_Geo_Block_Admin::add_admin_notice( 'error', __FILE__ . ' (' . $line . ') ' . $wpdb->last_error ); | |
} |
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
// pattern 1 | |
if( has_filter( 'ip-geo-block-bypass-themes', 'my_bypass_themes' ) === false ) { | |
add_filter( 'ip-geo-block-bypass-themes', 'my_bypass_themes' ); | |
} | |
function my_bypass_themes( $themes ) { | |
$whitelist = array( 'twentytwelve', ); | |
return array_merge( $themes, $whitelist ); | |
} | |
// pattern 2 |
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 | |
if ( class_exists( 'IP_Geo_Block_API', FALSE ) ) : | |
/** | |
* Class for CloudFlare | |
* | |
* @see https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers- | |
* @see https://support.cloudflare.com/hc/en-us/articles/200170856-How-do-I-restore-original-visitor-IP-with-vBulletin- | |
* @see https://support.cloudflare.com/hc/en-us/articles/200168236-What-does-CloudFlare-IP-Geolocation-do- |
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 | |
if ( class_exists( 'IP_Geo_Block_API', FALSE ) ) : | |
/** | |
* Class for CloudFront | |
* | |
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/georestrictions.html | |
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#RequestCustomIPAddresses | |
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#request-custom-headers-behavior |
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 | |
/** | |
* Add GravityView actions to IP Geoblock whitelist | |
* | |
*/ | |
function gravityview_ip_geoblock_bypass_admins( $queries ) { | |
$whitelist = array( | |
'gv_datatables_data', |
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 | |
/** | |
* Add action for like button of theme 'belle' to IP Geo Block whitelist | |
* | |
* @link http://themecanon.com/belle/ | |
*/ | |
function my_ip_geo_block_bypass_admins( $list ) { | |
$whitelist = array( | |
'like_post', |
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 | |
/** | |
* Fired when the plugin is uninstalled. | |
* | |
* @package IP_Geo_Block | |
* @author tokkonopapa <[email protected]> | |
* @license GPL-2.0+ | |
* @link http://www.ipgeoblock.com/ | |
* @copyright 2013-2017 tokkonopapa | |
*/ |
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 | |
/** | |
* Example 2: Usage of 'ip-geo-block-ip-addr' | |
* Use case: Retrieve ip address behind the proxy | |
* | |
* @param string $ip original ip address | |
* @return string $ip replaced ip address | |
*/ | |
function my_retrieve_ip( $ip ) { | |
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
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 http://www.ipgeoblock.com/ |