Ticket #43986: 43986v5.1.diff
File 43986v5.1.diff, 9.7 KB (added by , 6 years ago) |
---|
-
src/wp-admin/css/list-tables-rtl.css
diff --git src/wp-admin/css/list-tables-rtl.css src/wp-admin/css/list-tables-rtl.css index 468dcbf8a1..dd7f90d607 100644
ul.cat-checklist { 1404 1404 min-height: 135px; 1405 1405 } 1406 1406 1407 1408 .plugin-card-top .desc.incompatible { 1409 margin-right: 0; 1410 padding: 10px; 1411 border-left: 5px solid #C62D2D; 1412 } 1413 1407 1414 div.action-links, 1408 1415 .plugin-action-buttons { 1409 1416 margin: 0; /* Override existing margins */ … … div.action-links, 1510 1517 content: "\f158"; 1511 1518 } 1512 1519 1520 .plugin-card .column-compatibility .compatibility-incompatible:before { 1521 color: #f00; 1522 } 1523 1513 1524 .plugin-card .compatibility-compatible:before { 1514 1525 content: "\f147"; 1515 1526 } 1516 1527 1528 .plugin-card .column-compatibility .compatibility-compatible:before { 1529 color: #008000; 1530 } 1531 1517 1532 .plugin-icon { 1518 1533 position: absolute; 1519 1534 top: 20px; -
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..659a1a48a4 100644
ul.cat-checklist { 1404 1404 min-height: 135px; 1405 1405 } 1406 1406 1407 1408 .plugin-card-top .desc.incompatible { 1409 margin-right: 0; 1410 padding: 10px; 1411 border-left: 5px solid #C62D2D; 1412 } 1413 1407 1414 div.action-links, 1408 1415 .plugin-action-buttons { 1409 1416 margin: 0; /* Override existing margins */ … … div.action-links, 1510 1517 content: "\f158"; 1511 1518 } 1512 1519 1520 .plugin-card .column-compatibility .compatibility-incompatible:before { 1521 color: #f00; 1522 } 1523 1513 1524 .plugin-card .compatibility-compatible:before { 1514 1525 content: "\f147"; 1515 1526 } 1516 1527 1528 .plugin-card .column-compatibility .compatibility-compatible:before { 1529 color: #008000; 1530 } 1531 1517 1532 .plugin-icon { 1518 1533 position: absolute; 1519 1534 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..2094aaf003 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 { 630 645 <p><?php echo $description; ?></p> 631 646 <p class="authors"><?php echo $author; ?></p> 632 647 </div> 648 <?php 649 if ( ! $can_install ) { 650 echo '<div class="desc notice-error notice-alt incompatible">'; 651 652 // Remove style before commit. 653 echo '<style> 654 .plugin-card-top .desc.incompatible { 655 margin-right: 0; 656 padding: 10px; 657 border-left: 5px solid #C62D2D; 658 } 659 .plugin-card .column-compatibility .compatibility-incompatible:before { 660 color: #f00; 661 } 662 .plugin-card .column-compatibility .compatibility-compatible:before { 663 color: #008000; 664 } 665 </style>'; 666 667 echo '<span style="color:#C62D2D;" class="dashicons dashicons-warning"></span> '; 668 _e( 'This plugin is incompatible and cannot be installed.' ); 669 echo ' '; 670 printf( 671 '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', 672 esc_url( $details_link ), 673 /* translators: %s: plugin name and version */ 674 esc_attr( sprintf( __( 'More information about %s' ), $name ) ), 675 esc_attr( $name ), 676 __( 'Why?' ) 677 ); 678 echo '</div>'; 679 } 680 ?> 633 681 </div> 634 682 <div class="plugin-card-bottom"> 635 683 <div class="vers column-rating"> … … class WP_Plugin_Install_List_Table extends WP_List_Table { 665 713 </div> 666 714 <div class="column-compatibility"> 667 715 <?php 668 $wp_version = get_bloginfo( 'version' ); 669 670 if ( ! empty( $plugin['tested'] ) && version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) { 716 if ( ! $compatible_php && $tested_php ) { 717 echo '<span class="compatibility-incompatible">' . 718 __( '<strong>Incompatible</strong> with your version of PHP' ) . '</span><br>'; 719 } 720 if ( ! $tested_wp ) { 671 721 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'], '<' )) {722 } elseif ( ! $compatible_wp ) { 673 723 echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>'; 674 724 } else { 675 725 echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>'; -
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..da187ed07f 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 if ( ! $compatible_php && $tested_php ) { 763 echo '<div class="notice notice-error notice-alt"><p>' . sprintf( 764 /* translators: Upgrading PHP page URL */ 765 __( '<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>' ), 766 esc_url( __( 'https://wordpress.org/support/upgrade-php/' ) ) 767 ) . '</p></div>'; 768 } 769 if ( ! $tested_wp ) { 770 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>'; 771 } elseif ( ! $compatible_wp ) { 772 echo '<div class="notice notice-error notice-alt"><p>' . __( '<strong>Error:</strong> This plugin <strong>has not been marked as compatible</strong> with your version of WordPress.' ) . '</p></div>'; 760 773 } 761 774 762 775 foreach ( (array) $api->sections as $section_name => $content ) { … … if ( ! empty( $api->contributors ) ) { 779 792 $status = install_plugin_install_status( $api ); 780 793 switch ( $status['status'] ) { 781 794 case 'install': 782 if ( $ status['url']) {795 if ( $can_install ) { 783 796 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>'; 797 } else { 798 printf( 799 '<button type="button" class="button button-primary button-disabled right" disabled="disabled">%s</button>', 800 _x( 'Cannot Install', 'plugin' ) 801 ); 784 802 } 785 803 break; 786 804 case 'update_available':