Ticket #48491: 48491.4.patch
| File 48491.4.patch, 11.1 KB (added by , 7 years ago) |
|---|
-
wp-admin/includes/theme.php
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 12035e1fc9..108da0e934 100644
a b function wp_prepare_themes_for_js( $themes = null ) { 653 653 } 654 654 655 655 $prepared_themes[ $slug ] = array( 656 'id' => $slug, 657 'name' => $theme->display( 'Name' ), 658 'screenshot' => array( $theme->get_screenshot() ), // @todo multiple 659 'description' => $theme->display( 'Description' ), 660 'author' => $theme->display( 'Author', false, true ), 661 'authorAndUri' => $theme->display( 'Author' ), 662 'version' => $theme->display( 'Version' ), 663 'tags' => $theme->display( 'Tags' ), 664 'parent' => $parent, 665 'active' => $slug === $current_theme, 666 'hasUpdate' => isset( $updates[ $slug ] ), 667 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 668 'update' => get_theme_update_available( $theme ), 669 'actions' => array( 656 'id' => $slug, 657 'name' => $theme->display( 'Name' ), 658 'screenshot' => array( $theme->get_screenshot() ), // @todo multiple 659 'description' => $theme->display( 'Description' ), 660 'author' => $theme->display( 'Author', false, true ), 661 'authorAndUri' => $theme->display( 'Author' ), 662 'version' => $theme->display( 'Version' ), 663 'tags' => $theme->display( 'Tags' ), 664 'requires' => $theme->display( 'Requires' ), 665 'requires_php' => $theme->display( 'RequiresPHP' ), 666 'wp_compatible' => is_wp_version_compatible( $theme->display( 'Requires' ) ), 667 'php_compatible' => is_php_version_compatible( $theme->display( 'RequiresPHP' ) ), 668 'parent' => $parent, 669 'active' => $slug === $current_theme, 670 'hasUpdate' => isset( $updates[ $slug ] ), 671 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 672 'update' => get_theme_update_available( $theme ), 673 'actions' => array( 670 674 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, 671 675 'customize' => $customize_action, 672 676 'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, -
wp-admin/themes.php
diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 082819611b..e500aebfe6 100644
a b foreach ( $themes as $theme ) : 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; ?> … … foreach ( $themes as $theme ) : 361 365 /* translators: %s: Theme name. */ 362 366 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 363 367 ?> 364 <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> 365 <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 366 <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> 367 <?php } ?> 368 <?php if ( $theme['wp_compatible'] && $theme['php_compatible'] ): ?> 369 <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> 370 <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 371 <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> 372 <?php } ?> 373 <?php else : ?> 374 <a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> 375 <a class="button button-primary load-customize hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 376 <?php endif; ?> 368 377 <?php } ?> 369 378 370 379 </div> … … if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) { 491 500 <# } #> 492 501 493 502 <# if ( data.hasUpdate ) { #> 494 <# if ( data.hasPackage ) { #> 495 <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> 503 <# if ( data.wp_compatible && data.php_compatible ) { #> 504 <div class="update-message notice inline notice-warning notice-alt"> 505 <# if ( data.hasPackage ) { #> 506 <p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p></div> 507 <# } else { #> 508 <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div> 509 <# } #> 496 510 <# } else { #> 497 <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div> 511 <div class="notice inline notice-warning notice-alt"> 512 <p><?php _e( 'Update incompatible.' ); ?></p></div> 498 513 <# } #> 499 514 <# } #> 500 515 … … if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) { 528 543 /* translators: %s: Theme name. */ 529 544 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 530 545 ?> 531 <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 532 <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> 546 <# if ( data.wp_compatible && data.php_compatible ) { #> 547 <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 548 <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> 549 <# } else { #> 550 <a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 551 <a class="button button-primary load-customize hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 552 <# } #> 533 553 <# } #> 534 554 </div> 535 555 </div> … … if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) { 571 591 572 592 <# if ( data.hasUpdate ) { #> 573 593 <div class="notice notice-warning notice-alt notice-large"> 574 <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> 575 {{{ data.update }}} 594 <# if ( data.wp_compatible && data.php_compatible ) { #> 595 <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> 596 {{{ data.update }}} 597 <# } else { #> 598 <h3 class="notice-title"><?php _e( 'Update incompatible' ); ?></h3> 599 <p><?php printf( 600 /* translators: %s: WordPress version, %s: PHP version */ 601 __( 'This theme is incompatible with your current installation. This theme requires at least WordPress %s and PHP %s.' ), 602 '{{{ data.requires }}}', 603 '{{{ data.requires_php }}}' 604 ); ?></p> 605 <# } #> 576 606 </div> 577 607 <# } #> 578 608 <p class="theme-description">{{{ data.description }}}</p> … … if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) { 602 632 /* translators: %s: Theme name. */ 603 633 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 604 634 ?> 605 <# if ( data.actions.activate ) { #>635 <# if ( data.actions.activate && data.wp_compatible && data.php_compatible ) { #> 606 636 <a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 637 <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a> 638 <# } else { #> 639 <a class="button disabled" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 640 <a class="button button-primary load-customize hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 607 641 <# } #> 608 <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>609 642 </div> 610 643 611 644 <# if ( ! data.active && data.actions['delete'] ) { #> -
wp-admin/update-core.php
diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index e2696ebf62..aad673c84e 100644
a b function list_theme_updates() { 475 475 <tbody class="plugins"> 476 476 <?php 477 477 foreach ( $themes as $stylesheet => $theme ) { 478 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); 478 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); 479 $compatible_php = is_php_version_compatible( $theme->get( 'RequiresPHP' ) ); 480 $compat = ''; 481 $annotation = ''; 482 if ( ! $compatible_php && current_user_can( 'update_php' ) ) { 483 $compat .= '<br>' . __( 'This update doesn’t work with your version of PHP.' ) . ' '; 484 $compat .= sprintf( 485 /* translators: %s: URL to Update PHP page. */ 486 __( '<a href="%s">Learn more about updating PHP</a>.' ), 487 esc_url( wp_get_update_php_url() ) 488 ); 489 490 $annotation = wp_get_update_php_annotation(); 491 492 if ( $annotation ) { 493 $compat .= '</p><p><em>' . $annotation . '</em>'; 494 } 495 } 479 496 ?> 480 497 <tr> 481 498 <td class="check-column"> 482 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> 483 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> 484 <?php 485 /* translators: %s: Theme name. */ 486 printf( __( 'Select %s' ), $theme->display( 'Name' ) ); 487 ?> 488 </label> 499 <?php if ( $compatible_php ) : ?> 500 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> 501 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> 502 <?php 503 /* translators: %s: Theme name. */ 504 printf( __( 'Select %s' ), $theme->display( 'Name' ) ); 505 ?> 506 </label> 507 <?php endif; ?> 489 508 </td> 490 509 <td class="plugin-title"><p> 491 510 <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> … … function list_theme_updates() { 497 516 $theme->display( 'Version' ), 498 517 $theme->update['new_version'] 499 518 ); 519 echo $compat . $annotation; 500 520 ?> 501 521 </p></td> 502 522 </tr>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)