From e08a12d020f60762d87981c4e09e59d7d71a31ce Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Tue, 8 Jan 2019 17:27:50 +0000 Subject: [PATCH] General: Make Update PHP notice link customizable. After [42832], [42891] and [43006], this changeset refines the core notice informing about an outdated PHP version: * The link to the Update PHP information page can now be adjusted using either a `WP_UPDATE_PHP_URL` environment variable, or a new `wp_update_php_url` filter. * If that URL is different from the default one that points to https://wordpress.org/support/update-php/ or its localized equivalent, a note indicates that the linked resource has not been provided by WordPress itself, and the default URL is still linked to as an additional resource. * The URL for the default information page has been updated to use the slug `update-php` instead of `upgrade-php`. * `@since` annotations have been updated. Going forward, admin areas that display information related to the PHP version should use the new function `wp_get_update_php_url()`. Props afragen, fierevere, flixos90, markjaquith, miss_jwo, nerrad, pento, schlessera, SergeyBiryukov, spacedmonkey. Fixes #45686. See #41191. Built from https://develop.svn.wordpress.org/trunk@44476 git-svn-id: http://core.svn.wordpress.org/trunk@44307 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 41 +++++++++++++++++------- wp-includes/functions.php | 55 +++++++++++++++++++++++++++++++++ wp-includes/version.php | 2 +- 3 files changed, 85 insertions(+), 13 deletions(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 5ea85f3137..73181282e4 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -1609,9 +1609,9 @@ function wp_check_browser_version() { } /** - * Displays the PHP upgrade nag. + * Displays the PHP update nag. * - * @since 5.0.0 + * @since 5.1.0 */ function wp_dashboard_php_nag() { $response = wp_check_php_version(); @@ -1626,6 +1626,9 @@ function wp_dashboard_php_nag() { $msg = __( 'WordPress has detected that your site is running on an outdated version of PHP.' ); } + $update_url = wp_get_update_php_url(); + $default_url = wp_get_default_update_php_url(); + ?>

@@ -1634,22 +1637,36 @@ function wp_dashboard_php_nag() {

%2$s %3$s', - esc_url( _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page' ) ), - __( 'Learn more about updating PHP' ), - /* translators: accessibility text */ - __( '(opens in a new tab)' ) - ); + printf( + '%2$s %3$s', + esc_url( $update_url ), + __( 'Learn more about updating PHP' ), + /* translators: accessibility text */ + __( '(opens in a new tab)' ) + ); ?>

+

+ see the official WordPress documentation.' ), + esc_url( $default_url ) + ); + ?> +

+