Detects a tablet (probably) running the Firefox OS.
@return detection of a Firefox OS tablet
556269
public boolean detectFirefoxOSTablet() {

        //First, let's make sure we're NOT on another major mobile OS.
        if (detectIos() || detectAndroid() || detectSailfish()) {
            return false;
        }

        if ((userAgent.indexOf(engineFirefox) != -1) && (userAgent.indexOf(deviceTablet) != -1)) {
            return true;
        }

        return false;
    }
1210409
function DetectPalmWebOS()
   {
      if (stripos($this->useragent, $this->deviceWebOS) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
1252190
function () {
            var isTouch = false;

            if (ariaCoreBrowser.isBlackBerry) {
                if (!ariaUtilsArray.contains([9670, 9100, 9105, 9360, 9350, 9330, 9320, 9310, 9300, 9220, 9780, 9700, 9650], +this.model())) {
                    isTouch = true;
                }
            } else {
                var window = Aria.$window;

                if (('ontouchstart' in window) || window.DocumentTouch && window.document instanceof window.DocumentTouch) {
                    isTouch = true;
                }
            }

            return !!isTouch;
        }
728068
public function getIsMobile()
    {
        if (!isset($this->name)) {
            OsDetector::detect($this, $this->getUserAgent());
        }

        return $this->isMobile;
    }
358135
public function isDetected()
    {
        return $this->browser->isDetected() || $this->os->isDetected() || $this->engine->isDetected() || $this->device->isDetected();
    }
89933
public boolean detectMobileQuick() {

        //Let's exclude tablets
        if (isTierTablet) {
            return false;
        }
        //Most mobile browsing is done on smartphones
        if (detectSmartphone()) {
            return true;
        }

        //Catch-all for many mobile devices
        if (userAgent.indexOf(mobile) != -1) {
            return true;
        }

        if (detectOperaMobile()) {
            return true;
        }

        //We also look for Kindle devices
        if (detectKindle() || detectAmazonSilk()) {
            return true;
        }

        if (detectWapWml() || detectMidpCapable() || detectBrewDevice()) {
            return true;
        }

        if ((userAgent.indexOf(engineNetfront) != -1) || (userAgent.indexOf(engineUpBrowser) != -1)) {
            return true;
        }

        return false;
    }
225634
function detectBrowser(){

            // get ie version helper
            function getIEVersion() {
                var match = window.navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:)(\d+)/);
                return match ? parseInt(match[1]) : void 0;
            }

            // user agent & vendor
            var ua = window.navigator.userAgent;
            var vendor = window.navigator.vendor;

            // chrome
            var chrome = (
                (ua.toLowerCase().indexOf('chrome') > -1) && (vendor.toLowerCase().indexOf('google') > -1)
            );

            // edge
            var edge = ua.indexOf('Edge') > -1;

            // safari
            var safari = !!window.safari || ((ua.toLowerCase().indexOf('safari') > -1) && (vendor.toLowerCase().indexOf('apple') > -1));

            // internet explorer
            var ie8 = getIEVersion() == 8;
            var ie9 = getIEVersion() == 9;
            var ie10 = getIEVersion() == 10;
            var ie11 = getIEVersion() == 11;
            var ie = ie8 || ie9 || ie10 || ie11;

            // is it mobile browser?
            // regex below thanks to http://detectmobilebrowsers.com/
            var uaOrVendor = ua || vendor || window.opera;
            var mobile = (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(uaOrVendor)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(uaOrVendor.substr(0,4)));

            // construct return object
            return {
                edge: edge,
                chrome: chrome,
                safari: safari,
                mobile: mobile,
                ie: ie,
                ie8: ie8,
                ie9: ie9,
                ie10: ie10,
                ie11: ie11,
            };

        }
133392
public static function detectDevice(){
		if($_COOKIE['v']=='m'){
			self::$devicetype=DEVICE_TYPE_MPHONE;
			}
		elseif($_COOKIE['v']=='d'){
			self::$devicetype=DEVICE_TYPE_OTHER;
			}
		if(self::$devicetype==DEVICE_TYPE_UNKNOWN){
			self::$devicetype=self::isMobile()?(self::isTablet()?DEVICE_TYPE_TABLET:DEVICE_TYPE_MPHONE):DEVICE_TYPE_OTHER;
			}
		if(empty($_COOKIE['v'])){
			if(self::$devicetype==DEVICE_TYPE_MPHONE||self::$devicetype==DEVICE_TYPE_TABLET){
				$v='m';
				}
			elseif(self::$devicetype==DEVICE_TYPE_OTHER){
				$v='d';
				}
			$expire=time()+2592000;//30 days
			setcookie('v',$v,$expire,'/',BHOSTNAME);
			}
		return self::$devicetype;
		}
1076276
public T execute() {
        if (isWindows()) {
            return onWindows();
        } else if (isMac()) {
            return onMac();
        } else if (isUnix()) {
            return onUnix();
        } else if (isSolaris()) {
            return onSolaris();
        } else {
            throw new IllegalStateException("Invalid operating system " + os);
        }
    }
33350
protected function checkBrowsers() {
		return (
			// well-known, well-used
			// Special Notes:
			// (1) Opera must be checked before FireFox due to the odd
			//     user agents used in some older versions of Opera
			// (2) WebTV is strapped onto Internet Explorer so we must
			//     check for WebTV before IE
			// (3) (deprecated) Galeon is based on Firefox and needs to be
			//     tested before Firefox is tested
			// (4) OmniWeb is based on Safari so OmniWeb check must occur
			//     before Safari
			// (5) Netscape 9+ is based on Firefox so Netscape checks
			//     before FireFox are necessary
			$this->checkBrowserWebTv() ||
		    $this->checkBrowserMaxthon()    ||  //add BugBuster, must be before IE, (Dual Engine: Webkit and Trident)
			$this->checkBrowserInternetExplorer() ||
			$this->checkBrowserGaleon() ||
			$this->checkBrowserNetscapeNavigator9Plus() ||
			$this->checkBrowserFirefox()    ||
			$this->checkBrowserSongbird()   ||	//add BugBuster
			$this->checkBrowserSeaMonkey()  ||	//add BugBuster
			$this->checkBrowserChromePlus() ||	//add BugBuster
		    $this->checkBrowserCoolNovo()   ||	//add BugBuster
		    $this->checkBrowserVivaldi()    ||  //add BugBuster
		    $this->checkBrowserDooble()     ||  //add BugBuster
		    $this->checkBrowserQtWebBrowser() || //add BugBuster
			
			$this->checkBrowserOmniWeb() ||

			// common mobile
			$this->checkBrowserAndroidSamsungGalaxy() ||  //add BugBuster
			$this->checkBrowserAndroidHTCDesire() ||      //add BugBuster
			$this->checkBrowserAndroidHTCMagic() ||       //add BugBuster
			$this->checkBrowserAndroidHTCSensation() ||   //add BugBuster
			$this->checkBrowserAndroidHTCNexusOne() ||    //add BugBuster
			$this->checkBrowserAndroidHTCWildfire() ||    //add BugBuster
			$this->checkBrowserAndroidAcerA500() ||       //add BugBuster
			$this->checkBrowserAndroidAcerA501() ||       //add BugBuster
			$this->checkBrowserAndroidSamsungNexusS()  || //add BugBuster
			$this->checkBrowserAndroidThinkPadTablet() || //add BugBuster
			$this->checkBrowserAndroidXoomTablet()     || //add BugBuster
			$this->checkBrowserAndroidAsusTransfomerPad() || //add BugBuster
			$this->checkBrowserAndroidKindleFire() ||      //add BugBuster

			//at last Android only!
			$this->checkBrowserAndroid() ||

			$this->checkBrowseriPad() ||
			$this->checkBrowseriPod() ||
			$this->checkBrowseriPhone() ||
			$this->checkBrowserBlackBerry() ||
			$this->checkBrowserNokia() ||

			// common bots
			//$this->checkBrowserGoogleBot() ||
			//$this->checkBrowserMSNBot() ||
			//$this->checkBrowserSlurp() ||
		    // chrome post Android Pads
		    $this->checkBrowserChrome() ||
			// WebKit base check (post mobile and others)
			$this->checkBrowserSafari() ||
			// Opera Mini must check post mobile
			$this->checkBrowserOpera() ||
				
			// everyone else
			$this->checkBrowserTOnline() ||
			$this->checkBrowserNetPositive() ||
			$this->checkBrowserFirebird() ||
			$this->checkBrowserKonqueror() ||
			$this->checkBrowserIcab() ||
			$this->checkBrowserPhoenix() ||
			$this->checkBrowserAmaya() ||
			$this->checkBrowserLynx() ||
			$this->checkBrowserShiretoko() ||
			$this->checkBrowserIceCat() ||
			//$this->checkBrowserW3CValidator() ||
			$this->checkBrowserIceweasel() || //why not?; BugBuster
			$this->checkBrowserHTTPRequest2() || // add BugBuster
			$this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
		);
    }
450752
def detectUbuntuTablet(self):
        
        if UAgentInfo.deviceUbuntu in self.__userAgent \
           and UAgentInfo.deviceTablet in self.__userAgent:
            return True

        return False
409636
public static OSType getOperatingSystemType() {
		if (detectedOS == null) {
			String OS = System.getProperty("os.name", "generic").toLowerCase(
					Locale.ENGLISH);
			if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) {
				detectedOS = OSType.MacOS;
			} else if (OS.indexOf("win") >= 0) {
				detectedOS = OSType.Windows;
			} else if (OS.indexOf("nux") >= 0) {
				detectedOS = OSType.Linux;
			} else {
				detectedOS = OSType.Other;
			}
		}
		return detectedOS;
	}
1168859
protected function guess_device_type() {
        global $CFG;
        if (empty($CFG->enabledevicedetection)) {
            $this->devicetype = self::DEVICETYPE_DEFAULT;
            return $this->devicetype;
        }
        foreach ($this->devicetypecustoms as $value => $regex) {
            if (preg_match($regex, $this->useragent)) {
                $this->devicetype = $value;
                return $this->devicetype;
            }
        }
        if ($this->is_useragent_mobile()) {
            $this->devicetype = self::DEVICETYPE_MOBILE;
        } else if ($this->is_useragent_tablet()) {
            $this->devicetype = self::DEVICETYPE_TABLET;
        } else if (self::check_ie_version('0') && !self::check_ie_version('7.0')) {
            // IE 6 and before are considered legacy.
            $this->devicetype = self::DEVICETYPE_LEGACY;
        } else {
            $this->devicetype = self::DEVICETYPE_DEFAULT;
        }
        return $this->devicetype;
    }
881229
public static Platform detect() throws UnsupportedPlatformException {
        String osArch = getProperty("os.arch");
        String osName = getProperty("os.name");

        for (Arch arch : Arch.values()) {
            if (arch.pattern.matcher(osArch).matches()) {
                for (OS os : OS.values()) {
                    if (os.pattern.matcher(osName).matches()) {
                        return new Platform(arch, os);
                    }
                }
            }
        }

        String msg = String.format("Unsupported platform %s %s", osArch, osName);
        throw new UnsupportedPlatformException(msg);
    }
1199924
function DetectBrewDevice()
   {
       if (stripos($this->useragent, $this->deviceBrew) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
1060633
private static String getOS()
    {
        if (SystemUtils.IS_OS_WINDOWS) {
            return "Windows";
        }
        if (SystemUtils.IS_OS_MAC_OSX) {
            return "Darwin";
        }
        if (SystemUtils.IS_OS_LINUX) {
            return "Linux";
        }
        throw new UnsupportedOperationException("Unknown OS " + SystemUtils.OS_NAME);
    }
248974
def detectAndroidTablet(self):
        
        #First, let's make sure we're on an Android device.
        if not self.detectAndroid():
            return False

        #Special check for Android devices with Opera Mobile/Mini. They should NOT report here.
        if self.detectOperaMobile():
            return False

        #Otherwise, if it's Android and does NOT have 'mobile' in it, Google says it's a tablet.
        return UAgentInfo.mobile not in self.__userAgent