WordPress.org

Make WordPress Core

Ticket #46074: 46074.diff

File 46074.diff, 1.7 KB (added by afragen, 3 years ago)
  • src/wp-admin/includes/dashboard.php

    diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
    index 3a2d3a69f8..1f7ad199d6 100644
    a b function wp_dashboard_php_nag() { 
    16461646        <?php
    16471647
    16481648        wp_update_php_annotation();
     1649        wp_direct_php_update_button();
    16491650}
    16501651
    16511652/**
  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index 214c134d01..de1f672191 100644
    a b function wp_update_php_annotation() { 
    68306830        );
    68316831        echo'</p>';
    68326832}
     6833
     6834/**
     6835 * Provide hosts with a method of directly linking to their respective PHP update processes.
     6836 *
     6837 * @since 5.2.0
     6838 *
     6839 * @return void
     6840 */
     6841function wp_direct_php_update_button() {
     6842        $direct_update_url = null;
     6843        if ( false !== getenv( 'WP_DIRECT_UPDATE_PHP_URL' ) ) {
     6844                $direct_update_url = getenv( 'WP_DIRECT_UPDATE_PHP_URL' );
     6845        }
     6846
     6847        /**
     6848         * Filters the URL for directly updating the PHP version the site is running on from the host.
     6849         *
     6850         * @since 5.2.0
     6851         *
     6852         * @param string $direct_update_url URL to directly updating PHP.
     6853         */
     6854        $direct_update_url = apply_filters( 'wp_direct_php_update_url', $direct_update_url );
     6855        if ( null === $direct_update_url ) {
     6856                return;
     6857        }
     6858
     6859        echo '<p class="button-container">';
     6860        printf(
     6861                '<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>',
     6862                esc_url( $direct_update_url ),
     6863                __( 'Update your site PHP' ),
     6864                /* translators: accessibility text */
     6865                __( '(opens in a new tab)' )
     6866        );
     6867        echo '</p>';
     6868}