Jetpack_Protect_Module::ip_is_whitelisted PHP Method

ip_is_whitelisted() public method

* Checks if the IP address has been whitelisted
public ip_is_whitelisted ( $ip )
$ip
    function ip_is_whitelisted($ip)
    {
        // If we found an exact match in wp-config
        if (defined('JETPACK_IP_ADDRESS_OK') && JETPACK_IP_ADDRESS_OK == $ip) {
            return true;
        }
        $whitelist = jetpack_protect_get_local_whitelist();
        if (is_multisite()) {
            $whitelist = array_merge($whitelist, get_site_option('jetpack_protect_global_whitelist', array()));
        }
        if (!empty($whitelist)) {
            foreach ($whitelist as $item) {
                // If the IPs are an exact match
                if (!$item->range && isset($item->ip_address) && $item->ip_address == $ip) {
                    return true;
                }
                if ($item->range && isset($item->range_low) && isset($item->range_high)) {
                    if (jetpack_protect_ip_address_is_in_range($ip, $item->range_low, $item->range_high)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }