WordPress.org

Make WordPress Core

Changeset 51117


Ignore:
Timestamp:
06/08/2021 10:47:00 PM (3 months ago)
Author:
antpb
Message:

Administration: Introduce dashboard notice to discourage use of out of date browser.

If a browser matches Internet Explorer, the dashboard will display a notice recommending a more modern browser.

Props youknowriad, sabernhardt, afercia, SergeyBiryukov, davidbaumwald, netweb, johnbillion, jeherve.
See #48743.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/dashboard.css

    r50571 r51117  
    10271027
    10281028#dashboard_browser_nag p.browser-update-nag.has-browser-icon {
    1029     padding-right: 125px;
     1029    padding-right: 128px;
    10301030}
    10311031
    10321032#dashboard_browser_nag .browser-icon {
    1033     margin-top: -35px;
    1034 }
    1035 
    1036 #dashboard_browser_nag.postbox.browser-insecure {
     1033    margin-top: -32px;
     1034}
     1035
     1036#dashboard_browser_nag.postbox {
    10371037    background-color: #b32d2e;
     1038    background-image: none;
    10381039    border-color: #b32d2e;
    1039 }
    1040 
    1041 #dashboard_browser_nag.postbox {
    1042     background-color: #dba617;
    1043     background-image: none;
    1044     border-color: #f0c33c;
    10451040    color: #fff;
    10461041    box-shadow: none;
    10471042}
    10481043
    1049 #dashboard_browser_nag.postbox.browser-insecure h2 {
    1050     border-bottom-color: #e65054;
    1051     color: #fff;
    1052 }
    1053 
    10541044#dashboard_browser_nag.postbox h2 {
    1055     border-bottom-color: #f5e6ab;
     1045    border-bottom-color: transparent;
    10561046    background: transparent none;
    10571047    color: #fff;
     
    10611051#dashboard_browser_nag a {
    10621052    color: #fff;
     1053}
     1054
     1055#dashboard_browser_nag.postbox .postbox-header {
     1056    border-color: transparent;
    10631057}
    10641058
  • trunk/src/wp-admin/includes/dashboard.php

    r51025 r51117  
    16591659 *
    16601660 * @since 3.2.0
     1661 * @since 5.8.0 Display special message for Internet Explorer users.
     1662 *
     1663 * @global bool $is_IE
     1664 *
    16611665 */
    16621666function wp_dashboard_browser_nag() {
     1667    global $is_IE;
     1668
    16631669    $notice   = '';
    16641670    $response = wp_check_browser_version();
    16651671
    16661672    if ( $response ) {
    1667         if ( $response['insecure'] ) {
     1673        if ( $is_IE ) {
     1674            $msg = __( "For the best WordPress experience, please use Microsoft Edge or another modern browser instead of Internet Explorer." );
     1675        } elseif ( $response['insecure'] ) {
    16681676            $msg = sprintf(
    16691677                /* translators: %s: Browser name and link. */
     
    16831691            $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src'];
    16841692
    1685             $notice           .= '<div class="alignright browser-icon"><a href="' . esc_attr( $response['update_url'] ) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>';
     1693            $notice .= '<div class="alignright browser-icon"><img src="' . esc_attr( $img_src ) . '" alt="" /></div>';
    16861694            $browser_nag_class = ' has-browser-icon';
    16871695        }
     
    16941702        }
    16951703
    1696         $notice .= '<p>' . sprintf(
    1697             /* translators: 1: Browser update URL, 2: Browser name, 3: Browse Happy URL. */
    1698             __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ),
    1699             esc_attr( $response['update_url'] ),
    1700             esc_html( $response['name'] ),
    1701             esc_url( $browsehappy )
    1702         ) . '</p>';
     1704        if ( $is_IE ) {
     1705            $msg_browsehappy = sprintf(
     1706                /* translators: %s: Browse Happy URL. */
     1707                __( 'Learn how to <a href="%s" class="update-browser-link">browse happy</a>' ),
     1708                esc_url( $browsehappy )
     1709            );
     1710        } else {
     1711            $msg_browsehappy = sprintf(
     1712                /* translators: 1: Browser update URL, 2: Browser name, 3: Browse Happy URL. */
     1713                __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ),
     1714                esc_attr( $response['update_url'] ),
     1715                esc_html( $response['name'] ),
     1716                esc_url( $browsehappy )
     1717            );
     1718        }
     1719
     1720        $notice .= '<p>' . $msg_browsehappy . '</p>';
    17031721        $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>';
    17041722        $notice .= '<div class="clear"></div>';
Note: See TracChangeset for help on using the changeset viewer.