From 94fb16f03f7b5f2bcbbbf3ce2a2d4ce0e53c12f0 Mon Sep 17 00:00:00 2001
From: Felix Arntz ';
if ( ! $compatible_php && ! $compatible_wp ) {
_e( 'This plugin doesn’t work with your versions of WordPress and PHP. ' );
- if ( current_user_can( 'update_core' ) ) {
+ if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
printf(
- /* translators: 1: "Update WordPress" screen URL, 2: "Updating PHP" page URL */
+ /* translators: 1: "Update WordPress" screen URL, 2: "Update PHP" page URL */
__( 'Please update WordPress, and then learn more about updating PHP.' ),
self_admin_url( 'update-core.php' ),
- esc_url( __( 'https://wordpress.org/support/update-php/' ) )
+ esc_url( wp_get_update_php_url() )
);
- } else {
+ wp_update_php_annotation();
+ } elseif ( current_user_can( 'update_core' ) ) {
printf(
- /* translators: %s: "Updating PHP" page URL */
- __( 'Learn more about updating PHP.' ),
- esc_url( __( 'https://wordpress.org/support/update-php/' ) )
+ /* translators: %s: "Update WordPress" screen URL */
+ __( 'Please update WordPress.' ),
+ self_admin_url( 'update-core.php' )
);
+ } elseif ( current_user_can( 'update_php' ) ) {
+ printf(
+ /* translators: %s: "Update PHP" page URL */
+ __( 'Learn more about updating PHP.' ),
+ esc_url( wp_get_update_php_url() )
+ );
+ wp_update_php_annotation();
}
} elseif ( ! $compatible_wp ) {
_e( 'This plugin doesn’t work with your version of WordPress. ' );
@@ -660,11 +668,14 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
}
} elseif ( ! $compatible_php ) {
_e( 'This plugin doesn’t work with your version of PHP. ' );
- printf(
- /* translators: %s: "Updating PHP" page URL */
- __( 'Learn more about updating PHP.' ),
- esc_url( __( 'https://wordpress.org/support/update-php/' ) )
- );
+ if ( current_user_can( 'update_php' ) ) {
+ printf(
+ /* translators: %s: "Update PHP" page URL */
+ __( 'Learn more about updating PHP.' ),
+ esc_url( wp_get_update_php_url() )
+ );
+ wp_update_php_annotation();
+ }
}
echo '
- see the official WordPress documentation.' ), - esc_url( $default_url ) - ); - ?> -
-'; - printf( - /* translators: "Updating PHP" page URL */ - __( 'Error: This plugin requires a newer version of PHP, so unfortunately you cannot install it. Click here to learn more about updating PHP.' ), - esc_url( __( 'https://wordpress.org/support/update-php/' ) ) - ); - echo '
'; + _e( 'Error: This plugin requires a newer version of PHP.' ); + if ( current_user_can( 'update_php' ) ) { + printf( + /* translators: %s: "Update PHP" page URL */ + ' ' . __( 'Click here to learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + echo ''; + wp_update_php_annotation(); + } else { + echo ''; + } + echo ''; } if ( ! $tested_wp ) { diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ca91c53e00..9552455d05 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -6716,3 +6716,28 @@ function wp_get_update_php_url() { function wp_get_default_update_php_url() { return _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page' ); } + +/** + * Prints the default annotation for the web host altering the "Update PHP" page URL. + * + * This function is to be used after {@see wp_get_update_php_url()} to display a consistent + * annotation if the web host has altered the default "Update PHP" page URL. + * + * @since 5.1.0 + */ +function wp_update_php_annotation() { + $update_url = wp_get_update_php_url(); + $default_url = wp_get_default_update_php_url(); + + if ( $update_url === $default_url ) { + return; + } + + echo ''; + printf( + /* translators: %s: default Update PHP page URL */ + __( 'This resource is provided by your web host, and is specific to your site. For more information, see the official WordPress documentation.' ), + esc_url( $default_url ) + ); + echo'
'; +} diff --git a/wp-includes/version.php b/wp-includes/version.php index 098883f6db..885e75fea6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta1-44626'; +$wp_version = '5.1-beta1-44627'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.