Ticket #48491: 48491.4.diff
File 48491.4.diff, 10.8 KB (added by , 4 years ago) |
---|
-
src/wp-admin/includes/theme.php
654 654 } 655 655 656 656 $prepared_themes[ $slug ] = array( 657 'id' => $slug, 658 'name' => $theme->display( 'Name' ), 659 'screenshot' => array( $theme->get_screenshot() ), // @todo Multiple screenshots. 660 'description' => $theme->display( 'Description' ), 661 'author' => $theme->display( 'Author', false, true ), 662 'authorAndUri' => $theme->display( 'Author' ), 663 'version' => $theme->display( 'Version' ), 664 'tags' => $theme->display( 'Tags' ), 665 'parent' => $parent, 666 'active' => $slug === $current_theme, 667 'hasUpdate' => isset( $updates[ $slug ] ), 668 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 669 'update' => get_theme_update_available( $theme ), 670 'actions' => array( 657 'id' => $slug, 658 'name' => $theme->display( 'Name' ), 659 'screenshot' => array( $theme->get_screenshot() ), // @todo Multiple screenshots. 660 'description' => $theme->display( 'Description' ), 661 'author' => $theme->display( 'Author', false, true ), 662 'authorAndUri' => $theme->display( 'Author' ), 663 'version' => $theme->display( 'Version' ), 664 'tags' => $theme->display( 'Tags' ), 665 'requires' => $theme->display( 'Requires' ), 666 'requires_php' => $theme->display( 'RequiresPHP' ), 667 'wp_compatible' => is_wp_version_compatible( $theme->display( 'Requires' ) ), 668 'php_compatible' => is_php_version_compatible( $theme->display( 'RequiresPHP' ) ), 669 'parent' => $parent, 670 'active' => $slug === $current_theme, 671 'hasUpdate' => isset( $updates[ $slug ] ), 672 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 673 'update' => get_theme_update_available( $theme ), 674 'actions' => array( 671 675 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, 672 676 'customize' => $customize_action, 673 677 'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, -
src/wp-admin/themes.php
323 323 324 324 <?php if ( $theme['hasUpdate'] ) : ?> 325 325 <div class="update-message notice inline notice-warning notice-alt"> 326 <?php if ( $theme['hasPackage'] ) : ?> 327 <p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p> 326 <?php if ( $theme['wp_compatible'] && $theme['php_compatible'] ): ?> 327 <?php if ( $theme['hasPackage'] ) : ?> 328 <p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p> 329 <?php else : ?> 330 <p><?php _e( 'New version available.' ); ?></p> 331 <?php endif; ?> 328 332 <?php else : ?> 329 <p><?php _e( ' New version available.' ); ?></p>333 <p><?php _e( 'Version update incompatible.' ); ?></p> 330 334 <?php endif; ?> 331 335 </div> 332 336 <?php endif; ?> … … 358 362 /* translators: %s: Theme name. */ 359 363 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 360 364 ?> 361 <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> 362 <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 363 <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> 364 <?php } ?> 365 <?php if ( $theme['wp_compatible'] && $theme['php_compatible'] ): ?> 366 <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> 367 <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 368 <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> 369 <?php } ?> 370 <?php else : ?> 371 <a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> 372 <a class="button button-primary load-customize hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 373 <?php endif; ?> 365 374 <?php } ?> 366 375 367 376 </div> … … 488 497 <# } #> 489 498 490 499 <# if ( data.hasUpdate ) { #> 491 <# if ( data.hasPackage ) { #> 492 <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p></div> 500 <# if ( data.wp_compatible && data.php_compatible ) { #> 501 <div class="update-message notice inline notice-warning notice-alt"> 502 <# if ( data.hasPackage ) { #> 503 <p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p></div> 504 <# } else { #> 505 <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div> 506 <# } #> 493 507 <# } else { #> 494 <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div> 508 <div class="notice inline notice-warning notice-alt"> 509 <p><?php _e( 'Update incompatible.' ); ?></p></div> 495 510 <# } #> 496 511 <# } #> 497 512 … … 522 537 /* translators: %s: Theme name. */ 523 538 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 524 539 ?> 525 <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 526 <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> 540 <# if ( data.wp_compatible && data.php_compatible ) { #> 541 <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 542 <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> 543 <# } else { #> 544 <a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 545 <a class="button button-primary load-customize hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 546 <# } #> 527 547 <# } #> 528 548 </div> 529 549 </div> … … 565 585 566 586 <# if ( data.hasUpdate ) { #> 567 587 <div class="notice notice-warning notice-alt notice-large"> 568 <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> 569 {{{ data.update }}} 588 <# if ( data.wp_compatible && data.php_compatible ) { #> 589 <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> 590 {{{ data.update }}} 591 <# } else { #> 592 <h3 class="notice-title"><?php _e( 'Update incompatible' ); ?></h3> 593 <p><?php printf( 594 /* translators: %s: WordPress version, %s: PHP version */ 595 __( 'This theme is incompatible with your current installation. This theme requires at least WordPress %s and PHP %s.' ), 596 '{{{ data.requires }}}', 597 '{{{ data.requires_php }}}' 598 ); ?></p> 599 <# } #> 570 600 </div> 571 601 <# } #> 572 602 <p class="theme-description">{{{ data.description }}}</p> … … 596 626 /* translators: %s: Theme name. */ 597 627 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 598 628 ?> 599 <# if ( data.actions.activate ) { #>629 <# if ( data.actions.activate && data.wp_compatible && data.php_compatible ) { #> 600 630 <a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 631 <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a> 632 <# } else { #> 633 <a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 634 <a class="button button-primary load-customize hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 601 635 <# } #> 602 <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>603 636 </div> 604 637 605 638 <# if ( ! data.active && data.actions['delete'] ) { #> -
src/wp-admin/update-core.php
479 479 <tbody class="plugins"> 480 480 <?php 481 481 foreach ( $themes as $stylesheet => $theme ) { 482 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); 482 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); 483 $compatible_php = is_php_version_compatible( $theme->get( 'RequiresPHP' ) ); 484 $compat = ''; 485 $annotation = ''; 486 if ( ! $compatible_php && current_user_can( 'update_php' ) ) { 487 $compat .= '<br>' . __( 'This update doesn’t work with your version of PHP.' ) . ' '; 488 $compat .= sprintf( 489 /* translators: %s: URL to Update PHP page. */ 490 __( '<a href="%s">Learn more about updating PHP</a>.' ), 491 esc_url( wp_get_update_php_url() ) 492 ); 493 494 $annotation = wp_get_update_php_annotation(); 495 496 if ( $annotation ) { 497 $compat .= '</p><p><em>' . $annotation . '</em>'; 498 } 499 } 483 500 ?> 484 501 <tr> 485 502 <td class="check-column"> 486 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> 487 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> 488 <?php 489 /* translators: %s: Theme name. */ 490 printf( __( 'Select %s' ), $theme->display( 'Name' ) ); 491 ?> 492 </label> 503 <?php if ( $compatible_php ) : ?> 504 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> 505 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> 506 <?php 507 /* translators: %s: Theme name. */ 508 printf( __( 'Select %s' ), $theme->display( 'Name' ) ); 509 ?> 510 </label> 511 <?php endif; ?> 493 512 </td> 494 513 <td class="plugin-title"><p> 495 514 <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> … … 501 520 $theme->display( 'Version' ), 502 521 $theme->update['new_version'] 503 522 ); 523 echo $compat . $annotation; 504 524 ?> 505 525 </p></td> 506 526 </tr>