Plugins: Disable "Update Now" button for plugins that require a higher version of PHP or WordPress.

This complements disabling the "Install Now" button in [43436].

Props afragen.
Fixes #46677. See #43986.

git-svn-id: https://develop.svn.wordpress.org/trunk@45043 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-03-27 22:10:37 +00:00
parent 01882f477b
commit 43c28f913c
1 changed files with 17 additions and 10 deletions

View File

@ -537,6 +537,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
case 'update_available':
if ( $status['url'] ) {
if ( $compatible_php && $compatible_wp ) {
$action_links[] = sprintf(
'<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
esc_attr( $status['file'] ),
@ -547,6 +548,12 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
esc_attr( $name ),
__( 'Update Now' )
);
} else {
$action_links[] = sprintf(
'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
_x( 'Cannot Update', 'plugin' )
);
}
}
break;