diff --git src/wp-admin/css/dashboard.css src/wp-admin/css/dashboard.css
index 0353da7..43d1ccb 100644
|
|
a.rsswidget { |
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | /* PHP Nag */ |
1120 | | #dashboard_php_nag h2.hndle { |
1121 | | border-left: 4px solid #dc3232; |
| 1120 | #dashboard_php_nag .dashicons-warning { |
| 1121 | color: #df3232; |
| 1122 | padding-right: 6px; |
1122 | 1123 | } |
1123 | 1124 | |
1124 | 1125 | #dashboard_php_nag h3 { |
1125 | 1126 | font-weight: 600; |
1126 | 1127 | } |
1127 | 1128 | |
1128 | | #dashboard_php_nag .button.button-hero { |
1129 | | display: block; |
| 1129 | #dashboard_php_nag .button-container { |
1130 | 1130 | text-align: center; |
1131 | 1131 | } |
1132 | 1132 | |
| 1133 | #dashboard_php_nag .button.button-hero .dashicons-external { |
| 1134 | line-height: 42px; |
| 1135 | } |
| 1136 | |
1133 | 1137 | /* =Media Queries |
1134 | 1138 | -------------------------------------------------------------- */ |
1135 | 1139 | |
diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
index 7a268ab..5b3240f 100644
|
|
function wp_dashboard_setup() { |
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | | // PHP Version |
| 38 | // PHP Version. |
39 | 39 | $response = wp_check_php_version(); |
40 | | if ( $response && ! $response['is_acceptable'] && current_user_can( 'upgrade_php' ) ) { |
41 | | $title = $response['is_secure'] ? __( 'Your site could be much faster!' ) : __( 'Your site could be much faster and more secure!' ); |
42 | | wp_add_dashboard_widget( 'dashboard_php_nag', $title, 'wp_dashboard_php_nag' ); |
| 40 | if ( $response && isset( $response['is_acceptable'] ) && ! $response['is_acceptable'] && current_user_can( 'upgrade_php' ) ) { |
| 41 | wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Required' ), 'wp_dashboard_php_nag' ); |
43 | 42 | } |
44 | 43 | |
45 | 44 | // Right Now |
… |
… |
function wp_dashboard_php_nag() { |
1618 | 1617 | return; |
1619 | 1618 | } |
1620 | 1619 | |
1621 | | $information_url = _x( 'https://wordpress.org/support/upgrade-php/', 'localized PHP upgrade information page' ); |
1622 | | |
1623 | | if ( ! $response['is_secure'] ) { |
1624 | | $msg = __( 'WordPress has detected that your site is running on an insecure version of PHP, which is why we’re showing you this notice.' ); |
| 1620 | if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) { |
| 1621 | $msg = __( 'WordPress has detected that your site is running on an insecure version of PHP, which means that a faster website is just a quick update away.' ); |
1625 | 1622 | } else { |
1626 | | $msg = __( 'WordPress has detected that your site is running on an outdated version of PHP, which is why we’re showing you this notice.' ); |
| 1623 | $msg = __( 'WordPress has detected that your site is running on an outdated version of PHP, which means that a faster website is just a quick update away.' ); |
1627 | 1624 | } |
1628 | 1625 | |
1629 | 1626 | ?> |
1630 | 1627 | <p><?php echo $msg; ?></p> |
1631 | 1628 | |
1632 | | <h3><?php _e( 'What is PHP and why should I care?' ); ?></h3> |
1633 | | <p><?php _e( 'PHP is the programming language that WordPress is built on. Newer versions of PHP are both faster and more secure, so upgrading is better for your site, and better for the people who are building WordPress.' ); ?></p> |
1634 | | <p><?php _e( 'If you want to know exactly how PHP works and why it is important, continue reading.' ); ?></p> |
| 1629 | <h3><?php _e( 'What is PHP and how does it affect my site?' ); ?></h3> |
| 1630 | <p><?php _e( 'PHP is the programming language we use to build and maintain WordPress. Newer versions of PHP are both faster and more secure, so updating will have a positive effect on your site’s performance.' ); ?></p> |
1635 | 1631 | |
1636 | | <h3><?php _e( 'How can I upgrade my PHP version?' ); ?></h3> |
1637 | | <p><?php _e( 'The button below will take you to a page with more details on what PHP is, how to upgrade your PHP version, and what to do if it turns out you can’t.' ); ?></p> |
1638 | | <p> |
1639 | | <a class="button button-primary button-hero" href="<?php echo esc_url( $information_url ); ?>"><?php _e( 'Show me how to upgrade my PHP' ); ?></a> |
| 1632 | <h3><?php _e( 'How can I update my PHP version?' ); ?></h3> |
| 1633 | <p><?php _e( 'Click the button below to head to an update page with additional details on PHP, how to update your version, and what to do in case you can’t update your site.' ); ?></p> |
| 1634 | <p class="button-container"> |
| 1635 | <?php |
| 1636 | printf( |
| 1637 | '<a class="button button-primary button-hero" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>', |
| 1638 | esc_url( _x( 'https://wordpress.org/support/upgrade-php/', 'localized PHP upgrade information page' ) ), |
| 1639 | __( 'Learn more about updating PHP' ), |
| 1640 | /* translators: accessibility text */ |
| 1641 | __( '(opens in a new tab)' ) |
| 1642 | ); |
| 1643 | ?> |
1640 | 1644 | </p> |
1641 | | |
1642 | | <p><?php _e( 'Upgrading usually takes only a few minutes and should be safe if you follow the provided instructions.' ); ?></p> |
| 1645 | <p><?php _e( 'Updating your PHP version normally takes just a few minutes. The instructions we provide will help you with a secure, painless update.' ); ?></p> |
1643 | 1646 | <?php |
1644 | 1647 | } |
1645 | 1648 | |
… |
… |
function wp_dashboard_php_nag() { |
1648 | 1651 | * |
1649 | 1652 | * @since 5.0.0 |
1650 | 1653 | * |
1651 | | * @return array Array of PHP version data. |
| 1654 | * @return array|false $response Array of PHP version data. False on failure. |
1652 | 1655 | */ |
1653 | 1656 | function wp_check_php_version() { |
1654 | 1657 | $version = phpversion(); |
1655 | | $key = md5( $version ); |
| 1658 | |
| 1659 | if ( false === $version ) { |
| 1660 | return false; |
| 1661 | } |
| 1662 | |
| 1663 | $key = md5( $version ); |
1656 | 1664 | |
1657 | 1665 | $response = get_site_transient( 'php_check_' . $key ); |
1658 | 1666 | if ( false === $response ) { |
… |
… |
function wp_check_php_version() { |
1665 | 1673 | |
1666 | 1674 | $response = wp_remote_get( $url ); |
1667 | 1675 | |
1668 | | if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
| 1676 | if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { |
1669 | 1677 | return false; |
1670 | 1678 | } |
1671 | 1679 | |
1672 | 1680 | /** |
1673 | 1681 | * Response should be an array with: |
1674 | | * 'recommended_version' - string - The PHP version recommended by WordPress |
1675 | | * 'is_supported' - boolean - Whether the PHP version is actively supported |
1676 | | * 'is_secure' - boolean - Whether the PHP version receives security updates |
1677 | | * 'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress |
| 1682 | * 'recommended_version' - string - The PHP version recommended by WordPress. |
| 1683 | * 'is_supported' - boolean - Whether the PHP version is actively supported. |
| 1684 | * 'is_secure' - boolean - Whether the PHP version receives security updates. |
| 1685 | * 'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress. |
1678 | 1686 | */ |
1679 | 1687 | $response = json_decode( wp_remote_retrieve_body( $response ), true ); |
1680 | 1688 | |
diff --git src/wp-admin/includes/template.php src/wp-admin/includes/template.php
index 16cf63d..016d6ab 100644
|
|
function do_meta_boxes( $screen, $context, $object ) { |
1140 | 1140 | echo '<span class="toggle-indicator" aria-hidden="true"></span>'; |
1141 | 1141 | echo '</button>'; |
1142 | 1142 | } |
1143 | | echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n"; |
| 1143 | echo '<h2 class="hndle">'; |
| 1144 | if ( 'dashboard_php_nag' === $box['id'] ) { |
| 1145 | echo '<span class="screen-reader-text">' . __( 'Warning:' ) . '</span>'; |
| 1146 | echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>'; |
| 1147 | } |
| 1148 | echo "<span>{$box['title']}</span>"; |
| 1149 | echo "</h2>\n"; |
1144 | 1150 | echo '<div class="inside">' . "\n"; |
1145 | 1151 | call_user_func( $box['callback'], $object, $box ); |
1146 | 1152 | echo "</div>\n"; |