Detects Opera Mobile or Opera Mini.
@return detection of an Opera browser for a mobile device
762516
public boolean detectOperaMobile() {

        if ((userAgent.indexOf(engineOpera) != -1)
            && ((userAgent.indexOf(mini) != -1) || (userAgent.indexOf(mobi) != -1))) {
            return true;
        }
        return false;
    }
625242
function _getDeviceType() {
  let ua = navigator.userAgent;

  // Tablets must be checked before phones.
  if ((/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i).test(ua)) {
    return 5; // "tablet"
  }
  if ((/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/).test(ua)) {
    return 4; // "phone"
  }
  // Consider that all other devices are personal computers
  return 2;
}
315954
def detectWebOSTV(self):
        
        return UAgentInfo.deviceWebOStv in self.__userAgent \
            and UAgentInfo.smartTV2 in self.__userAgent
641111
function DetectIpad()
   {
      if (stripos($this->useragent, $this->deviceIpad) > -1 &&
          $this->DetectWebkit() == $this->true)
         return $this->true; 
      else
         return $this->false; 
   }
1047277
protected function checkBrowseriPhone()
    {
        if (stripos($this->_agent, 'iPhone') !== false) {
            $this->setVersion(self::VERSION_UNKNOWN);
            $this->setBrowser(self::BROWSER_IPHONE);
            $this->getSafariVersionOnIos();
            $this->getChromeVersionOnIos();
            $this->checkForFacebookIos();
            $this->setMobile(true);
            return true;

        }
        return false;
    }
1209375
def process_request(request):
        """"""

        if 'HTTP_X_OPERAMINI_FEATURES' in request.META:
            # Then it's running opera mini. 'Nuff said.
            # Reference from:
            # http://dev.opera.com/articles/view/opera-mini-request-headers/
            request.mobile = True
            return None

        if 'HTTP_ACCEPT' in request.META:
            s = request.META['HTTP_ACCEPT'].lower()
            if 'application/vnd.wap.xhtml+xml' in s:
                # Then it's a wap browser
                request.mobile = True
                return None

        if 'HTTP_USER_AGENT' in request.META:
            # This takes the most processing. Surprisingly enough, when I
            # Experimented on my own machine, this was the most efficient
            # algorithm. Certainly more so than regexes.
            # Also, Caching didn't help much, with real-world caches.
            s = request.META['HTTP_USER_AGENT'].lower()
            for ua in search_strings:
                if ua in s:
                    # check if we are ignoring this user agent: (IPad)

                    if not ignore_user_agent(s):
                        request.mobile = True
                        if MOBI_DETECT_TABLET:
                            request.tablet = _is_tablet(s)
                        return None

        # Otherwise it's not a mobile
        request.mobile = False
        request.tablet = False
        return None
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;
		}
1210531
private function isFirefoxMobile()
  {
    $is = false;
    $tablet = false;
    $phone = false;
    $android = false;
    $touch = true;
    if ( $this->browser == 'firefox' || $this->isFirefox() )
    {
      if ( preg_match( "/(Mobile|Tablet|TV)/", $this->ua, $matches ) )
      {
        $is = true;
        $tablet = ($matches[1] == 'Tablet' || $matches[1] == 'TV') ? true : false;
        $phone =  ($matches[1] == 'Mobile') ? true : false;
      }
      elseif ( stripos( $this->ua, 'Android' ) !== false )
      {
        // No way to determine phone/tablet
        $is = true;
        $android = true;
      }
      elseif ( stripos( $this->ua, 'Maemo' ) !== false )
      {
        $is = true;
        // It's horizontal, which is probably more like a tablet, but it's only 800x480.
        $phone = true;
        $android = false;
        // Yes, the Maemo units have a touch screen, but it's resistive, and doesn't really function like we think
        // of touch in a current web environment.
        $touch = false;
      }
      elseif ( stripos( $this->ua, 'Fennec' ) !== false )
      {
        // No way to determine phone/tablet OR OS
        $is = true;
      }
    }

    if ( $is )
    {
      $this->android = $android;
      // No Firefox for iOS
      $this->ios = false;
      $this->tablet = $tablet;
      $this->phone = $phone;
      $this->mobile = true;
      $this->touch = $touch;
    }

    return $is;
  }
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 */
		);
    }
546515
function () {
            var window = Aria.$window;
            return !!((window.cordova && window.device) || (window.device && window.device.phonegap));
        }
1211212
function detect() {
  // Two types of detection:
  //  1. Object detection
  //    e.g. detect("(java)");
  //    e.g. detect("!(document.addEventListener)");
  //  2. Platform detection (browser sniffing)
  //    e.g. detect("MSIE");
  //    e.g. detect("MSIE|opera");

  var jscript = NaN/*@cc_on||@_jscript_version@*/; // http://dean.edwards.name/weblog/2007/03/sniff/#comment85164
  var javaEnabled = global.java ? true : false;
  if (global.navigator) { // browser
    var MSIE = /MSIE[\d.]+/g;
    var element = document.createElement("span");
    // Close up the space between name and version number.
    //  e.g. MSIE 6 -> MSIE6
    var userAgent = navigator.userAgent.replace(/([a-z])[\s\/](\d)/gi, "$1$2");
    // Fix opera's (and others) user agent string.
    if (!jscript) userAgent = userAgent.replace(MSIE, "");
    if (MSIE.test(userAgent)) userAgent = userAgent.match(MSIE)[0] + " " + userAgent.replace(MSIE, "");
    base2.userAgent = navigator.platform + " " + userAgent.replace(/like \w+/gi, "");
    javaEnabled &= navigator.javaEnabled();
//} else if (java) { // rhino
//  var System = java.lang.System;
//  base2.userAgent = "Rhino " + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version");
//} else if (jscript) { // Windows Scripting Host
//  base2.userAgent = "WSH";
  }

  var _cache = {};
  detect = function(expression) {
    if (_cache[expression] == null) {
      var returnValue = false, test = expression;
      var not = test.charAt(0) == "!";
      if (not) test = test.slice(1);
      if (test.charAt(0) == "(") {
        try {
          returnValue = new Function("element,jscript,java,global", "return !!" + test)(element, jscript, javaEnabled, global);
        } catch (ex) {
          // the test failed
        }
      } else {
        // Browser sniffing.
        returnValue = new RegExp("(" + test + ")", "i").test(base2.userAgent);
      }
      _cache[expression] = !!(not ^ returnValue);
    }
    return _cache[expression];
  };
  
  return detect(arguments[0]);
}
1310031
function DetectMobileLong()
   {
      if ($this->DetectMobileQuick() == $this->true) 
         return $this->true; 
      if ($this->DetectGameConsole() == $this->true) 
         return $this->true; 
         
      if (($this->DetectDangerHiptop() == $this->true) 
			|| ($this->DetectMaemoTablet() == $this->true)
			|| ($this->DetectSonyMylo() == $this->true)
			|| ($this->DetectArchos() == $this->true))
         return $this->true; 

       if ((stripos($this->useragent, $this->devicePda) > -1) &&
		 !(stripos($this->useragent, $this->disUpdate) > -1))
         return $this->true;
      
       //Detect older phones from certain manufacturers and operators. 
       if ((stripos($this->useragent, $this->uplink) > -1) 
			|| (stripos($this->useragent, $this->engineOpenWeb) > -1)
       		|| (stripos($this->useragent, $this->manuSamsung1) > -1)
       		|| (stripos($this->useragent, $this->manuSonyEricsson) > -1)
       		|| (stripos($this->useragent, $this->manuericsson) > -1)
       		|| (stripos($this->useragent, $this->svcDocomo) > -1)
       		|| (stripos($this->useragent, $this->svcKddi) > -1)
       		|| (stripos($this->useragent, $this->svcVodafone) > -1))
         return $this->true; 

      return $this->false; 
   }
17538
def is_webdriver_mobile(webdriver):
        
        browser = webdriver.capabilities['browserName']

        if (browser == u('iPhone') or 
            browser == u('android')):
            return True
        else:
            return False
417837
def detect_s60_oss_browser()

      if (detect_webkit() && (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60)))
        return true
      end
      return false
    end
248133
function DetectTierOtherPhones()
   {
      if ($this->initCompleted == $this->true ||
          $this->isTierGenericMobile == $this->true)
         return $this->isTierGenericMobile;

      //Exclude devices in the other 2 categories 
      if (($this->DetectMobileLong() == $this->true)
		&& ($this->DetectTierIphone() == $this->false)
		&& ($this->DetectTierRichCss() == $this->false))
           return $this->true;
      else
         return $this->false; 
   }
375316
def detectOperaMobile(self):
        
        return UAgentInfo.engineOpera in self.__userAgent \
            and (UAgentInfo.mini in self.__userAgent
                or UAgentInfo.mobi in self.__userAgent)
45119
public static function checkBrowserAndroid()
    {
        // Navigator
        if (stripos(self::$userAgentString, 'Android') !== false) {
            if (preg_match('/Version\/([\d\.]*)/i', self::$userAgentString, $matches)) {
                if (isset($matches[1])) {
                    self::$browser->setVersion($matches[1]);
                }
            } else {
                self::$browser->setVersion(Browser::VERSION_UNKNOWN);
            }
            self::$browser->setName(Browser::NAVIGATOR);

            return true;
        }

        return false;
    }