- Timestamp:
- Nov 7, 2012, 10:44:24 AM (11 years ago)
- Location:
- branches/2.4/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4/include/functions.inc.php
r17749 r18968 1672 1672 include_once(PHPWG_ROOT_PATH.'include/mdetect.php'); 1673 1673 $uagent_obj = new uagent_info(); 1674 if ($uagent_obj->Detect TierIphone())1674 if ($uagent_obj->DetectSmartphone()) 1675 1675 { 1676 1676 $device = 'mobile'; … … 1706 1706 $is_mobile_theme = get_boolean($_GET['mobile']); 1707 1707 pwg_set_session_var('mobile_theme', $is_mobile_theme); 1708 unset($_GET['mobile']);1709 1708 } 1710 1709 else -
branches/2.4/include/mdetect.php
r13172 r18968 3 3 /* ******************************************* 4 4 // Copyright 2010-2012, Anthony Hand 5 // 6 // File version date: April 23, 2012 7 // Update: 8 // - Updated DetectAmazonSilk(): Fixed an issue in the detection logic. 9 // 10 // File version date: April 22, 2012 - Second update 11 // Update: To address additional Kindle issues... 12 // - Updated DetectRichCSS(): Excluded e-Ink Kindle devices. 13 // - Created DetectAmazonSilk(): Created to detect Kindle Fire devices in Silk mode. 14 // - Updated DetectMobileQuick(): Updated to include e-Ink Kindle devices and the Kindle Fire in Silk mode. 15 // 16 // File version date: April 11, 2012 17 // Update: 18 // - Added a new variable for the new BlackBerry Curve Touch (9380): deviceBBCurveTouch. 19 // - Updated DetectBlackBerryTouch() to support the new BlackBerry Curve Touch (9380). 20 // - Updated DetectKindle(): Added the missing 'this' class identifier for the DetectAndroid() call. 5 21 // 6 22 // File version date: January 21, 2012 … … 19 35 // Update: 20 36 // - Updated DetectAndroidTablet() to exclude Opera Mini, which was falsely reporting as running on a tablet device when on a phone. 21 //22 // File version date: August 7, 201123 // Update:24 // - The Opera for Android browser doesn't follow Google's recommended useragent string guidelines, so some fixes were needed.25 // - Updated DetectAndroidPhone() and DetectAndroidTablet() to properly detect devices running Opera Mobile.26 // - Created 2 new methods: DetectOperaAndroidPhone() and DetectOperaAndroidTablet().27 // - Updated DetectTierIphone(). Removed the call to DetectMaemoTablet(), an obsolete mobile OS.28 37 // 29 38 // … … 114 123 var $deviceBBTour = 'blackberry96'; //Tour 115 124 var $deviceBBCurve = 'blackberry89'; //Curve2 125 var $deviceBBCurveTouch = 'blackberry 938'; //Curve Touch 116 126 var $deviceBBTorch = 'blackberry 98'; //Torch 117 127 var $deviceBBPlaybook = 'playbook'; //PlayBook tablet … … 124 134 var $engineXiino = 'xiino'; //Another old Palm 125 135 126 var $deviceKindle = 'kindle'; //Amazon Kindle, eInk one. 136 var $deviceKindle = 'kindle'; //Amazon Kindle, eInk one 137 var $engineSilk = 'silk'; //Amazon's accelerated Silk browser for Kindle Fire 127 138 128 139 //Initialize variables for mobile-specific content. … … 495 506 496 507 //************************** 497 // Detects if the current browser is a BlackBerry Touch phone 498 // device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.508 // Detects if the current browser is a BlackBerry Touch phone device with 509 // a large screen, such as the Storm, Torch, and Bold Touch. Excludes the Playbook. 499 510 function DetectBlackBerryTouch() 500 { 511 { 501 512 if ((stripos($this->useragent, $this->deviceBBStorm) > -1) || 502 513 (stripos($this->useragent, $this->deviceBBTorch) > -1) || 503 (stripos($this->useragent, $this->deviceBBBoldTouch) > -1)) 514 (stripos($this->useragent, $this->deviceBBBoldTouch) > -1) || 515 (stripos($this->useragent, $this->deviceBBCurveTouch) > -1)) 504 516 return $this->true; 505 517 else … … 710 722 { 711 723 if (stripos($this->useragent, $this->deviceKindle) > -1 && 712 DetectAndroid() == $this->false) 724 $this->DetectAndroid() == $this->false) 725 return $this->true; 726 else 727 return $this->false; 728 } 729 730 //************************** 731 // Detects if the current Amazon device is using the Silk Browser. 732 // Note: Typically used by the the Kindle Fire. 733 function DetectAmazonSilk() 734 { 735 if (stripos($this->useragent, $this->engineSilk) > -1) 713 736 return $this->true; 714 737 else … … 726 749 if ($this->isTierTablet == $this->true) 727 750 return $this->false; 728 751 729 752 //Most mobile browsing is done on smartphones 730 753 if ($this->DetectSmartphone() == $this->true) … … 752 775 if (stripos($this->useragent, $this->mobile) > -1) 753 776 return $this->true; 777 778 //We also look for Kindle devices 779 if ($this->DetectKindle() == $this->true || 780 $this->DetectAmazonSilk() == $this->true) 781 return $this->true; 754 782 755 783 else … … 953 981 if ($this->DetectMobileQuick() == $this->true) 954 982 { 955 if (($this->DetectTierIphone() == $this->true)) 983 //Exclude iPhone Tier and e-Ink Kindle devices 984 if (($this->DetectTierIphone() == $this->true) || 985 ($this->DetectKindle() == $this->true)) 956 986 return $this->false; 957 987 … … 970 1000 return $this->true; 971 1001 if (stripos($this->useragent, $this->engineTelecaQ) > -1) 972 return $this->true; 973 1002 return $this->true; 1003 974 1004 //default 975 1005 else … … 998 1028 } 999 1029 1000 ?> 1030 1031 //Was informed by a MobileESP user that it's a best practice 1032 // to omit the closing ?> marks here. They can sometimes 1033 // cause errors with HTML headers.
Note: See TracChangeset
for help on using the changeset viewer.