WordPress.org

Make WordPress Core

Ticket #45686: 45686.diff

File 45686.diff, 3.0 KB (added by flixos90, 20 months ago)
  • src/wp-admin/includes/dashboard.php

     
    16091609}
    16101610
    16111611/**
    1612  * Displays the PHP upgrade nag.
     1612 * Displays the PHP update nag.
    16131613 *
    1614  * @since 5.0.0
     1614 * @since 5.1.0
    16151615 */
    16161616function wp_dashboard_php_nag() {
    16171617        $response = wp_check_php_version();
     
    16361636                <?php
    16371637                        printf(
    16381638                                '<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/upgrade-php/', 'localized PHP upgrade information page' ) ),
     1639                                esc_url( wp_get_update_php_url() ),
    16401640                                __( 'Learn more about updating PHP' ),
    16411641                                /* translators: accessibility text */
    16421642                                __( '(opens in a new tab)' )
     
    16491649/**
    16501650 * Adds an additional class to the PHP nag if the current version is insecure.
    16511651 *
    1652  * @since 5.0.0
     1652 * @since 5.1.0
    16531653 *
    16541654 * @param array $classes Metabox classes.
    16551655 * @return array Modified metabox classes.
     
    16651665}
    16661666
    16671667/**
    1668  * Checks if the user needs to upgrade PHP.
     1668 * Checks if the user needs to update PHP.
    16691669 *
    1670  * @since 5.0.0
     1670 * @since 5.1.0
    16711671 *
    16721672 * @return array|false $response Array of PHP version data. False on failure.
    16731673 */
  • src/wp-includes/functions.php

     
    65196519                }
    65206520        }
    65216521}
     6522
     6523/**
     6524 * Gets the URL to learn more about updating the PHP version the site is running on.
     6525 *
     6526 * This URL can be overridden by specifying an environment variable `WP_UPDATE_PHP_URL` or by using the
     6527 * {@see 'wp_update_php_url'} filter. Providing an empty string is not allowed and will result in the
     6528 * default URL being used. Furthermore the page the URL links to should preferably be localized in the
     6529 * site language.
     6530 *
     6531 * @since 5.1.0
     6532 *
     6533 * @return string URL to learn more about updating PHP.
     6534 */
     6535function wp_get_update_php_url() {
     6536        $default_url = _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page' );
     6537
     6538        $update_url = $default_url;
     6539        if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) {
     6540                $update_url = getenv( 'WP_UPDATE_PHP_URL' );
     6541        }
     6542
     6543        /**
     6544         * Filters the URL to learn more about updating the PHP version the site is running on.
     6545         *
     6546         * Providing an empty string is not allowed and will result in the default URL being used. Furthermore
     6547         * the page the URL links to should preferably be localized in the site language.
     6548         *
     6549         * @since 5.1.0
     6550         *
     6551         * @param string $update_url URL to learn more about updating PHP.
     6552         */
     6553        $update_url = apply_filters( 'wp_update_php_url', $update_url );
     6554
     6555        if ( empty( $update_url ) ) {
     6556                $update_url = $default_url;
     6557        }
     6558
     6559        return $update_url;
     6560}