WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/16/2019 05:05:37 PM (23 months ago)
Author:
flixos90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r44485 r44627  
    16271627    }
    16281628
    1629     $update_url  = wp_get_update_php_url();
    1630     $default_url = wp_get_default_update_php_url();
    1631 
    16321629    ?>
    16331630    <p><?php echo $msg; ?></p>
     
    16401637        printf(
    16411638            '<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>',
    1642             esc_url( $update_url ),
     1639            esc_url( wp_get_update_php_url() ),
    16431640            __( 'Learn more about updating PHP' ),
    16441641            /* translators: accessibility text */
     
    16491646    <?php
    16501647
    1651     if ( $update_url !== $default_url ) {
    1652         ?>
    1653         <p class="description">
    1654             <?php
    1655             printf(
    1656                 /* translators: %s: default Update PHP page URL */
    1657                 __( '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>.' ),
    1658                 esc_url( $default_url )
    1659             );
    1660             ?>
    1661         </p>
    1662         <?php
    1663     }
     1648    wp_update_php_annotation();
    16641649}
    16651650
Note: See TracChangeset for help on using the changeset viewer.