Ejemplo n.º 1
0
 /**
  * Returns true if the give $userAgent is from a mobile device
  * @param string $userAgent
  * @return bool
  */
 public static function isMobileBrowser($userAgent)
 {
     if (self::$_is_mobile_browser !== null) {
         return self::$_is_mobile_browser;
     }
     self::$_is_mobile_browser = false;
     $userAgent = strtolower($userAgent);
     foreach (self::$mobileBrowsers as $key) {
         if (strpos($userAgent, $key) !== false) {
             self::$_is_mobile_browser = true;
             break;
         }
     }
     return self::$_is_mobile_browser;
 }