Make WordPress Core


Ignore:
Timestamp:
07/27/2020 01:10:04 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Themes: Display a message in Theme Details modal if a theme requires a higher version of PHP or WordPress.

Props afragen, desrosj, SergeyBiryukov.
See #48491.

File:
1 edited

Legend:

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

    r48520 r48636  
    812812                    <# } #>
    813813
     814                    <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
     815                        <div class="notice notice-error notice-alt notice-large"><p>
     816                            <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
     817                                <?php
     818                                _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
     819                                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     820                                    printf(
     821                                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     822                                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     823                                        self_admin_url( 'update-core.php' ),
     824                                        esc_url( wp_get_update_php_url() )
     825                                    );
     826                                    wp_update_php_annotation( '</p><p><em>', '</em>' );
     827                                } elseif ( current_user_can( 'update_core' ) ) {
     828                                    printf(
     829                                        /* translators: %s: URL to WordPress Updates screen. */
     830                                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     831                                        self_admin_url( 'update-core.php' )
     832                                    );
     833                                } elseif ( current_user_can( 'update_php' ) ) {
     834                                    printf(
     835                                        /* translators: %s: URL to Update PHP page. */
     836                                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     837                                        esc_url( wp_get_update_php_url() )
     838                                    );
     839                                    wp_update_php_annotation( '</p><p><em>', '</em>' );
     840                                }
     841                                ?>
     842                            <# } else if ( ! data.compatibleWP ) { #>
     843                                <?php
     844                                _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
     845                                if ( current_user_can( 'update_core' ) ) {
     846                                    printf(
     847                                        /* translators: %s: URL to WordPress Updates screen. */
     848                                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     849                                        self_admin_url( 'update-core.php' )
     850                                    );
     851                                }
     852                                ?>
     853                            <# } else if ( ! data.compatiblePHP ) { #>
     854                                <?php
     855                                _e( 'This theme doesn&#8217;t work with your version of PHP.' );
     856                                if ( current_user_can( 'update_php' ) ) {
     857                                    printf(
     858                                        /* translators: %s: URL to Update PHP page. */
     859                                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     860                                        esc_url( wp_get_update_php_url() )
     861                                    );
     862                                    wp_update_php_annotation( '</p><p><em>', '</em>' );
     863                                }
     864                                ?>
     865                            <# } #>
     866                        </p></div>
     867                    <# } #>
     868
    814869                    <p class="theme-description">{{{ data.description }}}</p>
    815870
Note: See TracChangeset for help on using the changeset viewer.