Making WordPress.org

Ticket #416: 416.diff

File 416.diff, 1.5 KB (added by blobaugh, 10 years ago)

Adds support for IE 11 User Agent string

  • parse.php

     
    1818    if ( preg_match('/^.+?(?P<platform>Android|iPhone|iPad|Windows|Linux|Macintosh|Windows Phone OS|RIM Tablet OS|PlayBook)(?: NT)*(?: [ix]?[0-9._]+)*(;|\))/im', $user_agent, $regs ) )
    1919        $data['platform'] = $regs['platform'];
    2020
    21     preg_match_all( '%(?P<name>Camino|Kindle|Firefox|(?:Mobile )?Safari|MSIE|RockMelt|AppleWebKit|Chrome|IEMobile|Opera|Version)(?:[/ ])(?P<version>[0-9.]+)%im', $user_agent, $result, PREG_PATTERN_ORDER );
     21    preg_match_all( '%(?P<name>Trident|Camino|Kindle|Firefox|(?:Mobile )?Safari|MSIE|RockMelt|AppleWebKit|Chrome|IEMobile|Opera|Version)(?:[/ ])(?P<version>[0-9.]+)%im', $user_agent, $result, PREG_PATTERN_ORDER );
    2222   
    2323    // If Version/x.x.x was specified in UA string store it and ignore it
    2424    if ( $key = array_search( 'Version', $result['name'] ) ) {
     
    5757            $key = 0;
    5858        }
    5959        $data['version'] = $result['version'][ $key ];
    60     } else {
     60    } elseif ( 'Trident' == $result['name'][0] ) {
     61        // IE 11 and beyond have switched to Trident
     62        // http://msdn.microsoft.com/en-us/library/ie/hh869301%28v=vs.85%29.aspx
     63        $data['name'] = 'Internet Explorer';
     64        if( '7.0' == $result['version'][0] ) {
     65                        $data['version'] = '11';
     66                }
     67        } else {
    6168        $data['name'] = $result['name'][0];
    6269        $data['version'] = $result['version'][0];
    6370    }