Make WordPress Core

Changeset 38467


Ignore:
Timestamp:
08/31/2016 06:41:07 AM (9 years ago)
Author:
wonderboymusic
Message:

General: use a new function, wp_is_IE(), instead of the $is_IE global in a number of places.

See #37699.

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r38307 r38467  
    3131 */
    3232if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() &&
    33      ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
     33     ! ( wp_is_IE() && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
    3434     apply_filters( 'wp_editor_expand', true, $post_type ) ) {
    3535
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r38462 r38467  
    11881188     *
    11891189     * @global WP_Locale $wp_locale
    1190      * @global bool      $is_IE
    11911190     */
    11921191    public function html() {
     
    12281227        add_filter( 'mce_css', array( $this, 'add_editor_style' ) );
    12291228
    1230         if ( ! empty( $GLOBALS['is_IE'] ) ) {
     1229        if ( wp_is_IE() ) {
    12311230            @header( 'X-UA-Compatible: IE=edge' );
    12321231        }
  • trunk/src/wp-admin/includes/media.php

    r38307 r38467  
    17841784 * @global string $type
    17851785 * @global string $tab
    1786  * @global bool   $is_IE
    17871786 * @global bool   $is_opera
    17881787 *
     
    17901789 */
    17911790function media_upload_form( $errors = null ) {
    1792     global $type, $tab, $is_IE, $is_opera;
     1791    global $type, $tab, $is_opera;
    17931792
    17941793    if ( ! _device_can_upload() ) {
  • trunk/src/wp-admin/includes/template.php

    r38414 r38467  
    19461946}
    19471947
    1948 /**
    1949  *
    1950  * @global bool $is_IE
    1951  */
    19521948function _wp_admin_html_begin() {
    1953     global $is_IE;
    1954 
    19551949    $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
    19561950
    1957     if ( $is_IE )
     1951    if ( wp_is_IE() ) {
    19581952        @header('X-UA-Compatible: IE=edge');
     1953    }
    19591954
    19601955?>
  • trunk/src/wp-includes/class-wp-admin-bar.php

    r38035 r38467  
    392392
    393393    /**
    394      *
    395      * @global bool $is_IE
    396394     * @param object $root
    397395     */
    398396    final protected function _render( $root ) {
    399         global $is_IE;
    400 
    401397        // Add browser classes.
    402398        // We have to do this here since admin bar shows on the front end.
    403399        $class = 'nojq nojs';
    404         if ( $is_IE ) {
    405             if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) )
     400        if ( wp_is_IE() ) {
     401            if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) ) {
    406402                $class .= ' ie7';
    407             elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) )
     403            } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) ) {
    408404                $class .= ' ie8';
    409             elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) )
     405            } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) ) {
    410406                $class .= ' ie9';
     407            }
    411408        } elseif ( wp_is_mobile() ) {
    412409            $class .= ' mobile';
  • trunk/src/wp-includes/general-template.php

    r38459 r38467  
    29052905 * @global bool $is_safari
    29062906 * @global bool $is_chrome
    2907  * @global bool $is_IE
    29082907 *
    29092908 * @return bool
    29102909 */
    29112910function user_can_richedit() {
    2912     global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge;
     2911    global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_edge;
    29132912
    29142913    if ( !isset($wp_rich_edit) ) {
     
    29182917            if ( $is_safari ) {
    29192918                $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
    2920             } elseif ( $is_gecko || $is_chrome || $is_IE || $is_edge || ( $is_opera && !wp_is_mobile() ) ) {
     2919            } elseif ( $is_gecko || $is_chrome || wp_is_IE() || $is_edge || ( $is_opera && !wp_is_mobile() ) ) {
    29212920                $wp_rich_edit = true;
    29222921            }
  • trunk/src/wp-includes/link-template.php

    r38462 r38467  
    28972897 *
    28982898 * @since 2.6.0
    2899  *
    2900  * @global bool          $is_IE      Whether the browser matches an Internet Explorer user agent.
    29012899 */
    29022900function get_shortcut_link() {
    2903     global $is_IE;
    2904 
    29052901    $link = '';
    29062902
    2907     if ( $is_IE ) {
     2903    if ( wp_is_IE() ) {
    29082904        /*
    29092905         * Return the old/shorter bookmarklet code for MSIE 8 and lower,
  • trunk/src/wp-includes/media-template.php

    r38424 r38467  
    134134 *
    135135 * @since 3.5.0
    136  *
    137  * @global bool $is_IE
    138136 */
    139137function wp_print_media_templates() {
    140     global $is_IE;
    141138    $class = 'media-modal wp-core-ui';
    142     if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
     139    if ( wp_is_IE() && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false ) {
    143140        $class .= ' ie7';
     141    }
    144142    ?>
    145143    <!--[if lte IE 8]>
  • trunk/src/wp-includes/vars.php

    r37518 r38467  
    140140    return $is_mobile;
    141141}
     142
     143/**
     144 * @since 4.7.0
     145 *
     146 * @global bool $is_IE Whether the current user agent is Internet Explorer
     147 *
     148 * @return bool Return the value of the $is_IE global.
     149 */
     150function wp_is_IE() {
     151    global $is_IE;
     152    return $is_IE;
     153}
Note: See TracChangeset for help on using the changeset viewer.