Making WordPress.org

Changeset 5971


Ignore:
Timestamp:
09/28/2017 04:30:41 PM (7 years ago)
Author:
coffee2code
Message:

Browse Happy API: Improve Windows Phone OS recognition, particularly for more modern Microsoft browsers.

Location:
sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/parse.php

    r5967 r5971  
    4040
    4141    if ( preg_match(
    42         '/^.+?(?P<platform>Android|iPhone|iPad|Windows|Linux|Macintosh|Windows Phone OS|RIM Tablet OS|PlayBook)(?: (NT|zvav))*(?: [ix]?[0-9._]+)*(;|\))/im',
     42        '/^.+?(?P<platform>Windows Phone( OS)?|Android|iPhone|iPad|Windows|Linux|Macintosh|RIM Tablet OS|PlayBook)(?: (NT|zvav))*(?: [ix]?[0-9._]+)*(;|\))/im',
    4343        $user_agent,
    4444        $regs
     
    5050    if ( 'Linux' === $data['platform'] && false !== strpos( $user_agent, 'Android' ) ) {
    5151        $data['platform'] = 'Android';
     52    } elseif ( 'Windows Phone' === $data['platform'] ) {
     53        $data['platform'] = 'Windows Phone OS';
    5254    }
    5355
     
    116118        // IE 11 and beyond have switched to Trident
    117119        // http://msdn.microsoft.com/en-us/library/ie/hh869301%28v=vs.85%29.aspx
    118         $data['name'] = 'Internet Explorer';
    119         if( '7.0' == $result['version'][0] ) {
     120        if ( $key = array_search( 'IEMobile', $result['name'] ) ) {
     121            $data['name'] = 'Internet Explorer Mobile';
     122        } else {
     123            $data['name'] = 'Internet Explorer';
     124        }
     125        if ( '7.0' == $result['version'][0] ) {
    120126            $data['version'] = '11';
    121127        }
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/tests/phpunit/tests/browse-happy.php

    r5970 r5971  
    220220                'Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) LG;LG-E900h)',
    221221                'Windows Phone OS Internet Explorer Mobile 7.0',
     222            ],
     223            [
     224                'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)',
     225                'Windows Phone OS Internet Explorer Mobile 9.0',
     226            ],
     227            [
     228                'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)',
     229                'Windows Phone OS Internet Explorer Mobile 10.0',
     230            ],
     231            [
     232                'Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; Microsoft; Lumia 435) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537',
     233                'Windows Phone OS Internet Explorer Mobile 11',
     234            ],
     235            [
     236                'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like Gecko',
     237                'Windows Phone OS Internet Explorer Mobile 11',
    222238            ],
    223239
Note: See TracChangeset for help on using the changeset viewer.