Make WordPress Core


Ignore:
Timestamp:
05/18/2020 12:30:04 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Themes: Prevent activation and live preview of themes that require a higher version of PHP or WordPress.

Props afragen, jorbin, TimothyBlynJacobs, SergeyBiryukov.
See #48491.

File:
1 edited

Legend:

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

    r47794 r47816  
    283283
    284284        <div class="theme-actions">
     285            <# console.log( data ); #>
    285286            <# if ( data.installed ) { #>
    286                 <?php
    287                 /* translators: %s: Theme name. */
    288                 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
    289                 ?>
    290                 <# if ( data.activate_url ) { #>
    291                     <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
    292                 <# } #>
    293                 <# if ( data.customize_url ) { #>
    294                     <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
     287                <# if ( data.compatible_wp && data.compatible_php ) { #>
     288                    <?php
     289                    /* translators: %s: Theme name. */
     290                    $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
     291                    ?>
     292                    <# if ( data.activate_url ) { #>
     293                        <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
     294                    <# } #>
     295                    <# if ( data.customize_url ) { #>
     296                        <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
     297                    <# } else { #>
     298                        <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     299                    <# } #>
    295300                <# } else { #>
    296                     <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     301                    <?php
     302                    /* translators: %s: Theme name. */
     303                    $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
     304                    ?>
     305                    <# if ( data.activate_url ) { #>
     306                        <a class="button button-primary disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
     307                    <# } #>
     308                    <# if ( data.customize_url ) { #>
     309                        <a class="button disabled"><?php _e( 'Live Preview' ); ?></a>
     310                    <# } else { #>
     311                        <button class="button disabled"><?php _e( 'Preview' ); ?></button>
     312                    <# } #>
    297313                <# } #>
    298314            <# } else { #>
Note: See TracChangeset for help on using the changeset viewer.