Ticket #43986: 43986v4.4.diff
| File 43986v4.4.diff, 9.6 KB (added by , 7 years ago) |
|---|
-
src/wp-admin/css/list-tables.css
diff --git src/wp-admin/css/list-tables.css src/wp-admin/css/list-tables.css index 8d78983993..c8302c6071 100644
div.action-links, 1510 1510 content: "\f158"; 1511 1511 } 1512 1512 1513 .plugin-card .column-compatibility .compatibility-incompatible:before { 1514 color: #f00; 1515 } 1516 1513 1517 .plugin-card .compatibility-compatible:before { 1514 1518 content: "\f147"; 1515 1519 } 1516 1520 1521 .plugin-card .column-compatibility .compatibility-compatible:before { 1522 color: #008000; 1523 } 1524 1525 .plugin-card-incompatible { 1526 color: #fff; 1527 background-color: #C62D2D; 1528 border: 1px solid #B02828; 1529 margin: -12px -20px; 1530 padding: 12px 20px; 1531 display: table; 1532 width: 100%; 1533 } 1534 1535 .plugin-card-incompatible div { 1536 display: table-cell; 1537 } 1538 1539 .plugin-card-incompatible span { 1540 display: table-cell; 1541 vertical-align: middle; 1542 } 1543 1544 .plugin-card-incompatible a { 1545 color: #fff; text-decoration: underline; 1546 } 1547 1517 1548 .plugin-icon { 1518 1549 position: absolute; 1519 1550 top: 20px; -
src/wp-admin/includes/class-wp-plugin-install-list-table.php
diff --git src/wp-admin/includes/class-wp-plugin-install-list-table.php src/wp-admin/includes/class-wp-plugin-install-list-table.php index a19729b1d4..dc9c7fa7dc 100644
class WP_Plugin_Install_List_Table extends WP_List_Table { 496 496 $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>'; 497 497 } 498 498 499 $wp_version = get_bloginfo( 'version' ); 500 501 $tested_php = ! empty( $plugin['requires_php'] ); 502 $compatible_php = ( ! $tested_php || version_compare( substr( PHP_VERSION, 0, strlen( $plugin['requires_php'] ) ), $plugin['requires_php'], '>=' ) ); 503 $tested_wp = ( empty( $plugin['tested'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '<=' ) ); 504 $compatible_wp = ( empty( $plugin['requires'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '>=' ) ); 505 $can_install = ( ! $tested_php || $compatible_php ) && $compatible_wp; 506 499 507 $action_links = array(); 500 508 501 509 if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { … … class WP_Plugin_Install_List_Table extends WP_List_Table { 504 512 switch ( $status['status'] ) { 505 513 case 'install': 506 514 if ( $status['url'] ) { 507 $action_links[] = sprintf( 508 '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', 509 esc_attr( $plugin['slug'] ), 510 esc_url( $status['url'] ), 511 /* translators: %s: plugin name and version */ 512 esc_attr( sprintf( __( 'Install %s now' ), $name ) ), 513 esc_attr( $name ), 514 __( 'Install Now' ) 515 ); 515 if ( $can_install ) { 516 $action_links[] = sprintf( 517 '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', 518 esc_attr( $plugin['slug'] ), 519 esc_url( $status['url'] ), 520 /* translators: %s: plugin name and version */ 521 esc_attr( sprintf( __( 'Install %s now' ), $name ) ), 522 esc_attr( $name ), 523 __( 'Install Now' ) 524 ); 525 } else { 526 $action_links[] = sprintf( 527 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', 528 _x( 'Cannot Install', 'plugin' ) 529 ); 530 } 516 531 } 517 532 break; 518 533 … … class WP_Plugin_Install_List_Table extends WP_List_Table { 632 647 </div> 633 648 </div> 634 649 <div class="plugin-card-bottom"> 635 <div class="vers column-rating"> 650 <?php 651 if ( ! $can_install ) { 652 echo '<div class="plugin-card-incompatible">'; 653 654 // Remove style section for commit. 655 echo '<style> 656 .plugin-card-incompatible { 657 color: #fff; 658 background-color: #C62D2D; 659 border: 1px solid #B02828; 660 margin: -12px -20px; 661 padding: 12px 20px; 662 display: table; 663 width: 100%; 664 } 665 .plugin-card-incompatible div { 666 display: table-cell; 667 } 668 .plugin-card-incompatible span { 669 display: table-cell; 670 vertical-align: middle; 671 } 672 .plugin-card-incompatible a { 673 color: #fff; text-decoration: underline; 674 } 675 </style>'; 676 // End remove for commit. 677 678 echo '<span class="dashicons dashicons-warning"></span> '; 679 echo '<div>'; 680 if ( ! $compatible_wp ) { 681 print __( 'Incompatible with your version of WordPress.' ) . ' '; 682 printf( 683 /* translators: Link to update-core.php */ 684 __( '%sUpdate WordPress now.%s' ), 685 '<a href="' . self_admin_url( 'update-core.php' ) . '">', 686 '</a><br>' 687 ); 688 } 689 if ( ! $compatible_php && $tested_php ) { 690 print __( 'Incompatible with your version of PHP.' ) . ' '; 691 /* translators: Link to servehappy page */ 692 printf( 693 __( '%sLearn more about updating PHP.%s' ), 694 '<a href="https://wordpress.org/support/upgrade-php/">', 695 '</a>' 696 ); 697 } 698 echo '</div></div></div></div>'; 699 continue; 700 } ?> 701 <div class="vers column-rating"> 636 702 <?php 637 703 wp_star_rating( 638 704 array( … … class WP_Plugin_Install_List_Table extends WP_List_Table { 641 707 'number' => $plugin['num_ratings'], 642 708 ) 643 709 ); 644 ?>710 ?> 645 711 <span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span> 646 712 </div> 647 713 <div class="column-updated"> … … class WP_Plugin_Install_List_Table extends WP_List_Table { 664 730 ?> 665 731 </div> 666 732 <div class="column-compatibility"> 667 <?php668 $wp_version = get_bloginfo( 'version' );669 670 if ( ! empty( $plugin['tested'] ) && version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) {671 echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress' ) . '</span>';672 } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $wp_version, 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) {673 echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>';674 } else {675 echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>';676 }677 ?>678 733 </div> 679 734 </div> 680 735 </div> -
src/wp-admin/includes/plugin-install.php
diff --git src/wp-admin/includes/plugin-install.php src/wp-admin/includes/plugin-install.php index f765fb286e..2bf992c5cd 100644
if ( ! empty( $api->contributors ) ) { 753 753 <?php 754 754 $wp_version = get_bloginfo( 'version' ); 755 755 756 if ( ! empty( $api->tested ) && version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '>' ) ) { 757 echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.' ) . '</p></div>'; 758 } elseif ( ! empty( $api->requires ) && version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { 759 echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.' ) . '</p></div>'; 756 $tested_php = ! empty( $api->requires_php ); 757 $compatible_php = ( ! $tested_php || version_compare( substr( PHP_VERSION, 0, strlen( $api->requires_php ) ), $api->requires_php, '>=' ) ); 758 $tested_wp = ( empty( $api->tested ) || version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '<=' ) ); 759 $compatible_wp = ( empty( $api->requires ) || version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '>=' ) ); 760 $can_install = ( ! $tested_php || $compatible_php ) && $compatible_wp; 761 762 763 if ( ! $tested_wp ) { 764 echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin <strong>has not been tested</strong> with your current version of WordPress.' ) . '</p></div>'; 765 } elseif ( ! $compatible_wp ) { 766 echo '<div class="notice notice-error notice-alt"><p>' . sprintf( 767 /* translators: Link to update-core.php page */ 768 __( '<strong>Error:</strong> This plugin <strong>has not been marked as compatible</strong> with your version of WordPress. <a target="_blank" href="%s">Update WordPress now.</a>' ), 769 self_admin_url( 'update-core.php' ) 770 ) . '</p></div>'; 771 } 772 if ( ! $compatible_php && $tested_php ) { 773 echo '<div class="notice notice-error notice-alt"><p>' . sprintf( 774 /* translators: Upgrading PHP page URL */ 775 __( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>, so unfortunately you cannot install it. <a href="%s">Click here to learn more about upgrading PHP.</a>' ), 776 esc_url( __( 'https://wordpress.org/support/upgrade-php/' ) ) 777 ) . '</p></div>'; 760 778 } 761 779 762 780 foreach ( (array) $api->sections as $section_name => $content ) { … … if ( ! empty( $api->contributors ) ) { 779 797 $status = install_plugin_install_status( $api ); 780 798 switch ( $status['status'] ) { 781 799 case 'install': 782 if ( $ status['url']) {800 if ( $can_install ) { 783 801 echo '<a data-slug="' . esc_attr( $api->slug ) . '" id="plugin_install_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>'; 802 } else { 803 printf( 804 '<button type="button" class="button button-primary button-disabled right" disabled="disabled">%s</button>', 805 _x( 'Cannot Install', 'plugin' ) 806 ); 784 807 } 785 808 break; 786 809 case 'update_available':