General: Improve the PHP update notice annotation.
This change introduces the `wp_get_update_php_annotation()` function, which returns the message displayed when a host filters the direct PHP update or PHP update education URLs to indicate the information is site specific and provided by the host, not WordPress core. It also updates `wp_update_php_annotation()` to accept a `$before` and `$after` parameter, which makes this notice more flexible for displaying in multiple locations within the admin area. Previously, the markup output in `wp_update_php_annotation()` was hardcoded, which was making it difficult to display it properly in multiple locations. Props afragen, aaroncampbell, flixos90, TimothyBlynJacobs, desrosj. Fixes #46044. Built from https://develop.svn.wordpress.org/trunk@44935 git-svn-id: http://core.svn.wordpress.org/trunk@44766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5a10d82b33
commit
53f212ebbe
|
@ -6803,22 +6803,42 @@ function wp_get_default_update_php_url() {
|
|||
* annotation if the web host has altered the default "Update PHP" page URL.
|
||||
*
|
||||
* @since 5.1.0
|
||||
* @since 5.2.0 Added the `$before` and `$after` parameters.
|
||||
*
|
||||
* @param string $before Markup to output before the annotation. Default `<p class="description">`.
|
||||
* @param string $after Markup to output after the annotation. Default `</p>`.
|
||||
*/
|
||||
function wp_update_php_annotation() {
|
||||
function wp_update_php_annotation( $before = '<p class="description">', $after = '</p>' ) {
|
||||
$annotation = wp_get_update_php_annotation();
|
||||
|
||||
echo $before . $annotation . $after;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default annotation for the web hosting altering the "Update PHP" page URL.
|
||||
*
|
||||
* This function is to be used after {@see wp_get_update_php_url()} to return a consistent
|
||||
* annotation if the web host has altered the default "Update PHP" page URL.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @return string $message Update PHP page annotation. An empty string if no custom URLs are provided.
|
||||
*/
|
||||
function wp_get_update_php_annotation() {
|
||||
$update_url = wp_get_update_php_url();
|
||||
$default_url = wp_get_default_update_php_url();
|
||||
|
||||
if ( $update_url === $default_url ) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
echo '<p class="description">';
|
||||
printf(
|
||||
$annotation = sprintf(
|
||||
/* 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>';
|
||||
|
||||
return $annotation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.2-alpha-44934';
|
||||
$wp_version = '5.2-alpha-44935';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue