Plugins: Use centralized API to display information about updating PHP when a plugin requires a higher version.
This changeset uses the API functions introduced in [44476] to link to the resource about updating PHP when highlighting a plugin's required PHP version is not met. It furthermore expands them, introducing a new `wp_update_php_annotation()` function that prints the markup to indicate that the default URL has been altered by the web host, allowing it to be reused universally. Furthermore, this changeset adds missing `update_php` capability checks before displaying the information about updating PHP. Props afragen. Fixes #45986. See #43986, #45686. Built from https://develop.svn.wordpress.org/trunk@44627 git-svn-id: http://core.svn.wordpress.org/trunk@44458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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 '<p class="description">';
|
||||
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, <a href="%s" target="_blank">see the official WordPress documentation</a>.' ),
|
||||
esc_url( $default_url )
|
||||
);
|
||||
echo'</p>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user