WordPress.org

Plugin Directory

Changeset 383460


Ignore:
Timestamp:
05/11/11 05:34:06 (3 years ago)
Author:
MartyThornley
Message:

Fixed detection of iOS 4 for iPhone and iPad

Location:
php-browser-detection/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • php-browser-detection/trunk/php-browser-detection.php

    r290546 r383460  
    44Plugin URI: http://martythornley.com/downloads/php-browser-info 
    55Description: Use PHP to detect browsers for conditional CSS or to detect mobile phones. 
    6 Version: 2.0 
     6Version: 2.1 
    77Author: Marty Thornley 
    88Author URI: http://martythornley.com 
     
    243243function is_iphone ($version=''){ 
    244244    $browserInfo = php_browser_info(); 
    245     if(isset($browserInfo['browser']) && $browserInfo['browser']=='iPhone') { 
     245    if( ( isset($browserInfo['browser']) && $browserInfo['browser']=='iPhone' ) || strpos( $_SERVER['HTTP_USER_AGENT'] , 'iPhone') ) { 
    246246        if ($version == '') : 
    247247            return true; 
     
    258258function is_ipad ($version=''){ 
    259259    $browserInfo = php_browser_info(); 
    260     if (preg_match("/iPad/", $browserInfo['browser_name_pattern'], $matches)) { 
     260    if ( preg_match("/iPad/", $browserInfo['browser_name_pattern'], $matches) || strpos( $_SERVER['HTTP_USER_AGENT'] , 'iPad') ) { 
    261261        if ($version == '') : 
    262262            return true; 
  • php-browser-detection/trunk/readme.txt

    r290853 r383460  
    8383 
    8484* fixed path info to work with 'mu-plugins' folder, version 2.0 didn't know how to find it. 
     85* better recognition of iPad and iPhone with iOS 4 
    8586 
    8687= 2.0 = 
Note: See TracChangeset for help on using the changeset viewer.