Ticket #53990: 53990.3.diff
File 53990.3.diff, 9.9 KB (added by , 3 years ago) |
---|
-
src/wp-admin/css/list-tables.css
797 797 } 798 798 799 799 .row-actions { 800 color: # dcdcde;800 color: #a7aaad; 801 801 font-size: 13px; 802 802 padding: 2px 0 0; 803 803 position: relative; -
src/wp-admin/includes/class-wp-plugin-install-list-table.php
586 586 _x( 'Active', 'plugin' ) 587 587 ); 588 588 } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { 589 $button_text = __( 'Activate' ); 590 /* translators: %s: Plugin name. */ 591 $button_label = _x( 'Activate %s', 'plugin' ); 592 $activate_url = add_query_arg( 593 array( 594 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), 595 'action' => 'activate', 596 'plugin' => $status['file'], 597 ), 598 network_admin_url( 'plugins.php' ) 599 ); 589 if ( $compatible_php && $compatible_wp ) { 590 $button_text = __( 'Activate' ); 591 /* translators: %s: Plugin name. */ 592 $button_label = _x( 'Activate %s', 'plugin' ); 593 $activate_url = add_query_arg( 594 array( 595 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), 596 'action' => 'activate', 597 'plugin' => $status['file'], 598 ), 599 network_admin_url( 'plugins.php' ) 600 ); 600 601 601 if ( is_network_admin() ) { 602 $button_text = __( 'Network Activate' ); 603 /* translators: %s: Plugin name. */ 604 $button_label = _x( 'Network Activate %s', 'plugin' ); 605 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); 602 if ( is_network_admin() ) { 603 $button_text = __( 'Network Activate' ); 604 /* translators: %s: Plugin name. */ 605 $button_label = _x( 'Network Activate %s', 'plugin' ); 606 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); 607 } 608 609 $action_links[] = sprintf( 610 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', 611 esc_url( $activate_url ), 612 esc_attr( sprintf( $button_label, $plugin['name'] ) ), 613 $button_text 614 ); 615 } else { 616 $action_links[] = sprintf( 617 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', 618 _x( 'Cannot Activate', 'plugin' ) 619 ); 606 620 } 607 608 $action_links[] = sprintf(609 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',610 esc_url( $activate_url ),611 esc_attr( sprintf( $button_label, $plugin['name'] ) ),612 $button_text613 );614 621 } else { 615 622 $action_links[] = sprintf( 616 623 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', -
src/wp-admin/includes/class-wp-plugins-list-table.php
739 739 $restrict_network_active = false; 740 740 $restrict_network_only = false; 741 741 742 $requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null; 743 $requires_wp = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null; 744 745 $compatible_php = is_php_version_compatible( $requires_php ); 746 $compatible_wp = is_wp_version_compatible( $requires_wp ); 747 742 748 if ( 'mustuse' === $context ) { 743 749 $is_active = true; 744 750 } elseif ( 'dropins' === $context ) { … … 792 798 } 793 799 } else { 794 800 if ( current_user_can( 'manage_network_plugins' ) ) { 795 $actions['activate'] = sprintf( 796 '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>', 797 wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), 798 esc_attr( $plugin_id_attr ), 799 /* translators: %s: Plugin name. */ 800 esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), 801 __( 'Network Activate' ) 802 ); 801 if ( $compatible_php && $compatible_wp ) { 802 $actions['activate'] = sprintf( 803 '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>', 804 wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), 805 esc_attr( $plugin_id_attr ), 806 /* translators: %s: Plugin name. */ 807 esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), 808 __( 'Network Activate' ) 809 ); 810 } else { 811 $actions['activate'] = sprintf( 812 '<span>%s</span>', 813 _x( 'Cannot Activate', 'plugin' ) 814 ); 815 } 803 816 } 804 817 805 818 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { … … 846 859 } 847 860 } else { 848 861 if ( current_user_can( 'activate_plugin', $plugin_file ) ) { 849 $actions['activate'] = sprintf( 850 '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>', 851 wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), 852 esc_attr( $plugin_id_attr ), 853 /* translators: %s: Plugin name. */ 854 esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), 855 __( 'Activate' ) 856 ); 862 if ( $compatible_php && $compatible_wp ) { 863 $actions['activate'] = sprintf( 864 '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>', 865 wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), 866 esc_attr( $plugin_id_attr ), 867 /* translators: %s: Plugin name. */ 868 esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), 869 __( 'Activate' ) 870 ); 871 } else { 872 $actions['activate'] = sprintf( 873 '<span>%s</span>', 874 _x( 'Cannot Activate', 'plugin' ) 875 ); 876 } 857 877 } 858 878 859 879 if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { … … 945 965 946 966 } 947 967 948 $requires_php = isset( $plugin_data['requires_php'] ) ? $plugin_data['requires_php'] : null; 949 $compatible_php = is_php_version_compatible( $requires_php ); 950 $class = $is_active ? 'active' : 'inactive'; 951 $checkbox_id = 'checkbox_' . md5( $plugin_file ); 968 $class = $is_active ? 'active' : 'inactive'; 969 $checkbox_id = 'checkbox_' . md5( $plugin_file ); 952 970 953 971 if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) { 954 972 $checkbox = ''; … … 968 986 $plugin_name = $plugin_data['Name']; 969 987 } 970 988 971 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { 989 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) 990 || ! $compatible_php || ! $compatible_wp 991 ) { 972 992 $class .= ' update'; 973 993 } 974 994 … … 1190 1210 1191 1211 echo '</tr>'; 1192 1212 1213 if ( ! $compatible_php || ! $compatible_wp ) { 1214 printf( 1215 '<tr class="plugin-update-tr">' . 1216 '<td colspan="%s" class="plugin-update colspanchange">' . 1217 '<div class="update-message notice inline notice-error notice-alt"><p>', 1218 esc_attr( $this->get_column_count() ) 1219 ); 1220 1221 if ( ! $compatible_php && ! $compatible_wp ) { 1222 _e( 'This plugin doesn’t work with your versions of WordPress and PHP.' ); 1223 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { 1224 printf( 1225 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ 1226 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), 1227 self_admin_url( 'update-core.php' ), 1228 esc_url( wp_get_update_php_url() ) 1229 ); 1230 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1231 } elseif ( current_user_can( 'update_core' ) ) { 1232 printf( 1233 /* translators: %s: URL to WordPress Updates screen. */ 1234 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 1235 self_admin_url( 'update-core.php' ) 1236 ); 1237 } elseif ( current_user_can( 'update_php' ) ) { 1238 printf( 1239 /* translators: %s: URL to Update PHP page. */ 1240 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 1241 esc_url( wp_get_update_php_url() ) 1242 ); 1243 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1244 } 1245 } elseif ( ! $compatible_wp ) { 1246 _e( 'This plugin doesn’t work with your version of WordPress.' ); 1247 if ( current_user_can( 'update_core' ) ) { 1248 printf( 1249 /* translators: %s: URL to WordPress Updates screen. */ 1250 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 1251 self_admin_url( 'update-core.php' ) 1252 ); 1253 } 1254 } elseif ( ! $compatible_php ) { 1255 _e( 'This plugin doesn’t work with your version of PHP.' ); 1256 if ( current_user_can( 'update_php' ) ) { 1257 printf( 1258 /* translators: %s: URL to Update PHP page. */ 1259 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 1260 esc_url( wp_get_update_php_url() ) 1261 ); 1262 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1263 } 1264 } 1265 1266 echo '</p></div></td></tr>'; 1267 } 1268 1193 1269 /** 1194 1270 * Fires after each row in the Plugins list table. 1195 1271 *