PluginProbe
The WP Remote WordPress Plugin / 4.76
The WP Remote WordPress Plugin v4.76
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
wpremote / protect / prepend / ipstore.php

ipstore.php in The WP Remote WordPress Plugin 4.76, at protect/prepend/ipstore.php

49 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('MCDATAPATH')) exit;
3
4 if (!class_exists('BVPrependIPStore')) :
5 class BVPrependIPStore {
6 public $whitelistedIPs;
7 public $blacklistedIPs;
8
9 #TYPE
10 const BLACKLISTED = 1;
11 const WHITELISTED = 2;
12
13 #CATEGORY
14 const FW = 3;
15
16 function __construct($confHash) {
17 $this->whitelistedIPs = array_key_exists('whitelisted', $confHash) ? $confHash['whitelisted'] : array();
18 $this->blacklistedIPs = array_key_exists('blacklisted', $confHash) ? $confHash['blacklisted'] : array();
19 }
20
21 public function isFWIPBlacklisted($ip) {
22 return $this->checkIPPresent($ip, BVPrependIPStore::BLACKLISTED);
23 }
24
25 public function isFWIPWhitelisted($ip) {
26 return $this->checkIPPresent($ip, BVPrependIPStore::WHITELISTED);
27 }
28
29 public function checkIPPresent($ip, $type) {
30 $flag = false;
31
32 switch($type) {
33
34 case BVPrependIPStore::BLACKLISTED:
35 if (isset($this->blacklistedIPs[$ip]))
36 $flag = true;
37 break;
38
39 case BVPrependIPStore::WHITELISTED:
40 if (isset($this->whitelistedIPs[$ip]))
41 $flag = true;
42 break;
43 }
44
45 return $flag;
46 }
47
48 }
49 endif;