Skip to content

Commit

Permalink
Upgrading Mobile_Detect and adding webos.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmathai committed Feb 5, 2011
1 parent e7b99b7 commit 815344e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/classes/Mobile_Detect.php
Expand Up @@ -4,7 +4,7 @@
* Mobile Detect
*
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @version SVN: $Id$
* @version SVN: $Id: Mobile_Detect.php 3 2009-05-21 13:06:28Z vic.stanciu $
*/

class Mobile_Detect {
Expand All @@ -25,7 +25,7 @@ class Mobile_Detect {
"blackberry" => "blackberry",
"iphone" => "(iphone|ipod)",
"opera" => "opera mini",
"palm" => "(avantgo|blazer|elaine|hiptop|palm|plucker|xiino)",
"palm" => "(avantgo|blazer|elaine|hiptop|palm|plucker|xiino|webos)",
"windows" => "windows ce; (iemobile|ppc|smartphone)",
"generic" => "(kindle|mobile|mmp|midp|o2|pda|pocket|psp|symbian|smartphone|treo|up.browser|up.link|vodafone|wap)"
);
Expand All @@ -37,7 +37,7 @@ public function __construct() {

if (isset($_SERVER['HTTP_X_WAP_PROFILE'])|| isset($_SERVER['HTTP_PROFILE'])) {
$this->isMobile = true;
} elseif (strpos($this->accept,'text/vnd.wap.wml') > 0 || strpos($this->accept,'application/vnd.wap.xhtml+xml') > 0) {
} elseif (strpos($this->accept,'text/vnd.wap.wml') > 0 || strpos($accept,'application/vnd.wap.xhtml+xml') > 0) {
$this->isMobile = true;
} else {
foreach ($this->devices as $device => $regexp) {
Expand Down Expand Up @@ -77,7 +77,7 @@ public function isMobile() {

protected function isDevice($device) {
$var = "is" . ucfirst($device);
$return = !isset($this->$var) || $this-$var === null ? (bool) preg_match("/" . $this->devices[$device] . "/i", $this->userAgent) : $this->$var;
$return = $this->$var === null ? (bool) preg_match("/" . $this->devices[$device] . "/i", $this->userAgent) : $this->$var;

if ($device != 'generic' && $return == true) {
$this->isGeneric = false;
Expand Down

0 comments on commit 815344e

Please sign in to comment.