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 | |
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
// 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
/** | |
* 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
/** | |
* 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
{ | |
"ip_geo_block_settings[version]": "3.0.0", | |
"ip_geo_block_settings[matching_rule]": "0", | |
"ip_geo_block_settings[white_list]": "JP", | |
"ip_geo_block_settings[black_list]": "ZZ", | |
"ip_geo_block_settings[extra_ips][white_list]": "192.0.64.0/18\n69.46.32.0/20", | |
"ip_geo_block_settings[extra_ips][black_list]": "", | |
"ip_geo_block_settings[signature]": "../,/wp-config.php,/passwd\ncurl,wget,eval,base64\nselect:.5,where:.5,union:.5\nload_file:.5,create:.6,password:.4", | |
"ip_geo_block_settings[response_code]": "403", | |
"ip_geo_block_settings[login_fails]": "5", |
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
{ | |
"ip_geo_block_settings[validation][public]": "1", | |
"ip_geo_block_settings[public][matching_rule]": "0", | |
"ip_geo_block_settings[public][white_list]": "", | |
"ip_geo_block_settings[public][black_list]": "ZZ", | |
"ip_geo_block_settings[public][ua_list]": "*#23.96.0.0/16\n*#HOST=amazonaws.com\n*#45.55.128.0/18", | |
"ip_geo_block_settings[public][advanced_cache]": "", | |
"ip_geo_block_settings[public][simulate]": "1" | |
} |
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 |
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
/*! Simple Ajax only for JSONP | |
* | |
* var args = { | |
* key: 'my-key', | |
* format: 'json' | |
* }; | |
* myAjax.get('http://example.com/', args, | |
* function (response) { | |
* for (var key in response) { | |
* // key, response[key] |
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
/** | |
* WPtouch switch for Quick Cache | |
* - WPtouch 1.9.6.1 | |
* - Ktai Style 2.0.5 | |
* - Quick Cache 111203 | |
* | |
* Quick Cache MD5 Version Salt (smartphone, featurephone) | |
* ((preg_match("{AdsBot-Google|Android|BB10|BlackBerry 9350|BlackBerry 9360|BlackBerry 9370|BlackBerry 9380|BlackBerry 9780|BlackBerry 9790|BlackBerry 9800|BlackBerry 9810|BlackBerry 9850|BlackBerry 9860|BlackBerry 9900|BlackBerry 9930|BlackBerry9500|BlackBerry9520|BlackBerry9530|BlackBerry9550|CUPCAKE|Googlebot-Mobile|bada|dream|froyo|iPhone|iPod|incognito|s8000|webOS|webmate}", $_SERVER["HTTP_USER_AGENT"])) && $_COOKIE["wptouch_switch_toggle"] != "normal" ? "smartphone" : ((preg_match("{DoCoMo/|J-PHONE/|J-EMULATOR/|Vodafone/|MOT(EMULATOR)?-|SoftBank/|[VS]emulator/|KDDI-|UP\.Browser/|emobile/|Huawei/|IAC/|Nokia|mixi-mobile-converter/|DDIPOCKET;|WILLCOM;|Opera Mini|Opera Mobi|PalmOS|Windows CE;|PDA; SL-|PlayStation Portable;|SONY/COM|Nitro|Nintendo}", $_SERVER["HTTP_USER_AGENT"])) ? "featurephone" : "")) | |
* | |
* @todo add this program to theme fu |