Make WordPress Core

Ticket #49653: 49653.diff

File 49653.diff, 3.6 KB (added by afragen, 5 years ago)
  • wp-admin/includes/ajax-actions.php

    diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
    index ea33d9d792..adc11ea021 100644
    a b function wp_ajax_query_themes() { 
    35713571                        )
    35723572                );
    35733573
    3574                 $theme->num_ratings = number_format_i18n( $theme->num_ratings );
    3575                 $theme->preview_url = set_url_scheme( $theme->preview_url );
     3574                $theme->num_ratings    = number_format_i18n( $theme->num_ratings );
     3575                $theme->preview_url    = set_url_scheme( $theme->preview_url );
     3576                $theme->wp_compatible  = is_wp_version_compatible( $theme->requires );
     3577                $theme->php_compatible = is_php_version_compatible( $theme->requires_php );
    35763578        }
    35773579
    35783580        wp_send_json_success( $api );
  • wp-admin/theme-install.php

    diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php
    index 944e9d7d0a..1516b792a9 100644
    a b if ( $tab ) { 
    293293                                        <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
    294294                                <# } #>
    295295                        <# } else { #>
    296                                 <?php
    297                                 /* translators: %s: Theme name. */
    298                                 $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' );
    299                                 ?>
    300                                 <a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
    301                                 <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     296                                <# if ( data.wp_compatible  && data.php_compatible ) { #>
     297                                        <# /* translators: %s: Theme name. */ #>
     298                                        <# <?php $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' ); ?> #>
     299                                        <a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
     300                                        <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
     301                                <# } else { #>
     302                                        <# /* translators: %s: Theme name. */ #>
     303                                        <# <?php $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' ); ?> #>
     304                                        <a class="button button-primary disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
     305                                        <button class="button preview disabled"><?php _e( 'Preview' ); ?></button>
     306                                <# } #>
    302307                        <# } #>
    303308                </div>
    304309        </div>
    if ( $tab ) { 
    315320                        <button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button>
    316321                        <button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button>
    317322                        <# if ( data.installed ) { #>
    318                                 <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
     323                                <# if ( data.wp_compatible  && data.php_compatible ) { #>
     324                                        <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
     325                                <# } else { #>
     326                                        <a class="button button-primary activate disabled" ><?php _e( 'Activate' ); ?></a>
     327                                <# } #>
    319328                        <# } else { #>
    320                                 <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
     329                                <# if ( data.wp_compatible  && data.php_compatible ) { #>
     330                                        <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
     331                                <# } else { #>
     332                                        <a class="button button-primary disabled" ><?php _e( 'Install' ); ?></a>
     333                                <# } #>
    321334                        <# } #>
    322335                </div>
    323336                <div class="wp-full-overlay-sidebar-content">