Changeset 18968


Ignore:
Timestamp:
Nov 7, 2012, 10:44:24 AM (8 years ago)
Author:
patdenice
Message:

merge r18967 from trunk to branch 2.4
bug:2687
bug:2778
Unable to switch from mobile theme to classic theme with incompatible plugins.
Detect blackberry and symbian for mobile theme.
Update mdetect class.

Location:
branches/2.4/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/include/functions.inc.php

    r17749 r18968  
    16721672    include_once(PHPWG_ROOT_PATH.'include/mdetect.php');
    16731673    $uagent_obj = new uagent_info();
    1674     if ($uagent_obj->DetectTierIphone())
     1674    if ($uagent_obj->DetectSmartphone())
    16751675    {
    16761676      $device = 'mobile';
     
    17061706    $is_mobile_theme = get_boolean($_GET['mobile']);
    17071707    pwg_set_session_var('mobile_theme', $is_mobile_theme);
    1708     unset($_GET['mobile']);
    17091708  }
    17101709  else
  • branches/2.4/include/mdetect.php

    r13172 r18968  
    33/* *******************************************
    44// 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.
    521//
    622// File version date: January 21, 2012
     
    1935//              Update:
    2036//              - 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, 2011
    23 //              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.
    2837//
    2938//
     
    114123   var $deviceBBTour = 'blackberry96'; //Tour
    115124   var $deviceBBCurve = 'blackberry89'; //Curve2
     125   var $deviceBBCurveTouch = 'blackberry 938'; //Curve Touch
    116126   var $deviceBBTorch = 'blackberry 98'; //Torch
    117127   var $deviceBBPlaybook = 'playbook'; //PlayBook tablet
     
    124134   var $engineXiino = 'xiino'; //Another old Palm
    125135   
    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
    127138   
    128139   //Initialize variables for mobile-specific content.
     
    495506
    496507   //**************************
    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.
    499510   function DetectBlackBerryTouch()
    500    {
     511   { 
    501512       if ((stripos($this->useragent, $this->deviceBBStorm) > -1) ||
    502513                (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))
    504516         return $this->true;
    505517       else
     
    710722   {
    711723      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)
    713736         return $this->true;
    714737      else
     
    726749      if ($this->isTierTablet == $this->true)
    727750         return $this->false;
    728 
     751     
    729752      //Most mobile browsing is done on smartphones
    730753      if ($this->DetectSmartphone() == $this->true)
     
    752775       if (stripos($this->useragent, $this->mobile) > -1)
    753776         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;
    754782
    755783      else
     
    953981      if ($this->DetectMobileQuick() == $this->true)
    954982      {
    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))
    956986           return $this->false;
    957987           
     
    9701000           return $this->true;
    9711001        if (stripos($this->useragent, $this->engineTelecaQ) > -1)
    972            return $this->true; 
    973           
     1002           return $this->true;
     1003         
    9741004        //default
    9751005        else
     
    9981028}
    9991029
    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.