Skip to content

Commit 7b2793e

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51117 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 69d7762 commit 7b2793e

File tree

2 files changed

+36
-24
lines changed

2 files changed

+36
-24
lines changed

src/wp-admin/css/dashboard.css

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,33 +1026,23 @@ a.rsswidget {
10261026
}
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 {
1037-
background-color: #b32d2e;
1038-
border-color: #b32d2e;
1033+
margin-top: -32px;
10391034
}
10401035

10411036
#dashboard_browser_nag.postbox {
1042-
background-color: #dba617;
1037+
background-color: #b32d2e;
10431038
background-image: none;
1044-
border-color: #f0c33c;
1039+
border-color: #b32d2e;
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;
10581048
box-shadow: none;
@@ -1062,6 +1052,10 @@ a.rsswidget {
10621052
color: #fff;
10631053
}
10641054

1055+
#dashboard_browser_nag.postbox .postbox-header {
1056+
border-color: transparent;
1057+
}
1058+
10651059
#dashboard_browser_nag h2.hndle {
10661060
border: none;
10671061
font-weight: 600;

src/wp-admin/includes/dashboard.php

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,13 +1658,21 @@ function wp_dashboard_quota() {
16581658
* Displays the browser update nag.
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
*/
16621666
function 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. */
16701678
__( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ),
@@ -1682,7 +1690,7 @@ function wp_dashboard_browser_nag() {
16821690
if ( ! empty( $response['img_src'] ) ) {
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
}
16881696
$notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
@@ -1693,13 +1701,23 @@ function wp_dashboard_browser_nag() {
16931701
$browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
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>';
17051723
}

0 commit comments

Comments
 (0)