Make WordPress Core

Changeset 48636


Ignore:
Timestamp:
07/27/2020 01:10:04 PM (6 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.

Location:
trunk/src/wp-admin
Files:
2 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
  • trunk/src/wp-admin/themes.php

    r48428 r48636  
    693693                                </p>
    694694
     695                                <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #>
     696                                        <div class="notice notice-error notice-alt notice-large"><p>
     697                                                <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #>
     698                                                        <?php
     699                                                        _e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
     700                                                        if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     701                                                                printf(
     702                                                                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     703                                                                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     704                                                                        self_admin_url( 'update-core.php' ),
     705                                                                        esc_url( wp_get_update_php_url() )
     706                                                                );
     707                                                                wp_update_php_annotation( '</p><p><em>', '</em>' );
     708                                                        } elseif ( current_user_can( 'update_core' ) ) {
     709                                                                printf(
     710                                                                        /* translators: %s: URL to WordPress Updates screen. */
     711                                                                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     712                                                                        self_admin_url( 'update-core.php' )
     713                                                                );
     714                                                        } elseif ( current_user_can( 'update_php' ) ) {
     715                                                                printf(
     716                                                                        /* translators: %s: URL to Update PHP page. */
     717                                                                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     718                                                                        esc_url( wp_get_update_php_url() )
     719                                                                );
     720                                                                wp_update_php_annotation( '</p><p><em>', '</em>' );
     721                                                        }
     722                                                        ?>
     723                                                <# } else if ( ! data.compatibleWP ) { #>
     724                                                        <?php
     725                                                        _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
     726                                                        if ( current_user_can( 'update_core' ) ) {
     727                                                                printf(
     728                                                                        /* translators: %s: URL to WordPress Updates screen. */
     729                                                                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     730                                                                        self_admin_url( 'update-core.php' )
     731                                                                );
     732                                                        }
     733                                                        ?>
     734                                                <# } else if ( ! data.compatiblePHP ) { #>
     735                                                        <?php
     736                                                        _e( 'This theme doesn&#8217;t work with your version of PHP.' );
     737                                                        if ( current_user_can( 'update_php' ) ) {
     738                                                                printf(
     739                                                                        /* translators: %s: URL to Update PHP page. */
     740                                                                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     741                                                                        esc_url( wp_get_update_php_url() )
     742                                                                );
     743                                                                wp_update_php_annotation( '</p><p><em>', '</em>' );
     744                                                        }
     745                                                        ?>
     746                                                <# } #>
     747                                        </p></div>
     748                                <# } #>
     749
    695750                                <# if ( data.actions.autoupdate ) { #>
    696751                                        <?php echo wp_theme_auto_update_setting_template(); ?>
     
    703758                                </div>
    704759                                <# } #>
     760
    705761                                <p class="theme-description">{{{ data.description }}}</p>
    706762
Note: See TracChangeset for help on using the changeset viewer.