18 public function validate($aIP, $config, $context)
27 $blk =
'(?:' . $hex .
'{1,4})';
28 $pre =
'(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))';
31 if (strpos($aIP,
'/') !==
false) {
32 if (preg_match(
'#' . $pre .
'$#s', $aIP, $find)) {
33 $aIP = substr($aIP, 0, 0 - strlen($find[0]));
41 if (preg_match(
'#(?<=:' .
')' . $this->ip4 .
'$#s', $aIP, $find)) {
42 $aIP = substr($aIP, 0, 0 - strlen($find[0]));
43 $ip = explode(
'.', $find[0]);
44 $ip = array_map(
'dechex', $ip);
45 $aIP .= $ip[0] . $ip[1] .
':' . $ip[2] . $ip[3];
50 $aIP = explode(
'::', $aIP);
55 list($first, $second) = $aIP;
56 $first = explode(
':', $first);
57 $second = explode(
':', $second);
59 if (count($first) + count($second) > 8) {
63 while (count($first) < 8) {
64 array_push($first,
'0');
67 array_splice($first, 8 - count($second), 8, $second);
69 unset($first, $second);
71 $aIP = explode(
':', $aIP[0]);
80 foreach ($aIP as $piece) {
81 if (!preg_match(
'#^[0-9a-fA-F]{4}$#s', sprintf(
'%04s', $piece))) {