WordPress.org

Make WordPress Core

Ticket #14537: 14537.6.patch

File 14537.6.patch, 1.2 KB (added by hakre, 8 years ago)

Preserves $is_IE, Fixes #14954, has filter, seperates concerns, introduces $is_chromeframe.

  • wp-includes/vars.php

     
    3535}
    3636
    3737// Simple browser detection
    38 $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;
     38$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = $is_chromeframe = false;
    3939
    4040if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
     41        $is_chromeframe = false !== strpos($_SERVER['HTTP_USER_AGENT'], 'chromeframe');
    4142        if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
    4243                $is_lynx = true;
    43         } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
     44        } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false && $is_chromeframe === false ) {
    4445                $is_chrome = true;
    4546        } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) {
    4647                $is_safari = true;
     
    6263
    6364$is_IE = ( $is_macIE || $is_winIE );
    6465
     66// Google Chrome Frame Support
     67if ( $is_chromeframe && apply_filters( 'use_google_chrome_frame', is_admin() ) )
     68                header('X-UA-Compatible: chrome=1');
     69
    6570// Server detection
    6671
    6772/**