diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index 2cb19dcd6c..3b9bb0e945 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -797,7 +797,7 @@ p.pagenav { } .row-actions { - color: #dcdcde; + color: #a7aaad; font-size: 13px; padding: 2px 0 0; position: relative; diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index 9c5f382e9d..59bce7b8d1 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -586,31 +586,38 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { _x( 'Active', 'plugin' ) ); } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { - $button_text = __( 'Activate' ); - /* translators: %s: Plugin name. */ - $button_label = _x( 'Activate %s', 'plugin' ); - $activate_url = add_query_arg( - array( - '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), - 'action' => 'activate', - 'plugin' => $status['file'], - ), - network_admin_url( 'plugins.php' ) - ); - - if ( is_network_admin() ) { - $button_text = __( 'Network Activate' ); + if ( $compatible_php && $compatible_wp ) { + $button_text = __( 'Activate' ); /* translators: %s: Plugin name. */ - $button_label = _x( 'Network Activate %s', 'plugin' ); - $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); - } + $button_label = _x( 'Activate %s', 'plugin' ); + $activate_url = add_query_arg( + array( + '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), + 'action' => 'activate', + 'plugin' => $status['file'], + ), + network_admin_url( 'plugins.php' ) + ); - $action_links[] = sprintf( - '%3$s', - esc_url( $activate_url ), - esc_attr( sprintf( $button_label, $plugin['name'] ) ), - $button_text - ); + if ( is_network_admin() ) { + $button_text = __( 'Network Activate' ); + /* translators: %s: Plugin name. */ + $button_label = _x( 'Network Activate %s', 'plugin' ); + $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); + } + + $action_links[] = sprintf( + '%3$s', + esc_url( $activate_url ), + esc_attr( sprintf( $button_label, $plugin['name'] ) ), + $button_text + ); + } else { + $action_links[] = sprintf( + '', + _x( 'Cannot Activate', 'plugin' ) + ); + } } else { $action_links[] = sprintf( '', diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 9b74ca3c38..a5831dad17 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -739,6 +739,12 @@ class WP_Plugins_List_Table extends WP_List_Table { $restrict_network_active = false; $restrict_network_only = false; + $requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null; + $requires_wp = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null; + + $compatible_php = is_php_version_compatible( $requires_php ); + $compatible_wp = is_wp_version_compatible( $requires_wp ); + if ( 'mustuse' === $context ) { $is_active = true; } elseif ( 'dropins' === $context ) { @@ -792,14 +798,21 @@ class WP_Plugins_List_Table extends WP_List_Table { } } else { if ( current_user_can( 'manage_network_plugins' ) ) { - $actions['activate'] = sprintf( - '%s', - wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), - esc_attr( $plugin_id_attr ), - /* translators: %s: Plugin name. */ - esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), - __( 'Network Activate' ) - ); + if ( $compatible_php && $compatible_wp ) { + $actions['activate'] = sprintf( + '%s', + wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), + esc_attr( $plugin_id_attr ), + /* translators: %s: Plugin name. */ + esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), + __( 'Network Activate' ) + ); + } else { + $actions['activate'] = sprintf( + '%s', + _x( 'Cannot Activate', 'plugin' ) + ); + } } if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { @@ -846,14 +859,21 @@ class WP_Plugins_List_Table extends WP_List_Table { } } else { if ( current_user_can( 'activate_plugin', $plugin_file ) ) { - $actions['activate'] = sprintf( - '%s', - wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), - esc_attr( $plugin_id_attr ), - /* translators: %s: Plugin name. */ - esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), - __( 'Activate' ) - ); + if ( $compatible_php && $compatible_wp ) { + $actions['activate'] = sprintf( + '%s', + wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), + esc_attr( $plugin_id_attr ), + /* translators: %s: Plugin name. */ + esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), + __( 'Activate' ) + ); + } else { + $actions['activate'] = sprintf( + '%s', + _x( 'Cannot Activate', 'plugin' ) + ); + } } if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { @@ -945,10 +965,8 @@ class WP_Plugins_List_Table extends WP_List_Table { } - $requires_php = isset( $plugin_data['requires_php'] ) ? $plugin_data['requires_php'] : null; - $compatible_php = is_php_version_compatible( $requires_php ); - $class = $is_active ? 'active' : 'inactive'; - $checkbox_id = 'checkbox_' . md5( $plugin_file ); + $class = $is_active ? 'active' : 'inactive'; + $checkbox_id = 'checkbox_' . md5( $plugin_file ); if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) { $checkbox = ''; @@ -968,7 +986,9 @@ class WP_Plugins_List_Table extends WP_List_Table { $plugin_name = $plugin_data['Name']; } - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { + if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) + || ! $compatible_php || ! $compatible_wp + ) { $class .= ' update'; } @@ -1190,6 +1210,62 @@ class WP_Plugins_List_Table extends WP_List_Table { echo ''; + if ( ! $compatible_php || ! $compatible_wp ) { + printf( + '