Last active
July 31, 2020 10:26
-
-
Save paulgoodchild/62b22752bd7246b1000d74f7f3584929 to your computer and use it in GitHub Desktop.
Check Is The Current Visitor IP WhiteListed?
This file contains 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 | |
/** | |
* Both of these functions return a boolean (true|false) on whether the current visitor | |
* IP address is whitelisted. | |
* | |
* Be sure to use the most appropriate, depending on your Shield version. | |
*/ | |
if ( class_exists( '\FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller' ) ) { | |
// Shield up to version 9.1.0 | |
$is_whitelisted = \FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller::GetInstance() | |
->getModule_IPs() | |
->isVisitorWhitelisted(); | |
// Shield version 9.1.1+ | |
$is_whitelisted = \FernleafSystems\Wordpress\Plugin\Shield\Helpers\QuickAccess::IsRequestWhiteListed(); | |
} | |
else { | |
$is_whitelisted = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment