170 $ip = trim((
string) $ip);
172 if ($ip ===
'' || strtolower($ip) ===
'unknown') {
176 if (str_starts_with($ip,
'[')) {
177 $end = strpos($ip,
']');
178 if ($end !==
false) {
179 $ip = substr($ip, 1, $end - 1);
181 } elseif (substr_count($ip,
':') === 1 && preg_match(
'/^([0-9.]+):[0-9]+$/', $ip, $m)) {
186 if ($ip ===
'::1' || $ip ===
'0:0:0:0:0:0:0:1') {
191 if (preg_match(
'/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i', $ip, $m)) {
195 return filter_var($ip, FILTER_VALIDATE_IP) ? $ip :
'';
404 if (preg_match(
'/iphone/i', $this->_agent)) $this->_platform =
"IPHONE";
405 elseif (preg_match(
'/ipad/i', $this->_agent)) $this->_platform =
"IPAD";
406 elseif (preg_match(
'/android/i', $this->_agent)) $this->_platform =
"ANDROID";
407 elseif (preg_match(
'/win/i', $this->_agent)) $this->_platform =
"WINDOWS";
408 elseif (preg_match(
'/mac/i', $this->_agent)) $this->_platform =
"APPLE";
409 elseif (preg_match(
'/linux/i', $this->_agent)) $this->_platform =
"LINUX";