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.


git-svn-id: https://develop.svn.wordpress.org/trunk@44627 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz
2019-01-16 17:05:37 +00:00
parent 4e9dacc96c
commit 17e5f4ad0b
4 changed files with 63 additions and 35 deletions
+2 -17
View File
@@ -1626,9 +1626,6 @@ 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();
?>
<p><?php echo $msg; ?></p>
@@ -1639,7 +1636,7 @@ function wp_dashboard_php_nag() {
<?php
printf(
'<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
esc_url( $update_url ),
esc_url( wp_get_update_php_url() ),
__( 'Learn more about updating PHP' ),
/* translators: accessibility text */
__( '(opens in a new tab)' )
@@ -1648,19 +1645,7 @@ function wp_dashboard_php_nag() {
</p>
<?php
if ( $update_url !== $default_url ) {
?>
<p class="description">
<?php
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 )
);
?>
</p>
<?php
}
wp_update_php_annotation();
}
/**