Beispiel #1
0
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyRecoveryMatch($userAgent)
 {
     if (Utils::checkIfContainsAnyOf($userAgent, array('MIB/2.2', 'MIB/BER2.2'))) {
         return 'mot_mib22_generic';
     }
     return WurflConstants::NO_MATCH;
 }
 /**
  * @param string $userAgent
  *
  * @return bool
  */
 public function canHandle($userAgent)
 {
     if (Utils::isDesktopBrowser($userAgent)) {
         return false;
     }
     return Utils::checkIfContains($userAgent, 'Android') && Utils::checkIfContainsAnyOf($userAgent, array('Opera Mobi', 'Opera Tablet'));
 }
Beispiel #3
0
 /**
  * @param string $userAgent
  *
  * @return bool
  */
 public function canHandle($userAgent)
 {
     if (Utils::isDesktopBrowser($userAgent)) {
         return false;
     }
     return Utils::checkIfContainsAnyOf($userAgent, array('LGUPLUS', 'lgtelecom'));
 }
Beispiel #4
0
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyRecoveryMatch($userAgent)
 {
     if (Utils::checkIfContainsAnyOf($userAgent, array('Macintosh', 'Windows'))) {
         return WurflConstants::GENERIC_WEB_BROWSER;
     }
     return WurflConstants::NO_MATCH;
 }
Beispiel #5
0
 /**
  * @param string $userAgent
  *
  * @return bool
  */
 public function canHandle($userAgent)
 {
     if (Utils::checkIfContains($userAgent, 'Android') && Utils::checkIfContainsAnyOf($userAgent, array('/Kindle', 'Silk'))) {
         return false;
     }
     return Utils::checkIfContainsAnyOf($userAgent, array('Kindle', 'Silk'));
 }
Beispiel #6
0
 public function canHandle($userAgent)
 {
     if (Utils::isDesktopBrowser($userAgent)) {
         return false;
     }
     return Utils::checkIfContainsAnyOf($userAgent, array('iPhone', 'iPod', 'iPad')) && !Utils::checkIfContains($userAgent, 'Symbian');
 }
 public function canHandle($userAgent)
 {
     if (Utils::isMobileBrowser($userAgent)) {
         return false;
     }
     return Utils::checkIfContainsAnyOf($userAgent, array('Thunderbird', 'Microsoft Outlook', 'MSOffice', 'DesktopApp '));
 }
Beispiel #8
0
 /**
  * @param string $userAgent
  *
  * @return bool
  */
 public function canHandle($userAgent)
 {
     if (Utils::isDesktopBrowser($userAgent)) {
         return false;
     }
     return Utils::checkIfContainsAnyOf($userAgent, array('webOS', 'hpwOS'));
 }
 public function canHandle($userAgent)
 {
     if (Utils::isDesktopBrowser($userAgent)) {
         return false;
     }
     return Utils::checkIfContains($userAgent, 'Android') && Utils::checkIfContainsAnyOf($userAgent, array('Fennec', 'Firefox'));
 }
Beispiel #10
0
 /**
  * @param string $userAgent
  *
  * @return bool
  */
 public function canHandle($userAgent)
 {
     if (Utils::isDesktopBrowser($userAgent)) {
         return false;
     }
     return Utils::checkIfContains($userAgent, 'Nokia') && !Utils::checkIfContainsAnyOf($userAgent, array('Android', 'iPhone'));
 }
 /**
  * @return bool
  */
 protected function compute()
 {
     $ua = $this->request->getUserAgentNormalized();
     $ua_original = $this->request->getUserAgent();
     // ->contains() can take an array
     if (Utils::checkIfContainsAnyOf($ua, $this->thirdPartyBrowsers)) {
         return false;
     }
     // Lollipop implementation of webview adds a ; wv to the UA
     if ($this->device->device_os === 'Android' && false !== strpos($ua_original, '; wv) ')) {
         return true;
     }
     // Handling Chrome separately
     if ($this->device->device_os === 'Android' && Utils::checkIfContains($ua, 'Chrome') && !Utils::checkIfContains($ua, 'Version')) {
         return false;
     }
     // iOS webview logic is pretty simple
     if ($this->device->device_os === 'iOS' && !Utils::checkIfContains($ua, 'Safari')) {
         return true;
     }
     // So is Mac OS X's webview logic
     if ($this->device->advertised_device_os === 'Mac OS X' && !Utils::checkIfContains($ua, 'Safari')) {
         return true;
     }
     if ($this->device->device_os === 'Android') {
         if ($this->request->originalHeaderExists('HTTP_X_REQUESTED_WITH')) {
             $requested_with = $this->request->getOriginalHeader('HTTP_X_REQUESTED_WITH');
             // The whitelist is an array with X-Requested-With header field values sent by known apps
             if (in_array($requested_with, $this->whitelist)) {
                 return true;
             } elseif (in_array($requested_with, $this->blacklist)) {
                 // The blacklist is an array with X-Requested-With header field values sent by known stock browsers
                 return false;
             }
         }
         // Now we handle Android UAs that haven't been eliminated above (No X-Requested-With header and not a third party browser)
         // Make sure to use the original UA and not the normalized one
         if (preg_match('#Mozilla/5.0 \\(Linux;( U;)? Android.*AppleWebKit.*\\(KHTML, like Gecko\\)#', $ua_original)) {
             // Among those UAs in here, we are interested in UAs from apps that contain a webview style UA and add stuff to the beginning or the end of the string(FB, Flipboard etc.)
             // Android >= 4.4
             if ((strpos($ua, 'Android 4.4') !== false || strpos($ua, 'Android 5.') !== false) && !preg_match('#^Mozilla/5.0 \\(Linux; Android [45]\\.[\\d\\.]+; .+ Build/.+\\) AppleWebKit/[\\d\\.+]+ \\(KHTML, like Gecko\\) Version/[\\d\\.]+ Chrome/([\\d]+)\\.[\\d\\.]+? (?:Mobile )?Safari/[\\d\\.+]+$#', $ua_original)) {
                 if (preg_match('#Chrome/(\\d+)\\.#', $ua, $matches)) {
                     if ($matches[1] < 30) {
                         return false;
                     }
                 }
                 return true;
             }
             // Android < 4.4
             if (preg_match('#Android [1234]\\.[123]#', $ua) && !preg_match('#^Mozilla/5.0 \\(Linux;( U;)? Android [1234]\\.[\\d\\.]+(-update1)?; [a-zA-Z]+-[a-zA-Z]+; .+ Build/.+\\) AppleWebKit/[\\d\\.+]+ \\(KHTML, like Gecko\\) Version/[\\d\\.]+ (Mobile )?Safari/[\\d\\.+]+$#', $ua_original)) {
                 return true;
             }
         }
         return false;
     }
     // Return is_app_webview = false for everything else
     return false;
 }
Beispiel #12
0
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyRecoveryMatch($userAgent)
 {
     if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7')) || Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/'))) {
         if (Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/'))) {
             return 'generic_ms_phone_os10_desktopmode';
         }
         if (Utils::checkIfContains($userAgent, 'WPDesktop')) {
             return 'generic_ms_phone_os8_desktopmode';
         }
         if (Utils::checkIfContains($userAgent, 'Trident/5.0')) {
             return 'generic_ms_phone_os7_5_desktopmode';
         }
         return 'generic_ms_phone_os7_desktopmode';
     }
     $version = self::getWindowsPhoneVersion($userAgent);
     if ($version === '10.0') {
         return 'generic_ms_phone_os10';
     }
     if ($version === '8.1') {
         return 'generic_ms_phone_os8_1';
     }
     if ($version === '8.0') {
         return 'generic_ms_phone_os8';
     }
     if ($version === '7.8') {
         return 'generic_ms_phone_os7_8';
     }
     if ($version === '7.5') {
         return 'generic_ms_phone_os7_5';
     }
     if ($version === '7.0') {
         return 'generic_ms_phone_os7';
     }
     if ($version === '6.5') {
         return 'generic_ms_winmo6_5';
     }
     //These are probably UAs of the type "Windows Phone Ad Client (Xna)/5.1.0.0 BMID/E67970D969"
     if (Utils::checkIfStartsWithAnyOf($userAgent, array('Windows Phone Ad Client', 'WindowsPhoneAdClient'))) {
         return 'generic_ms_phone_os7';
     }
     return WurflConstants::NO_MATCH;
 }
Beispiel #13
0
 /**
  * @param string $userAgent
  *
  * @return string
  */
 public function normalize($userAgent)
 {
     if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7')) || Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/'))) {
         $model = WindowsPhoneHandler::getWindowsPhoneDesktopModel($userAgent);
         $version = WindowsPhoneHandler::getWindowsPhoneDesktopVersion($userAgent);
     } elseif (Utils::checkIfStartsWithAnyOf($userAgent, array('Windows Phone Ad Client', 'WindowsPhoneAdClient'))) {
         $model = WindowsPhoneHandler::getWindowsPhoneAdClientModel($userAgent);
         $version = WindowsPhoneHandler::getWindowsPhoneVersion($userAgent);
     } elseif (Utils::checkIfContains($userAgent, 'NativeHost')) {
         return $userAgent;
     } else {
         $model = WindowsPhoneHandler::getWindowsPhoneModel($userAgent);
         $version = WindowsPhoneHandler::getWindowsPhoneVersion($userAgent);
     }
     if ($model !== null && $version !== null) {
         // 'WP' is for Windows Phone
         $prefix = 'WP' . $version . ' ' . $model . WurflConstants::RIS_DELIMITER;
         return $prefix . $userAgent;
     }
     return $userAgent;
 }
Beispiel #14
0
 public function canHandle($userAgent)
 {
     return Utils::checkIfContains($userAgent, 'Firefox/') && Utils::checkIfContainsAnyOf($userAgent, array('Mobile', 'Tablet'));
 }
Beispiel #15
0
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyRecoveryMatch($userAgent)
 {
     if (Utils::checkIfContainsAnyOf($userAgent, array('SLCC1', 'Media Center PC', '.NET CLR', 'OfficeLiveConnector'))) {
         return WurflConstants::GENERIC_WEB_BROWSER;
     }
     return WurflConstants::NO_MATCH;
 }
Beispiel #16
0
 /**
  * Applies Catch-All match
  *
  * @param string $userAgent
  *
  * @return string WURFL deviceID
  */
 public function applyRecoveryCatchAllMatch($userAgent)
 {
     if (Utils::isDesktopBrowserHeavyDutyAnalysis($userAgent)) {
         return WurflConstants::GENERIC_WEB_BROWSER;
     }
     if (Utils::checkIfContains($userAgent, 'CoreMedia')) {
         return 'apple_iphone_coremedia_ver1';
     }
     if (Utils::checkIfContains($userAgent, 'Windows CE')) {
         return 'generic_ms_mobile';
     }
     if (Utils::checkIfContains($userAgent, 'UP.Browser/7.2')) {
         return 'opwv_v72_generic';
     }
     if (Utils::checkIfContains($userAgent, 'UP.Browser/7')) {
         return 'opwv_v7_generic';
     }
     if (Utils::checkIfContains($userAgent, 'UP.Browser/6.2')) {
         return 'opwv_v62_generic';
     }
     if (Utils::checkIfContains($userAgent, 'UP.Browser/6')) {
         return 'opwv_v6_generic';
     }
     if (Utils::checkIfContains($userAgent, 'UP.Browser/5')) {
         return 'upgui_generic';
     }
     if (Utils::checkIfContains($userAgent, 'UP.Browser/4')) {
         return 'uptext_generic';
     }
     if (Utils::checkIfContains($userAgent, 'UP.Browser/3')) {
         return 'uptext_generic';
     }
     // Series 60
     if (Utils::checkIfContains($userAgent, 'Series60')) {
         return 'nokia_generic_series60';
     }
     // Access/Net Front
     if (Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.0', 'ACS-NF/3.0'))) {
         return 'generic_netfront_ver3';
     }
     if (Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.1', 'ACS-NF/3.1'))) {
         return 'generic_netfront_ver3_1';
     }
     if (Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.2', 'ACS-NF/3.2'))) {
         return 'generic_netfront_ver3_2';
     }
     if (Utils::checkIfContainsAnyOf($userAgent, array('NetFront/3.3', 'ACS-NF/3.3'))) {
         return 'generic_netfront_ver3_3';
     }
     if (Utils::checkIfContains($userAgent, 'NetFront/3.4')) {
         return 'generic_netfront_ver3_4';
     }
     if (Utils::checkIfContains($userAgent, 'NetFront/3.5')) {
         return 'generic_netfront_ver3_5';
     }
     if (Utils::checkIfContains($userAgent, 'NetFront/4.0')) {
         return 'generic_netfront_ver4_0';
     }
     // Contains Mozilla/, but not at the beginning of the UA
     // ie: MOTORAZR V8/R601_G_80.41.17R Mozilla/4.0 (compatible; MSIE 6.0 Linux; MOTORAZR V88.50) Profile/MIDP-2.0 Configuration/CLDC-1.1 Opera 8.50[zh]
     if (strpos($userAgent, 'Mozilla/') > 0) {
         return WurflConstants::GENERIC_XHTML;
     }
     if (Utils::checkIfContainsAnyOf($userAgent, array('Obigo', 'AU-MIC/2', 'AU-MIC-', 'AU-OBIGO/', 'Teleca Q03B1'))) {
         return WurflConstants::GENERIC_XHTML;
     }
     // DoCoMo
     if (Utils::checkIfStartsWithAnyOf($userAgent, array('DoCoMo', 'KDDI'))) {
         return 'docomo_generic_jap_ver1';
     }
     if (Utils::isMobileBrowser($userAgent)) {
         return WurflConstants::GENERIC_MOBILE;
     }
     return WurflConstants::GENERIC;
 }
Beispiel #17
0
 /**
  * @param string $userAgent
  *
  * @return bool
  */
 public function canHandle($userAgent)
 {
     return !Utils::checkIfContainsAnyOf($userAgent, array('like Android', 'Symbian')) && Utils::checkIfContains($userAgent, 'Android');
 }