= preg_replace("/iPd([0-9],[0-9])/", 'iPod\\1', $model);
$device = new Device([
'type' => Constants\DeviceType::MOBILE,
'identified' => Constants\Id::NONE,
'manufacturer' => null,
'model' => $model,
'identifier' => $original,
'generic' => false
]);
if (isset(self::$IOS_MODELS[$model])) {
$match = self::$IOS_MODELS[$model];
$device->manufacturer = $match[0];
$device->model = $match[1];
$device->identified = Constants\Id::MATCH_UA;
if (isset($match[2]) || isset($match['type'])) {
$type = isset($match[2]) ? $match[2] : $match['type'];
$device->type = $type;
}
return $device;
}
return $device;
}
public static function identifyBlackBerry($model)
{
$original = $model;
if (preg_match("/BlackBerry ?([0-9]+)/ui", $model, $match)) {
$model = $match[1];
}
$device = new Device([
'type' => Constants\DeviceType::MOBILE,
'identified' => Constants\Id::NONE,
'manufacturer' => null,
'model' => $model,
'identifier' => $original,
'generic' => false
]);
if (preg_match("/^[1-9][0-9][0-9][0-9][ei]?$/u", $model)) {
$device->manufacturer = 'RIM';
$device->model = 'BlackBerry ' . $model;
$device->identified = Constants\Id::PATTERN;
if (isset(self::$BLACKBERRY_MODELS[$model])) {
$device->model = 'BlackBerry ' . self::$BLACKBERRY_MODELS[$model] . ' ' . $model;
$device->identified |= Constants\Id::MATCH_UA;
}
}
return $device;
}
public static function identifyAndroid($model)
{
$result = self::identifyList(self::$ANDROID_INDEX, self::$ANDROID_MODELS, $model);
if (!$result->identified) {
$model = self::cleanup($model);
if (preg_match('/AndroVM/iu', $model) || $model == 'Emulator' || $model == 'x86 Emulator' || $model == 'x86 VirtualBox' || $model == 'vm') {
return new Device([
'type' => Constants\DeviceType::EMULATOR,
'identified' => Constants\Id::PATTERN,
'manufacturer' => null,
'model' => null,
'generic' => false
]);
}
}
return $result;
}
public static function identifyList(&$index, &$list, $model, $cleanup = true)
{
$original = $model;
if ($cleanup) {
$model = self::cleanup($model);
}
$device = new Device([
'type' => Constants\DeviceType::MOBILE,
'identified' => Constants\Id::NONE,
'manufacturer' => null,
'model' => $model,
'identifier' => $original,
'generic' => false
]);
$keys = [ '@' . strtoupper(substr($model, 0, 2)), '@' ];
$pattern = null;
$match = null;
foreach ($keys as $k => $key) {
if (isset($index[$key])) {
foreach ($index[$key] as $m => $v) {
if (self::hasMatch($v, $model)) {
if ($v) {
if (substr($v, -2) == "!!") {
foreach ($list[$v] as $m2 => $v2) {
if (self::hasMatch($m2, $model)) {
$match = $v2;
$pattern = $m2;
break;
}
}
} else {
$match = $list[$v];
$pattern = $v;
}
}
if ($match) {
$device->manufacturer = $match[0];
$device->model = self::applyMatches($match[1], $model, $pattern);
$device->identified = Constants\Id::MATCH_UA;
if (isset($match[2]) || isset($match['type'])) {
$type = isset($match[2]) ? $match[2] : $match['type'];
if (is_array($type)) {
$device->type = $type[0];
$device->subtype = $type[1];
} else {
$device->type = $type;
}
}
if (isset($match[3]) || isset($match['flag'])) {
$device->flag = isset($match[3]) ? $match[3] : $match['flag'];
}
if (isset($match['carrier'])) {
$device->carrier = $match['carrier'];
}
if ($device->manufacturer == null && $device->model == null) {
$device->identified = Constants\Id::PATTERN;
}
return $device;
}
}
}
}
}
return $device;
}
public static function applyMatches($model, $original, $pattern)
{
if (strpos($model, '$') !== false && substr($pattern, -1) == "!") {
if (preg_match('/^' . substr($pattern, 0, -1) . '/iu', $original, $matches)) {
foreach ($matches as $k => $v) {
$model = str_replace('$' . $k, $v, $model);
}
}
}
return $model;
}
public static function hasMatch($pattern, $model)
{
if (substr($pattern, -2) == "!!") {
return !! preg_match('/^' . substr($pattern, 0, -2) . '/iu', $model);
} elseif (substr($pattern, -1) == "!") {
return !! preg_match('/^' . substr($pattern, 0, -1) . '/iu', $model);
} else {
return strtolower($pattern) == strtolower($model);
}
}
public static function cleanup($s = '')
{
// var_dump($s);
$s = preg_replace('/^phone\//', '', $s);
$s = preg_replace('/^(\/|; |;)/u', '', $s);
$s = preg_replace('/\/[^\/]+$/u', '', $s);
$s = preg_replace('/\/[^\/]+ Android\/.*/u', '', $s);
$s = preg_replace('/UCBrowser$/u', '', $s);
$s = preg_replace('/(_TD-LTE|_TD|_LTE|_GPRS|_BLEU|_CMCC|_CMCC_TD|_CUCC)$/u', '', $s);
$s = preg_replace('/(-BREW| MIDP).+$/u', '', $s);
$s = preg_replace('/ AU-MIC.+$/u', '', $s);
$s = preg_replace('/ (AU|UP)\.Browser$/u', '', $s);
$s = preg_replace('/_/u', ' ', $s);
$s = preg_replace('/^\*+/u', '', $s);
$s = preg_replace('/^\s+|\s+$/u', '', $s);
$s = preg_replace('/^De-Sensed /u', '', $s);
$s = preg_replace('/^Full JellyBean( on )?/u', '', $s);
$s = preg_replace('/^(Android|Generic Android|Baidu Yi|Buildroid|Gingerbread|ICS AOSP|AOSPA?|tita) (on |for )/u', '', $s);
$s = preg_replace('/^Full (AOSP on |Android on |Base for |Cappuccino on |MIPS Android on |Webdroid on |JellyBean on |Android)/u', '', $s);
$s = preg_replace('/^Acer( |-)?/iu', '', $s);
$s = preg_replace('/^Iconia( Tab)? /u', '', $s);
$s = preg_replace('/^ASUS ?/u', '', $s);
$s = preg_replace('/^Ainol /u', '', $s);
$s = preg_replace('/^Coolpad-?Coolpad/iu', 'Coolpad', $s);
$s = preg_replace('/^Coolpad ?/iu', 'Coolpad ', $s);
$s = preg_replace('/^Alcatel[_ ]OT[_-](.*)/iu', 'One Touch $1', $s);
$s = preg_replace('/^ALCATEL /u', '', $s);
$s = preg_replace('/^YL-/u', '', $s);
$s = preg_replace('/^TY-K[_\- ]Touch/iu', 'K-Touch', $s);
$s = preg_replace('/^K-Touch[_\-]/u', 'K-Touch ', $s);
$s = preg_replace('/^Novo7 ?/iu', 'Novo7 ', $s);
$s = preg_replace('/^HW-HUAWEI/u', 'HUAWEI', $s);
$s = preg_replace('/^Huawei[ -]/iu', 'Huawei ', $s);
$s = preg_replace('/^SAMSUNG SAMSUNG-/iu', '', $s);
$s = preg_replace('/^SAMSUNG[ -]/iu', '', $s);
$s = preg_replace('/^(Sony ?Ericsson|Sony)/u', '', $s);
$s = preg_replace('/^(Lenovo Lenovo|LNV-Lenovo|LENOVO-Lenovo)/u', 'Lenovo', $s);
$s = preg_replace('/^Lenovo-/u', 'Lenovo', $s);
$s = preg_replace('/^Lenovo/u', 'Lenovo ', $s);
$s = preg_replace('/^ZTE-/u', 'ZTE ', $s);
$s = preg_replace('/^(LG)[ _\/]/u', '$1-', $s);
$s = preg_replace('/^(HTC.+)\s[v|V][0-9.]+$/u', '$1', $s);
$s = preg_replace('/^(HTC)[-\/]/u', '$1 ', $s);
$s = preg_replace('/^(HTC)([A-Z][0-9][0-9][0-9])/u', '$1 $2', $s);
$s = preg_replace('/^(Motorola MOT-|MOT-|Motorola[\s|-])/u', '', $s);
$s = preg_replace('/^Moto([^\s])/u', '$1', $s);
$s = preg_replace('/^(UTStar-)/u', '', $s);
$s = preg_replace('/^VZW:/iu', '', $s);
$s = preg_replace('/^(Swisscom|Vodafone)\/1.0\//iu', '', $s);
$s = preg_replace('/-?(orange(-ls)?|vodafone|bouygues|parrot|Kust)$/iu', '', $s);
$s = preg_replace('/[ -](Mozilla|Opera|Obigo|Java|PPC)$/iu', '', $s);
$s = preg_replace('/ ?Build$/iu', '', $s);
$s = preg_replace('/ \(compatible$/iu', '', $s);
$s = preg_replace('/http:\/\/.+$/iu', '', $s);
$s = preg_replace('/^\s+|\s+$/u', '', $s);
$s = preg_replace('/\s+/u', ' ', $s);
return $s;
}
}
Fatal error: Uncaught Error: Class 'WhichBrowser\Data\DeviceModels' not found in /home/payon/public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Analyser/Header/Useragent/Device/Mobile.php:1230
Stack trace:
#0 /home/payon/public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Analyser/Header/Useragent/Device/Mobile.php(1144): WhichBrowser\Analyser\Header\Useragent->identifyBasedOnIdUsingOs('+claudebot@anth...')
#1 /home/payon/public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Analyser/Header/Useragent/Device/Mobile.php(27): WhichBrowser\Analyser\Header\Useragent->detectGenericMobileLocations('Mozilla/5.0 App...')
#2 /home/payon/public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Analyser/Header/Useragent/Device.php(25): WhichBrowser\Analyser\Header\Useragent->detectMobile('Mozilla/5.0 App...')
#3 /home/payon/public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/An in /home/payon/public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Analyser/Header/Useragent/Device/Mobile.php on line 1230