Themes: Prevent installation of themes that require a higher version of PHP or WordPress.

Props afragen.
Fixes #49653. See #48491.

git-svn-id: https://develop.svn.wordpress.org/trunk@47819 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-05-18 16:01:38 +00:00
parent 581bc56b16
commit a60b30444f
4 changed files with 42 additions and 14 deletions

View File

@@ -311,12 +311,21 @@ if ( $tab ) {
<# } #>
<# } #>
<# } else { #>
<?php
/* translators: %s: Theme name. */
$aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' );
?>
<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>
<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
<# if ( data.compatible_wp && data.compatible_php ) { #>
<?php
/* translators: %s: Theme name. */
$aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' );
?>
<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>
<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
<# } else { #>
<?php
/* translators: %s: Theme name. */
$aria_label = sprintf( __( 'Cannot Install %s' ), '{{ data.name }}' );
?>
<a class="button button-primary disabled" data-name="{{ data.name }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Install', 'theme' ); ?></a>
<button class="button disabled"><?php _e( 'Preview' ); ?></button>
<# } #>
<# } #>
</div>
</div>
@@ -333,9 +342,17 @@ if ( $tab ) {
<button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button>
<button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button>
<# if ( data.installed ) { #>
<a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
<# if ( data.compatible_wp && data.compatible_php ) { #>
<a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
<# } else { #>
<a class="button button-primary disabled" ><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
<# } #>
<# } else { #>
<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
<# if ( data.compatible_wp && data.compatible_php ) { #>
<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
<# } else { #>
<a class="button button-primary disabled" ><?php _ex( 'Cannot Install', 'theme' ); ?></a>
<# } #>
<# } #>
</div>
<div class="wp-full-overlay-sidebar-content">