From aea4b2765a1273d5e5fd06d9e0e2cf1c1ca331a0 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Tue, 8 Jan 2019 17:26:38 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@44476 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/dashboard.php | 41 ++++++++++++++------- src/wp-includes/functions.php | 55 +++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 12 deletions(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 5ea85f3137..73181282e4 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/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 ) + ); + ?> +

+