本文整理汇总了PHP中DeviceModels::cleanup方法的典型用法代码示例。如果您正苦于以下问题:PHP DeviceModels::cleanup方法的具体用法?PHP DeviceModels::cleanup怎么用?PHP DeviceModels::cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceModels
的用法示例。
在下文中一共展示了DeviceModels::cleanup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: identifyList
static function identifyList($list, $model, $cleanup = true)
{
$original = $model;
if ($cleanup) {
$model = DeviceModels::cleanup($model);
}
$device = (object) array('type' => TYPE_MOBILE, 'identified' => ID_NONE, 'manufacturer' => null, 'model' => $model, 'identifier' => $original, 'generic' => false);
foreach ($list as $m => $v) {
$match = false;
if (substr($m, -1) == "!") {
$match = preg_match('/^' . substr($m, 0, -1) . '/iu', $model);
} else {
$match = strtolower($m) == strtolower($model);
}
if ($match) {
$device->manufacturer = $v[0];
$device->model = $v[1];
if (isset($v[2])) {
$device->type = $v[2];
}
if (isset($v[3])) {
$device->flag = $v[3];
}
$device->identified = ID_MATCH_UA;
if ($device->manufacturer == null && $device->model == null) {
$device->identified = ID_PATTERN;
}
return $device;
}
}
return $device;
}
示例2: identifyList
static function identifyList($list, $model, $cleanup = true)
{
$original = $model;
if ($cleanup) {
$model = DeviceModels::cleanup($model);
}
$device = (object) array('type' => TYPE_MOBILE, 'identified' => ID_NONE, 'manufacturer' => null, 'model' => $model, 'identifier' => $original, 'generic' => false);
foreach ($list as $m => $v) {
$match = null;
if (DeviceModels::hasMatch($m, $model)) {
if (substr($m, -2) == "!!") {
foreach ($v as $m2 => $v2) {
if (DeviceModels::hasMatch($m2, $model)) {
$match = $v2;
continue;
}
}
} else {
$match = $v;
}
}
if ($match) {
$device->manufacturer = $match[0];
$device->model = $match[1];
if (isset($match[2])) {
$device->type = $match[2];
}
if (isset($match[3])) {
$device->flag = $match[3];
}
$device->identified = ID_MATCH_UA;
if ($device->manufacturer == null && $device->model == null) {
$device->identified = ID_PATTERN;
}
return $device;
}
}
return $device;
}