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/plugin-install.php

    r44574 r44627  
    763763    if ( ! $compatible_php ) {
    764764        echo '<div class="notice notice-error notice-alt"><p>';
    765         printf(
    766             /* translators: "Updating PHP" page URL */
    767             __( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>, so unfortunately you cannot install it. <a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ),
    768             esc_url( __( 'https://wordpress.org/support/update-php/' ) )
    769         );
    770         echo '</p></div>';
     765        _e( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>.' );
     766        if ( current_user_can( 'update_php' ) ) {
     767            printf(
     768                /* translators: %s: "Update PHP" page URL */
     769                ' ' . __( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ),
     770                esc_url( wp_get_update_php_url() )
     771            );
     772            echo '</p>';
     773            wp_update_php_annotation();
     774        } else {
     775            echo '</p>';
     776        }
     777        echo '</div>';
    771778    }
    772779
Note: See TracChangeset for help on using the changeset viewer.