125 update_option( 'recently_activated', $recent ); |
121 update_option( 'recently_activated', $recent ); |
126 } else { |
122 } else { |
127 update_site_option( 'recently_activated', $recent ); |
123 update_site_option( 'recently_activated', $recent ); |
128 } |
124 } |
129 |
125 |
130 wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
126 wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ); |
131 exit; |
127 exit; |
132 |
128 |
133 case 'update-selected' : |
129 case 'update-selected': |
134 |
|
135 check_admin_referer( 'bulk-plugins' ); |
130 check_admin_referer( 'bulk-plugins' ); |
136 |
131 |
137 if ( isset( $_GET['plugins'] ) ) |
132 if ( isset( $_GET['plugins'] ) ) { |
138 $plugins = explode( ',', wp_unslash( $_GET['plugins'] ) ); |
133 $plugins = explode( ',', wp_unslash( $_GET['plugins'] ) ); |
139 elseif ( isset( $_POST['checked'] ) ) |
134 } elseif ( isset( $_POST['checked'] ) ) { |
140 $plugins = (array) wp_unslash( $_POST['checked'] ); |
135 $plugins = (array) wp_unslash( $_POST['checked'] ); |
141 else |
136 } else { |
142 $plugins = array(); |
137 $plugins = array(); |
143 |
138 } |
144 $title = __( 'Update Plugins' ); |
139 |
|
140 $title = __( 'Update Plugins' ); |
145 $parent_file = 'plugins.php'; |
141 $parent_file = 'plugins.php'; |
146 |
142 |
147 wp_enqueue_script( 'updates' ); |
143 wp_enqueue_script( 'updates' ); |
148 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
144 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
149 |
145 |
150 echo '<div class="wrap">'; |
146 echo '<div class="wrap">'; |
151 echo '<h1>' . esc_html( $title ) . '</h1>'; |
147 echo '<h1>' . esc_html( $title ) . '</h1>'; |
152 |
148 |
153 $url = self_admin_url('update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) )); |
149 $url = self_admin_url( 'update.php?action=update-selected&plugins=' . urlencode( join( ',', $plugins ) ) ); |
154 $url = wp_nonce_url($url, 'bulk-update-plugins'); |
150 $url = wp_nonce_url( $url, 'bulk-update-plugins' ); |
155 |
151 |
156 echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
152 echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
157 echo '</div>'; |
153 echo '</div>'; |
158 require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
154 require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
159 exit; |
155 exit; |
160 |
156 |
161 case 'error_scrape': |
157 case 'error_scrape': |
162 if ( ! current_user_can( 'activate_plugin', $plugin ) ) { |
158 if ( ! current_user_can( 'activate_plugin', $plugin ) ) { |
163 wp_die( __( 'Sorry, you are not allowed to activate this plugin.' ) ); |
159 wp_die( __( 'Sorry, you are not allowed to activate this plugin.' ) ); |
164 } |
160 } |
165 |
161 |
166 check_admin_referer('plugin-activation-error_' . $plugin); |
162 check_admin_referer( 'plugin-activation-error_' . $plugin ); |
167 |
163 |
168 $valid = validate_plugin($plugin); |
164 $valid = validate_plugin( $plugin ); |
169 if ( is_wp_error($valid) ) |
165 if ( is_wp_error( $valid ) ) { |
170 wp_die($valid); |
166 wp_die( $valid ); |
|
167 } |
171 |
168 |
172 if ( ! WP_DEBUG ) { |
169 if ( ! WP_DEBUG ) { |
173 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
170 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
174 } |
171 } |
175 |
172 |
176 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
173 @ini_set( 'display_errors', true ); //Ensure that Fatal errors are displayed. |
177 // Go back to "sandbox" scope so we get the same errors as before |
174 // Go back to "sandbox" scope so we get the same errors as before |
178 plugin_sandbox_scrape( $plugin ); |
175 plugin_sandbox_scrape( $plugin ); |
179 /** This action is documented in wp-admin/includes/plugin.php */ |
176 /** This action is documented in wp-admin/includes/plugin.php */ |
180 do_action( "activate_{$plugin}" ); |
177 do_action( "activate_{$plugin}" ); |
181 exit; |
178 exit; |
245 update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
242 update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
246 } else { |
243 } else { |
247 update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); |
244 update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); |
248 } |
245 } |
249 |
246 |
250 wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
247 wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ); |
251 exit; |
248 exit; |
252 |
249 |
253 case 'delete-selected': |
250 case 'delete-selected': |
254 if ( ! current_user_can('delete_plugins') ) { |
251 if ( ! current_user_can( 'delete_plugins' ) ) { |
255 wp_die(__('Sorry, you are not allowed to delete plugins for this site.')); |
252 wp_die( __( 'Sorry, you are not allowed to delete plugins for this site.' ) ); |
256 } |
253 } |
257 |
254 |
258 check_admin_referer('bulk-plugins'); |
255 check_admin_referer( 'bulk-plugins' ); |
259 |
256 |
260 //$_POST = from the plugin form; $_GET = from the FTP details screen. |
257 //$_POST = from the plugin form; $_GET = from the FTP details screen. |
261 $plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array(); |
258 $plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array(); |
262 if ( empty( $plugins ) ) { |
259 if ( empty( $plugins ) ) { |
263 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
260 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); |
264 exit; |
261 exit; |
265 } |
262 } |
266 |
263 |
267 $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. |
264 $plugins = array_filter( $plugins, 'is_plugin_inactive' ); // Do not allow to delete Activated plugins. |
268 if ( empty( $plugins ) ) { |
265 if ( empty( $plugins ) ) { |
269 wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); |
266 wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); |
270 exit; |
267 exit; |
271 } |
268 } |
272 |
269 |
273 // Bail on all if any paths are invalid. |
270 // Bail on all if any paths are invalid. |
274 // validate_file() returns truthy for invalid files |
271 // validate_file() returns truthy for invalid files |
275 $invalid_plugin_files = array_filter( $plugins, 'validate_file' ); |
272 $invalid_plugin_files = array_filter( $plugins, 'validate_file' ); |
276 if ( $invalid_plugin_files ) { |
273 if ( $invalid_plugin_files ) { |
277 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
274 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); |
278 exit; |
275 exit; |
279 } |
276 } |
280 |
277 |
281 include(ABSPATH . 'wp-admin/update.php'); |
278 include( ABSPATH . 'wp-admin/update.php' ); |
282 |
279 |
283 $parent_file = 'plugins.php'; |
280 $parent_file = 'plugins.php'; |
284 |
281 |
285 if ( ! isset($_REQUEST['verify-delete']) ) { |
282 if ( ! isset( $_REQUEST['verify-delete'] ) ) { |
286 wp_enqueue_script('jquery'); |
283 wp_enqueue_script( 'jquery' ); |
287 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
284 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
288 ?> |
285 ?> |
289 <div class="wrap"> |
286 <div class="wrap"> |
290 <?php |
287 <?php |
291 $plugin_info = array(); |
288 $plugin_info = array(); |
292 $have_non_network_plugins = false; |
289 $have_non_network_plugins = false; |
293 foreach ( (array) $plugins as $plugin ) { |
290 foreach ( (array) $plugins as $plugin ) { |
294 $plugin_slug = dirname( $plugin ); |
291 $plugin_slug = dirname( $plugin ); |
295 |
292 |
296 if ( '.' == $plugin_slug ) { |
293 if ( '.' == $plugin_slug ) { |
297 if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { |
294 if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { |
298 $plugin_info[ $plugin ] = $data; |
295 $plugin_info[ $plugin ] = $data; |
299 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
296 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
300 if ( ! $plugin_info[ $plugin ]['Network'] ) { |
297 if ( ! $plugin_info[ $plugin ]['Network'] ) { |
|
298 $have_non_network_plugins = true; |
|
299 } |
|
300 } |
|
301 } else { |
|
302 // Get plugins list from that folder. |
|
303 if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { |
|
304 foreach ( $folder_plugins as $plugin_file => $data ) { |
|
305 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); |
|
306 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
307 if ( ! $plugin_info[ $plugin_file ]['Network'] ) { |
301 $have_non_network_plugins = true; |
308 $have_non_network_plugins = true; |
302 } |
|
303 } |
|
304 } else { |
|
305 // Get plugins list from that folder. |
|
306 if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { |
|
307 foreach ( $folder_plugins as $plugin_file => $data ) { |
|
308 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); |
|
309 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
310 if ( ! $plugin_info[ $plugin_file ]['Network'] ) { |
|
311 $have_non_network_plugins = true; |
|
312 } |
|
313 } |
309 } |
314 } |
310 } |
315 } |
311 } |
316 } |
312 } |
|
313 } |
317 $plugins_to_delete = count( $plugin_info ); |
314 $plugins_to_delete = count( $plugin_info ); |
318 ?> |
315 ?> |
319 <?php if ( 1 == $plugins_to_delete ) : ?> |
316 <?php if ( 1 == $plugins_to_delete ) : ?> |
320 <h1><?php _e( 'Delete Plugin' ); ?></h1> |
317 <h1><?php _e( 'Delete Plugin' ); ?></h1> |
321 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
318 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
322 <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> |
319 <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> |
323 <?php endif; ?> |
320 <?php endif; ?> |
324 <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
321 <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
325 <?php else: ?> |
322 <?php else : ?> |
326 <h1><?php _e( 'Delete Plugins' ); ?></h1> |
323 <h1><?php _e( 'Delete Plugins' ); ?></h1> |
327 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
324 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
328 <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> |
325 <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> |
329 <?php endif; ?> |
326 <?php endif; ?> |
330 <p><?php _e( 'You are about to remove the following plugins:' ); ?></p> |
327 <p><?php _e( 'You are about to remove the following plugins:' ); ?></p> |
337 /* translators: 1: plugin name, 2: plugin author */ |
334 /* translators: 1: plugin name, 2: plugin author */ |
338 echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>'; |
335 echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>'; |
339 $data_to_delete = true; |
336 $data_to_delete = true; |
340 } else { |
337 } else { |
341 /* translators: 1: plugin name, 2: plugin author */ |
338 /* translators: 1: plugin name, 2: plugin author */ |
342 echo '<li>', sprintf( _x('%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>'; |
339 echo '<li>', sprintf( _x( '%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>'; |
343 } |
340 } |
344 } |
341 } |
345 ?> |
342 ?> |
346 </ul> |
343 </ul> |
347 <p><?php |
344 <p> |
348 if ( $data_to_delete ) |
345 <?php |
349 _e('Are you sure you wish to delete these files and data?'); |
346 if ( $data_to_delete ) { |
350 else |
347 _e( 'Are you sure you wish to delete these files and data?' ); |
351 _e('Are you sure you wish to delete these files?'); |
348 } else { |
352 ?></p> |
349 _e( 'Are you sure you wish to delete these files?' ); |
353 <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
350 } |
|
351 ?> |
|
352 </p> |
|
353 <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" style="display:inline;"> |
354 <input type="hidden" name="verify-delete" value="1" /> |
354 <input type="hidden" name="verify-delete" value="1" /> |
355 <input type="hidden" name="action" value="delete-selected" /> |
355 <input type="hidden" name="action" value="delete-selected" /> |
356 <?php |
356 <?php |
357 foreach ( (array) $plugins as $plugin ) { |
357 foreach ( (array) $plugins as $plugin ) { |
358 echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; |
358 echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; |
359 } |
359 } |
360 ?> |
360 ?> |
361 <?php wp_nonce_field('bulk-plugins') ?> |
361 <?php wp_nonce_field( 'bulk-plugins' ); ?> |
362 <?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), '', 'submit', false ); ?> |
362 <?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), '', 'submit', false ); ?> |
363 </form> |
363 </form> |
364 <?php |
364 <?php |
365 $referer = wp_get_referer(); |
365 $referer = wp_get_referer(); |
366 ?> |
366 ?> |
367 <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
367 <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
368 <?php submit_button( __( 'No, return me to the plugin list' ), '', 'submit', false ); ?> |
368 <?php submit_button( __( 'No, return me to the plugin list' ), '', 'submit', false ); ?> |
369 </form> |
369 </form> |
370 </div> |
370 </div> |
371 <?php |
371 <?php |
372 require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
372 require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
373 exit; |
373 exit; |
374 } else { |
374 } else { |
375 $plugins_to_delete = count( $plugins ); |
375 $plugins_to_delete = count( $plugins ); |
376 } // endif verify-delete |
376 } // endif verify-delete |
377 |
377 |
378 $delete_result = delete_plugins( $plugins ); |
378 $delete_result = delete_plugins( $plugins ); |
379 |
379 |
380 set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
380 set_transient( 'plugins_delete_result_' . $user_ID, $delete_result ); //Store the result in a cache rather than a URL param due to object type & length |
381 wp_redirect( self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s") ); |
381 wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); |
382 exit; |
382 exit; |
383 |
383 |
384 case 'clear-recent-list': |
384 case 'clear-recent-list': |
385 if ( ! is_network_admin() ) { |
385 if ( ! is_network_admin() ) { |
386 update_option( 'recently_activated', array() ); |
386 update_option( 'recently_activated', array() ); |
387 } else { |
387 } else { |
388 update_site_option( 'recently_activated', array() ); |
388 update_site_option( 'recently_activated', array() ); |
389 } |
389 } |
390 break; |
390 break; |
391 |
391 |
|
392 case 'resume': |
|
393 if ( is_multisite() ) { |
|
394 return; |
|
395 } |
|
396 |
|
397 if ( ! current_user_can( 'resume_plugin', $plugin ) ) { |
|
398 wp_die( __( 'Sorry, you are not allowed to resume this plugin.' ) ); |
|
399 } |
|
400 |
|
401 check_admin_referer( 'resume-plugin_' . $plugin ); |
|
402 |
|
403 $result = resume_plugin( $plugin, self_admin_url( "plugins.php?error=resuming&plugin_status=$status&paged=$page&s=$s" ) ); |
|
404 |
|
405 if ( is_wp_error( $result ) ) { |
|
406 wp_die( $result ); |
|
407 } |
|
408 |
|
409 wp_redirect( self_admin_url( "plugins.php?resume=true&plugin_status=$status&paged=$page&s=$s" ) ); |
|
410 exit; |
|
411 |
392 default: |
412 default: |
393 if ( isset( $_POST['checked'] ) ) { |
413 if ( isset( $_POST['checked'] ) ) { |
394 check_admin_referer('bulk-plugins'); |
414 check_admin_referer( 'bulk-plugins' ); |
395 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); |
415 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); |
396 $sendback = wp_get_referer(); |
416 $sendback = wp_get_referer(); |
397 |
417 |
398 /** This action is documented in wp-admin/edit-comments.php */ |
418 /** This action is documented in wp-admin/edit-comments.php */ |
399 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $plugins ); |
419 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $plugins ); |
400 wp_safe_redirect( $sendback ); |
420 wp_safe_redirect( $sendback ); |
401 exit; |
421 exit; |
402 } |
422 } |
403 break; |
423 break; |
404 } |
424 } |
405 |
|
406 } |
425 } |
407 |
426 |
408 $wp_list_table->prepare_items(); |
427 $wp_list_table->prepare_items(); |
409 |
428 |
410 wp_enqueue_script('plugin-install'); |
429 wp_enqueue_script( 'plugin-install' ); |
411 add_thickbox(); |
430 add_thickbox(); |
412 |
431 |
413 add_screen_option( 'per_page', array( 'default' => 999 ) ); |
432 add_screen_option( 'per_page', array( 'default' => 999 ) ); |
414 |
433 |
415 get_current_screen()->add_help_tab( array( |
434 get_current_screen()->add_help_tab( |
416 'id' => 'overview', |
435 array( |
417 'title' => __('Overview'), |
436 'id' => 'overview', |
418 'content' => |
437 'title' => __( 'Overview' ), |
419 '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' . |
438 'content' => |
420 '<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . |
439 '<p>' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '</p>' . |
421 '<p>' . sprintf( |
440 '<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . |
422 /* translators: %s: WordPress Plugin Directory URL */ |
441 '<p>' . sprintf( |
423 __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), |
442 /* translators: %s: WordPress Plugin Directory URL */ |
424 __( 'https://wordpress.org/plugins/' ) |
443 __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), |
425 ) . '</p>' |
444 __( 'https://wordpress.org/plugins/' ) |
426 ) ); |
445 ) . '</p>', |
427 get_current_screen()->add_help_tab( array( |
446 ) |
428 'id' => 'compatibility-problems', |
447 ); |
429 'title' => __('Troubleshooting'), |
448 get_current_screen()->add_help_tab( |
430 'content' => |
449 array( |
431 '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' . |
450 'id' => 'compatibility-problems', |
432 '<p>' . sprintf( |
451 'title' => __( 'Troubleshooting' ), |
433 /* translators: WP_PLUGIN_DIR constant value */ |
452 'content' => |
434 __( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), |
453 '<p>' . __( 'Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.' ) . '</p>' . |
435 '<code>' . WP_PLUGIN_DIR . '</code>' |
454 '<p>' . sprintf( |
436 ) . '</p>' |
455 /* translators: WP_PLUGIN_DIR constant value */ |
437 ) ); |
456 __( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), |
|
457 '<code>' . WP_PLUGIN_DIR . '</code>' |
|
458 ) . '</p>', |
|
459 ) |
|
460 ); |
438 |
461 |
439 get_current_screen()->set_help_sidebar( |
462 get_current_screen()->set_help_sidebar( |
440 '<p><strong>' . __('For more information:') . '</strong></p>' . |
463 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
441 '<p>' . __('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>') . '</p>' . |
464 '<p>' . __( '<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>' ) . '</p>' . |
442 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
465 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
443 ); |
466 ); |
444 |
467 |
445 get_current_screen()->set_screen_reader_content( array( |
468 get_current_screen()->set_screen_reader_content( |
446 'heading_views' => __( 'Filter plugins list' ), |
469 array( |
447 'heading_pagination' => __( 'Plugins list navigation' ), |
470 'heading_views' => __( 'Filter plugins list' ), |
448 'heading_list' => __( 'Plugins list' ), |
471 'heading_pagination' => __( 'Plugins list navigation' ), |
449 ) ); |
472 'heading_list' => __( 'Plugins list' ), |
450 |
473 ) |
451 $title = __('Plugins'); |
474 ); |
|
475 |
|
476 $title = __( 'Plugins' ); |
452 $parent_file = 'plugins.php'; |
477 $parent_file = 'plugins.php'; |
453 |
478 |
454 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
479 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
455 |
480 |
456 $invalid = validate_active_plugins(); |
481 $invalid = validate_active_plugins(); |
457 if ( ! empty( $invalid ) ) { |
482 if ( ! empty( $invalid ) ) { |
458 foreach ( $invalid as $plugin_file => $error ) { |
483 foreach ( $invalid as $plugin_file => $error ) { |
459 echo '<div id="message" class="error"><p>'; |
484 echo '<div id="message" class="error"><p>'; |
460 printf( |
485 printf( |
461 /* translators: 1: plugin file 2: error message */ |
486 /* translators: 1: plugin file, 2: error message */ |
462 __( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ), |
487 __( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ), |
463 '<code>' . esc_html( $plugin_file ) . '</code>', |
488 '<code>' . esc_html( $plugin_file ) . '</code>', |
464 $error->get_error_message() ); |
489 $error->get_error_message() |
|
490 ); |
465 echo '</p></div>'; |
491 echo '</p></div>'; |
466 } |
492 } |
467 } |
493 } |
468 ?> |
494 ?> |
469 |
495 |
470 <?php if ( isset($_GET['error']) ) : |
496 <?php |
471 |
497 if ( isset( $_GET['error'] ) ) : |
472 if ( isset( $_GET['main'] ) ) |
498 |
|
499 if ( isset( $_GET['main'] ) ) { |
473 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
500 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
474 elseif ( isset($_GET['charsout']) ) |
501 } elseif ( isset( $_GET['charsout'] ) ) { |
475 $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
502 $errmsg = sprintf( |
476 else |
503 _n( |
477 $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
504 'The plugin generated %d character of <strong>unexpected output</strong> during activation.', |
|
505 'The plugin generated %d characters of <strong>unexpected output</strong> during activation.', |
|
506 $_GET['charsout'] |
|
507 ), |
|
508 $_GET['charsout'] |
|
509 ); |
|
510 $errmsg .= ' ' . __( 'If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ); |
|
511 } elseif ( 'resuming' === $_GET['error'] ) { |
|
512 $errmsg = __( 'Plugin could not be resumed because it triggered a <strong>fatal error</strong>.' ); |
|
513 } else { |
|
514 $errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' ); |
|
515 } |
478 ?> |
516 ?> |
479 <div id="message" class="error"><p><?php echo $errmsg; ?></p> |
517 <div id="message" class="error"><p><?php echo $errmsg; ?></p> |
480 <?php |
518 <?php |
481 if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) { |
519 if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) { |
482 $iframe_url = add_query_arg( array( |
520 $iframe_url = add_query_arg( |
|
521 array( |
483 'action' => 'error_scrape', |
522 'action' => 'error_scrape', |
484 'plugin' => urlencode( $plugin ), |
523 'plugin' => urlencode( $plugin ), |
485 '_wpnonce' => urlencode( $_GET['_error_nonce'] ), |
524 '_wpnonce' => urlencode( $_GET['_error_nonce'] ), |
486 ), admin_url( 'plugins.php' ) ); |
525 ), |
|
526 admin_url( 'plugins.php' ) |
|
527 ); |
487 ?> |
528 ?> |
488 <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> |
529 <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> |
489 <?php |
530 <?php |
490 } |
531 } |
491 ?> |
532 ?> |
492 </div> |
533 </div> |
493 <?php elseif ( isset($_GET['deleted']) ) : |
534 <?php |
|
535 elseif ( isset( $_GET['deleted'] ) ) : |
494 $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); |
536 $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); |
495 // Delete it once we're done. |
537 // Delete it once we're done. |
496 delete_transient( 'plugins_delete_result_' . $user_ID ); |
538 delete_transient( 'plugins_delete_result_' . $user_ID ); |
497 |
539 |
498 if ( is_wp_error($delete_result) ) : ?> |
540 if ( is_wp_error( $delete_result ) ) : |
499 <div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
541 ?> |
|
542 <div id="message" class="error notice is-dismissible"><p><?php printf( __( 'Plugin could not be deleted due to an error: %s' ), $delete_result->get_error_message() ); ?></p></div> |
500 <?php else : ?> |
543 <?php else : ?> |
501 <div id="message" class="updated notice is-dismissible"> |
544 <div id="message" class="updated notice is-dismissible"> |
502 <p> |
545 <p> |
503 <?php |
546 <?php |
504 if ( 1 == (int) $_GET['deleted'] ) { |
547 if ( 1 == (int) $_GET['deleted'] ) { |