Index: src/wp-admin/css/dashboard.css =================================================================== --- src/wp-admin/css/dashboard.css (revision 42771) +++ src/wp-admin/css/dashboard.css (working copy) @@ -1116,6 +1116,25 @@ font-size: 16px; } +/* PHP Nag */ +#dashboard_php_nag h2.hndle { + border-left: 4px solid #dc3232; +} + +#dashboard_php_nag h3 { + font-weight: 600; +} + +#dashboard_php_nag .notice-upgrade-button-wrap { + text-align: center; +} + +#dashboard_php_nag .button.button-hero.notice-upgrade-button { + display: block; + margin-bottom: 1em; + text-align: center; +} + /* =Media Queries -------------------------------------------------------------- */ Index: src/wp-admin/includes/dashboard.php =================================================================== --- src/wp-admin/includes/dashboard.php (revision 42771) +++ src/wp-admin/includes/dashboard.php (working copy) @@ -35,6 +35,13 @@ } } + // PHP Version + $response = wp_check_php_version(); + if ( $response && ! $response['is_acceptable'] && current_user_can( 'upgrade_php' ) ) { + $title = ! $response['is_secure'] ? __( 'Your site could be much faster and more secure!' ) : __( 'Your site could be much faster!' ); + wp_add_dashboard_widget( 'dashboard_php_nag', $title, 'wp_dashboard_php_nag' ); + } + // Right Now if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); @@ -178,8 +185,10 @@ $location = 'side'; } + $high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' ); + $priority = 'core'; - if ( 'dashboard_browser_nag' === $widget_id ) { + if ( in_array( $widget_id, $high_priority_widgets, true ) ) { $priority = 'high'; } @@ -1600,6 +1609,107 @@ } /** + * Displays the PHP upgrade nag. + * + * @since 5.0.0 + */ +function wp_dashboard_php_nag() { + $response = wp_check_php_version(); + + if ( ! $response ) { + return; + } + + $information_url = _x( 'https://wordpress.org/support/upgrade-php/', 'localized PHP upgrade information page' ); + + /** + * Filters the URL to environment-specific instructions on how to upgrade the PHP version. + * + * By default, no such URL is provided. + * + * @since 5.0.0 + * + * @param string $update_url PHP version upgrade URL. Default empty string. + */ + $update_url = apply_filters( 'php_update_url', '' ); + + $msg = __( 'Hi, it's your friends at WordPress here.' ); + if ( ! $response['is_secure'] ) { + $msg .= ' ' . __( 'We noticed that your site is running on an insecure version of PHP, which is why we're showing you this notice.' ); + } else { + $msg .= ' ' . __( 'We noticed that your site is running on an outdated version of PHP, which is why we're showing you this notice.' ); + } + + ?> +
+ + + + + + + + + + + + +