- Timestamp:
- 08/27/2021 03:42:36 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-plugins-list-table.php
r50556 r51678 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; … … 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 … … 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 … … 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 ) { … … 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 } … … 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.
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)