Make WordPress Core


Ignore:
Timestamp:
01/08/2019 05:26:38 PM (6 years ago)
Author:
flixos90
Message:

General: Make Update PHP notice link customizable.

After [42832], [42891] and [43006], this changeset refines the core notice informing about an outdated PHP version:

  • The link to the Update PHP information page can now be adjusted using either a WP_UPDATE_PHP_URL environment variable, or a new wp_update_php_url filter.
  • If that URL is different from the default one that points to https://wordpress.org/support/update-php/ or its localized equivalent, a note indicates that the linked resource has not been provided by WordPress itself, and the default URL is still linked to as an additional resource.
  • The URL for the default information page has been updated to use the slug update-php instead of upgrade-php.
  • @since annotations have been updated.

Going forward, admin areas that display information related to the PHP version should use the new function wp_get_update_php_url().

Props afragen, fierevere, flixos90, markjaquith, miss_jwo, nerrad, pento, schlessera, SergeyBiryukov, spacedmonkey.
Fixes #45686. See #41191.

File:
1 edited

Legend:

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

    r44420 r44476  
    16101610
    16111611/**
    1612  * Displays the PHP upgrade nag.
    1613  *
    1614  * @since 5.0.0
     1612 * Displays the PHP update nag.
     1613 *
     1614 * @since 5.1.0
    16151615 */
    16161616function wp_dashboard_php_nag() {
     
    16271627    }
    16281628
     1629    $update_url  = wp_get_update_php_url();
     1630    $default_url = wp_get_default_update_php_url();
     1631
    16291632    ?>
    16301633    <p><?php echo $msg; ?></p>
     
    16351638    <p class="button-container">
    16361639        <?php
    1637             printf(
    1638                 '<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>',
    1639                 esc_url( _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page' ) ),
    1640                 __( 'Learn more about updating PHP' ),
    1641                 /* translators: accessibility text */
    1642                 __( '(opens in a new tab)' )
    1643             );
     1640        printf(
     1641            '<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 ),
     1643            __( 'Learn more about updating PHP' ),
     1644            /* translators: accessibility text */
     1645            __( '(opens in a new tab)' )
     1646        );
    16441647        ?>
    16451648    </p>
    16461649    <?php
     1650
     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    }
    16471664}
    16481665
     
    16501667 * Adds an additional class to the PHP nag if the current version is insecure.
    16511668 *
    1652  * @since 5.0.0
     1669 * @since 5.1.0
    16531670 *
    16541671 * @param array $classes Metabox classes.
     
    16661683
    16671684/**
    1668  * Checks if the user needs to upgrade PHP.
    1669  *
    1670  * @since 5.0.0
     1685 * Checks if the user needs to update PHP.
     1686 *
     1687 * @since 5.1.0
    16711688 *
    16721689 * @return array|false $response Array of PHP version data. False on failure.
Note: See TracChangeset for help on using the changeset viewer.