Put the ip-matching function in a private function
This commit is contained in:
parent
89bdc92451
commit
502bb5fa15
|
@ -112,8 +112,8 @@ class TrafficLimiter extends AbstractPersistence
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @static
|
* @static
|
||||||
* @param string $algo
|
* @param string $ipRange
|
||||||
* @return string
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private static function matchIp($ipRange = null)
|
private static function matchIp($ipRange = null)
|
||||||
{
|
{
|
||||||
|
@ -156,13 +156,12 @@ class TrafficLimiter extends AbstractPersistence
|
||||||
if (self::$_limit < 1) {
|
if (self::$_limit < 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
error_reporting(-1);
|
|
||||||
// Check if $_ipKey is exempted from ratelimiting
|
// Check if $_ipKey is exempted from ratelimiting
|
||||||
if (!is_null(self::$_exemptedIp)) {
|
if (!is_null(self::$_exemptedIp)) {
|
||||||
$exIp_array = explode(',', self::$_exemptedIp);
|
$exIp_array = explode(',', self::$_exemptedIp);
|
||||||
foreach ($exIp_array as $ipRange) {
|
foreach ($exIp_array as $ipRange) {
|
||||||
if (self::matchIp($ipRange) === true)
|
if (self::matchIp($ipRange) === true) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue