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..3f73dbb6ed 100644
|
|
class WP_Plugin_Install_List_Table extends WP_List_Table { |
686 | 686 | echo '</div></div>'; |
687 | 687 | } |
688 | 688 | } |
| 689 | |
| 690 | /** |
| 691 | * Loads the filter hook to disable the plugin install button if PHP version not sufficient. |
| 692 | */ |
| 693 | public function load_requires_php(){ |
| 694 | add_filter( 'plugin_install_action_links', array( $this, 'disable_install_button' ), 10, 2 ); |
| 695 | } |
| 696 | |
| 697 | /** |
| 698 | * Filter plugin action links in Install Plugin page. |
| 699 | * |
| 700 | * @param array $action_links |
| 701 | * @param array $plugin |
| 702 | * |
| 703 | * @return array $action_links |
| 704 | */ |
| 705 | public function disable_install_button( $action_links, $plugin ) { |
| 706 | $disable_button = '<button type="button" class="button button-disabled" disabled="disabled">'; |
| 707 | $disable_button .= __( 'Cannot install' ); |
| 708 | $disable_button .= '</button>'; |
| 709 | |
| 710 | if ( $plugin['requires_php'] && |
| 711 | version_compare( PHP_VERSION, $plugin['requires_php'], '<=' ) |
| 712 | ) { |
| 713 | unset( $action_links[0] ); |
| 714 | $action_links[] = __( 'PHP version too low' ); |
| 715 | $action_links[] = $disable_button; |
| 716 | $action_links = array_reverse( $action_links ); |
| 717 | } |
| 718 | |
| 719 | return $action_links; |
| 720 | } |
| 721 | |
689 | 722 | } |
diff --git a/wp-admin/plugin-install.php b/wp-admin/plugin-install.php
index fe5f414cd1..b07e6aa1b9 100644
a
|
b
|
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
39 | 39 | } |
40 | 40 | |
41 | 41 | $wp_list_table->prepare_items(); |
| 42 | $wp_list_table->load_requires_php(); |
42 | 43 | |
43 | 44 | $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
44 | 45 | |