1
|
|
|
<?php |
2
|
|
|
namespace MobileDetect\Providers; |
3
|
|
|
|
4
|
|
|
class Tablets extends AbstractProvider |
5
|
|
|
{ |
6
|
|
|
/** |
7
|
|
|
* List of tablet devices. |
8
|
|
|
* |
9
|
|
|
* @var array |
10
|
|
|
*/ |
11
|
|
|
protected $data = array( |
12
|
|
|
/** |
13
|
|
|
* iPad tablets family. |
14
|
|
|
*/ |
15
|
|
|
'iPad' => array( |
16
|
|
|
'vendor' => 'Apple', |
17
|
|
|
'model' => 'iPad', |
18
|
|
|
'identityMatches' => 'iPad|iPad.*Mobile', |
19
|
|
|
'modelMatches' => array('iPad.*CPU[a-z ]+(?<version>[0-9\._-]+)'), |
20
|
|
|
), |
21
|
|
|
|
22
|
|
|
'Nexus' => array( |
23
|
|
|
'vendor' => 'Google', |
24
|
|
|
'identityMatches' => 'Android.*Nexus[\s]+(7|9|10)|^.*Android.*Nexus(?:(?!Mobile).)*$', |
25
|
|
|
'modelMatches' => array( |
26
|
|
|
// Same as PhonesData::$data['Nexus']['modelMatches'] |
|
|
|
|
27
|
|
|
'Google (?<model>[a-zA-Z]+ (?<version>[a-zA-Z0-9]+))', |
28
|
|
|
'(?<model>Nexus (?<version>[a-zA-Z0-9]+)) Build', |
29
|
|
|
'(?<model>[a-zA-Z0-9]+ Nexus)' |
30
|
|
|
) |
31
|
|
|
), |
32
|
|
|
|
33
|
|
|
'Samsung' => array( |
34
|
|
|
'vendor' => 'Samsung', |
35
|
|
|
'identityMatches' => [ |
36
|
|
|
'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815', |
37
|
|
|
'|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497', |
38
|
|
|
'|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K', |
39
|
|
|
'|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W', |
40
|
|
|
'|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-I9205|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210', |
41
|
|
|
'|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905', |
42
|
|
|
'|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V', |
43
|
|
|
'|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A', |
44
|
|
|
'|SM-T707A|SM-T807A|SM-T237P|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T360' // SCH-P709|SCH-P729|SM-T2558 - Samsung Mega - treat them like a regular phone. |
45
|
|
|
], |
46
|
|
|
// Same as phones. |
47
|
|
|
'modelMatches' => [ |
48
|
|
|
'SAMSUNG (?<model>[a-zA-Z0-9-]+)', |
49
|
|
|
'; SAMSUNG; (?<model>[a-zA-Z0-9-]+)', |
50
|
|
|
'; (?<model>[a-zA-Z0-9-_]+) Build', |
51
|
|
|
'; (?<model>[a-zA-Z0-9-]+)\) like Gecko', |
52
|
|
|
'; (?<model>[a-zA-Z0-9-]+)/[a-zA-Z0-9-.]+ Build', |
53
|
|
|
'[a-z]{2}-[a-z]{2}; (?<model>[a-z]{2}-[a-z0-9]+);' |
54
|
|
|
] |
55
|
|
|
), |
56
|
|
|
|
57
|
|
|
// http://www.acer.ro/ac/ro/RO/content/drivers |
58
|
|
|
// http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer) |
59
|
|
|
// http://us.acer.com/ac/en/US/content/group/tablets |
60
|
|
|
// http://www.acer.de/ac/de/DE/content/models/tablets/ |
61
|
|
|
// Can conflict with Micromax and Motorola phones codes. |
62
|
|
|
'Acer' => array( |
63
|
|
|
'vendor' => 'Acer', |
64
|
|
|
'identityMatches' => 'Android.*; \b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\b|W3-810|\bA3-A10\b|\bA3-A11\b', |
65
|
|
|
// @todo modelMatches might be shared between phones and tablets. |
66
|
|
|
'modelMatches' => array( |
67
|
|
|
'; (?<model>[a-zA-Z0-9-]+) Build', |
68
|
|
|
'; Acer; (?<model>[a-zA-Z0-9-]+)' |
69
|
|
|
) |
70
|
|
|
), |
71
|
|
|
|
72
|
|
|
); |
73
|
|
|
|
74
|
|
|
public function getDataFromVendor($vendorName) |
75
|
|
|
{ |
76
|
|
|
return $this->data[$vendorName]; |
77
|
|
|
} |
78
|
|
|
} |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.