Make WordPress Core

Changeset 48637


Ignore:
Timestamp:
07/27/2020 02:24:19 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Themes: Display a message in Details & Preview modal on Add Themes screen 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/theme-install.php

    r48520 r48637  
    399399                                                        <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
    400400                                                <# } #>
     401
    401402                                                <div class="theme-version">
    402403                                                        <?php
     
    405406                                                        ?>
    406407                                                </div>
     408
     409                                                <# if ( ! data.compatible_wp || ! data.compatible_php ) { #>
     410                                                        <div class="notice notice-error notice-alt notice-large"><p>
     411                                                                <# if ( ! data.compatible_wp && ! data.compatible_php ) { #>
     412                                                                        <?php
     413                                                                        _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
     414                                                                        if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     415                                                                                printf(
     416                                                                                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     417                                                                                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     418                                                                                        self_admin_url( 'update-core.php' ),
     419                                                                                        esc_url( wp_get_update_php_url() )
     420                                                                                );
     421                                                                                wp_update_php_annotation( '</p><p><em>', '</em>' );
     422                                                                        } elseif ( current_user_can( 'update_core' ) ) {
     423                                                                                printf(
     424                                                                                        /* translators: %s: URL to WordPress Updates screen. */
     425                                                                                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     426                                                                                        self_admin_url( 'update-core.php' )
     427                                                                                );
     428                                                                        } elseif ( current_user_can( 'update_php' ) ) {
     429                                                                                printf(
     430                                                                                        /* translators: %s: URL to Update PHP page. */
     431                                                                                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     432                                                                                        esc_url( wp_get_update_php_url() )
     433                                                                                );
     434                                                                                wp_update_php_annotation( '</p><p><em>', '</em>' );
     435                                                                        }
     436                                                                        ?>
     437                                                                <# } else if ( ! data.compatible_wp ) { #>
     438                                                                        <?php
     439                                                                        _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
     440                                                                        if ( current_user_can( 'update_core' ) ) {
     441                                                                                printf(
     442                                                                                        /* translators: %s: URL to WordPress Updates screen. */
     443                                                                                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     444                                                                                        self_admin_url( 'update-core.php' )
     445                                                                                );
     446                                                                        }
     447                                                                        ?>
     448                                                                <# } else if ( ! data.compatible_php ) { #>
     449                                                                        <?php
     450                                                                        _e( 'This theme doesn&#8217;t work with your version of PHP.' );
     451                                                                        if ( current_user_can( 'update_php' ) ) {
     452                                                                                printf(
     453                                                                                        /* translators: %s: URL to Update PHP page. */
     454                                                                                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     455                                                                                        esc_url( wp_get_update_php_url() )
     456                                                                                );
     457                                                                                wp_update_php_annotation( '</p><p><em>', '</em>' );
     458                                                                        }
     459                                                                        ?>
     460                                                                <# } #>
     461                                                        </p></div>
     462                                                <# } #>
     463
    407464                                                <div class="theme-description">{{{ data.description }}}</div>
    408465                                        </div>
Note: See TracChangeset for help on using the changeset viewer.