Lines Matching +full:x +full:- +full:mobile

4  * Device Detector - The Universal Device Detection library for parsing User Agents
31 use DeviceDetector\Parser\Device\Mobile; alias
151 * Holds the cache class used for caching the parsed yml-Files
157 * Holds the parser class used for parsing yml-Files
191 $this->setUserAgent($userAgent);
195 $this->setClientHints($clientHints);
198 $this->addClientParser(new FeedReader());
199 $this->addClientParser(new MobileApp());
200 $this->addClientParser(new MediaPlayer());
201 $this->addClientParser(new PIM());
202 $this->addClientParser(new Browser());
203 $this->addClientParser(new Library());
205 $this->addDeviceParser(new HbbTv());
206 $this->addDeviceParser(new ShellTv());
207 $this->addDeviceParser(new Notebook());
208 $this->addDeviceParser(new Console());
209 $this->addDeviceParser(new CarBrowser());
210 $this->addDeviceParser(new Camera());
211 $this->addDeviceParser(new PortableMediaPlayer());
212 $this->addDeviceParser(new Mobile());
214 $this->addBotParser(new Bot());
227 return $this->getDevice() === $deviceType;
231 foreach ($this->clientTypes as $client) {
233 return $this->getClient('type') === $client;
247 if ($this->userAgent !== $userAgent) {
248 $this->reset();
251 $this->userAgent = $userAgent;
261 if ($this->clientHints !== $clientHints) {
262 $this->reset();
265 $this->clientHints = $clientHints;
275 $this->clientParsers[] = $parser;
276 $this->clientTypes[] = $parser->getName();
284 return $this->clientParsers;
294 $this->deviceParsers[] = $parser;
302 return $this->deviceParsers;
310 $this->botParsers[] = $parser;
318 return $this->botParsers;
330 $this->discardBotInformation = $discard;
335 …eeded if we want bots to be processed as a simple clients. So we can detect if it is mobile client,
342 $this->skipBotDetection = $skip;
355 return !empty($this->bot);
369 return !!$this->matchUserAgent($regex);
373 * Returns if the parsed UA is detected as a mobile device
379 // Client hints indicate a mobile device
380 if ($this->clientHints instanceof ClientHints && $this->clientHints->isMobile()) {
384 // Mobile device types
385 if (\in_array($this->device, [
397 // non mobile device types
398 if (\in_array($this->device, [
407 // Check for browsers available for mobile devices only
408 if ($this->usesMobileBrowser()) {
412 $osName = $this->getOs('name');
418 return !$this->isBot() && !$this->isDesktop();
432 $osName = $this->getOsAttribute('name');
438 // Check for browsers available for mobile devices only
439 if ($this->usesMobileBrowser()) {
458 return $this->os;
461 return $this->getOsAttribute($attr);
476 return $this->client;
479 return $this->getClientAttribute($attr);
492 return $this->device;
505 if (null !== $this->getDevice()) {
506 return AbstractDeviceParser::getDeviceName($this->getDevice());
519 * @deprecated since 4.0 - short codes might be removed in next major release
523 return AbstractDeviceParser::getShortCode($this->brand);
536 return $this->brand;
546 return $this->model;
556 return $this->userAgent;
566 return $this->clientHints;
576 return $this->bot;
586 return $this->parsed;
594 if ($this->isParsed()) {
598 $this->parsed = true;
601 if ((empty($this->userAgent) || !\preg_match('/([a-z])/i', $this->userAgent))
602 && empty($this->clientHints)
607 $this->parseBot();
609 if ($this->isBot()) {
613 $this->parseOs();
617 * Clients might be browsers, Feed Readers, Mobile Apps, Media Players or
620 $this->parseClient();
622 $this->parseDevice();
650 $deviceDetector->setUserAgent($ua);
651 $deviceDetector->setClientHints($clientHints);
653 $deviceDetector->parse();
655 if ($deviceDetector->isBot()) {
657 'user_agent' => $deviceDetector->getUserAgent(),
658 'bot' => $deviceDetector->getBot(),
663 $client = $deviceDetector->getClient();
666 if ($deviceDetector->isBrowser()
677 $os = $deviceDetector->getOs();
683 'user_agent' => $deviceDetector->getUserAgent(),
687 'type' => $deviceDetector->getDeviceName(),
688 'brand' => $deviceDetector->getBrandName(),
689 'model' => $deviceDetector->getModel(),
703 $this->cache = $cache;
713 if (!empty($this->cache)) {
714 return $this->cache;
727 $this->yamlParser = $yamlParser;
737 if (!empty($this->yamlParser)) {
738 return $this->yamlParser;
751 if (!isset($this->client[$attr])) {
755 return $this->client[$attr];
765 if (!isset($this->os[$attr])) {
769 return $this->os[$attr];
779 $regex = 'Android( [.0-9]+)?; Tablet;|Tablet(?! PC)|.*\-tablet$';
781 return !!$this->matchUserAgent($regex);
785 * Returns if the parsed UA contains the 'Android; Mobile;' fragment
791 $regex = 'Android( [.0-9]+)?; Mobile;|.*\-mobile$';
793 return !!$this->matchUserAgent($regex);
797 * Returns if the parsed UA contains the 'Android; Mobile VR;' fragment
803 $regex = 'Android( [.0-9]+)?; Mobile VR;| VR ';
805 return !!$this->matchUserAgent($regex);
815 $regex = 'Desktop(?: (x(?:32|64)|WOW64))?;';
817 return !!$this->matchUserAgent($regex);
821 * Returns if the parsed UA contains usage of a mobile only browser
827 return 'browser' === $this->getClient('type')
828 && Browser::isMobileOnlyBrowser($this->getClientAttribute('name'));
836 if ($this->skipBotDetection) {
837 $this->bot = false;
842 $parsers = $this->getBotParsers();
845 $parser->setYamlParser($this->getYamlParser());
846 $parser->setCache($this->getCache());
847 $parser->setUserAgent($this->getUserAgent());
848 $parser->setClientHints($this->getClientHints());
850 if ($this->discardBotInformation) {
851 $parser->discardDetails();
854 $bot = $parser->parse();
857 $this->bot = $bot;
865 * Tries to detect the client (e.g. browser, mobile app, ...)
869 $parsers = $this->getClientParsers();
872 $parser->setYamlParser($this->getYamlParser());
873 $parser->setCache($this->getCache());
874 $parser->setUserAgent($this->getUserAgent());
875 $parser->setClientHints($this->getClientHints());
876 $client = $parser->parse();
879 $this->client = $client;
891 $parsers = $this->getDeviceParsers();
894 $parser->setYamlParser($this->getYamlParser());
895 $parser->setCache($this->getCache());
896 $parser->setUserAgent($this->getUserAgent());
897 $parser->setClientHints($this->getClientHints());
899 if ($parser->parse()) {
900 $this->device = $parser->getDeviceType();
901 $this->model = $parser->getModel();
902 $this->brand = $parser->getBrand();
911 if ($this->clientHints instanceof ClientHints && empty($this->model)) {
912 $this->model = $this->clientHints->getModel();
918 if (empty($this->brand)) {
919 $vendorParser = new VendorFragment($this->getUserAgent());
920 $vendorParser->setYamlParser($this->getYamlParser());
921 $vendorParser->setCache($this->getCache());
922 $this->brand = $vendorParser->parse()['brand'] ?? '';
925 $osName = $this->getOsAttribute('name');
926 $osFamily = $this->getOsAttribute('family');
927 $osVersion = $this->getOsAttribute('version');
928 $clientName = $this->getClientAttribute('name');
934 if ('Apple' === $this->brand && !\in_array($osName, $appleOsNames)) {
935 $this->device = null;
936 $this->brand = '';
937 $this->model = '';
943 if (empty($this->brand) && \in_array($osName, $appleOsNames)) {
944 $this->brand = 'Apple';
950 if (null === $this->device && $this->hasAndroidVRFragment()) {
951 $this->device = AbstractDeviceParser::DEVICE_TYPE_WEARABLE;
955 * Chrome on Android passes the device type based on the keyword 'Mobile'
957 * See https://developer.chrome.com/multidevice/user-agent#chrome_for_android_user_agent
958 …* Note: We do not check for browser (family) here, as there might be mobile apps using Chrome, tha…
961 if (null === $this->device && 'Android' === $osFamily
962 && $this->matchUserAgent('Chrome/[.0-9]*')
964 if ($this->matchUserAgent('(?:Mobile|eliboM)')) {
965 $this->device = AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE;
967 $this->device = AbstractDeviceParser::DEVICE_TYPE_TABLET;
974 …if (AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE === $this->device && $this->matchUserAgent('Pad/A…
975 $this->device = AbstractDeviceParser::DEVICE_TYPE_TABLET;
981 if (null === $this->device && ($this->hasAndroidTableFragment()
982 || $this->matchUserAgent('Opera Tablet'))
984 $this->device = AbstractDeviceParser::DEVICE_TYPE_TABLET;
988 …* Some user agents simply contain the fragment 'Android; Mobile;', so we assume those devices as s…
990 if (null === $this->device && $this->hasAndroidMobileFragment()) {
991 $this->device = AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE;
996 * too late, there were a bunch of tablets running with 2.x
1000 * Devices running Android 3.X are tablets. Device type of Android 2.X and 4.X+ are unknown
1002 if (null === $this->device && 'Android' === $osName && '' !== $osVersion) {
1003 if (-1 === \version_compare($osVersion, '2.0')) {
1004 $this->device = AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE;
1006 && -1 === \version_compare($osVersion, '4.0')
1008 $this->device = AbstractDeviceParser::DEVICE_TYPE_TABLET;
1015 …if (AbstractDeviceParser::DEVICE_TYPE_FEATURE_PHONE === $this->device && 'Android' === $osFamily) {
1016 $this->device = AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE;
1022 if ('Java ME' === $osName && null === $this->device) {
1023 $this->device = AbstractDeviceParser::DEVICE_TYPE_FEATURE_PHONE;
1030 $this->device = AbstractDeviceParser::DEVICE_TYPE_FEATURE_PHONE;
1034 * According to http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx
1037 * This UA string will be transmitted on a touch-enabled system running Windows 8 (RT)
1043 if (null === $this->device && ('Windows RT' === $osName || ('Windows' === $osName
1044 && \version_compare($osVersion, '8') >= 0)) && $this->isTouchEnabled()
1046 $this->device = AbstractDeviceParser::DEVICE_TYPE_TABLET;
1052 if (null === $this->device && $this->matchUserAgent('Puffin/(?:\d+[.\d]+)[LMW]D')) {
1053 $this->device = AbstractDeviceParser::DEVICE_TYPE_DESKTOP;
1059 if (null === $this->device && $this->matchUserAgent('Puffin/(?:\d+[.\d]+)[AIFLW]P')) {
1060 $this->device = AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE;
1066 if (null === $this->device && $this->matchUserAgent('Puffin/(?:\d+[.\d]+)[AILW]T')) {
1067 $this->device = AbstractDeviceParser::DEVICE_TYPE_TABLET;
1073 if ($this->matchUserAgent('Opera TV Store| OMI/')) {
1074 $this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
1081 $this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
1082 $this->brand = 'coocaa';
1088 $hasDeviceTvType = false === \in_array($this->device, [
1091 …]) && $this->matchUserAgent('Andr0id|(?:Android(?: UHD)?|Google) TV|\(lite\) TV|BRAVIA|Firebolt| T…
1094 $this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
1100 if (null === $this->device && $this->matchUserAgent('SmartTV|Tizen.+ TV .+$')) {
1101 $this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
1112 $this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
1118 if (null === $this->device && $this->matchUserAgent('\(TV;')) {
1119 $this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
1125 $hasDesktop = AbstractDeviceParser::DEVICE_TYPE_DESKTOP !== $this->device
1126 && false !== \strpos($this->userAgent, 'Desktop')
1127 && $this->hasDesktopFragment();
1130 $this->device = AbstractDeviceParser::DEVICE_TYPE_DESKTOP;
1134 if (null !== $this->device || !$this->isDesktop()) {
1138 $this->device = AbstractDeviceParser::DEVICE_TYPE_DESKTOP;
1147 $osParser->setUserAgent($this->getUserAgent());
1148 $osParser->setClientHints($this->getClientHints());
1149 $osParser->setYamlParser($this->getYamlParser());
1150 $osParser->setCache($this->getCache());
1151 $this->os = $osParser->parse();
1161 $regex = '/(?:^|[^A-Z_-])(?:' . \str_replace('/', '\/', $regex) . ')/i';
1163 if (\preg_match($regex, $this->userAgent, $matches)) {
1175 $this->bot = null;
1176 $this->client = null;
1177 $this->device = null;
1178 $this->os = null;
1179 $this->brand = '';
1180 $this->model = '';
1181 $this->parsed = false;