[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Plugins administration panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 require_once __DIR__ . '/admin.php'; 11 12 if ( ! current_user_can( 'activate_plugins' ) ) { 13 wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) ); 14 } 15 16 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); 17 $pagenum = $wp_list_table->get_pagenum(); 18 19 $action = $wp_list_table->current_action(); 20 21 $plugin = isset( $_REQUEST['plugin'] ) ? wp_unslash( $_REQUEST['plugin'] ) : ''; 22 $s = isset( $_REQUEST['s'] ) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : ''; 23 24 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. 25 $query_args_to_remove = array( 26 'error', 27 'deleted', 28 'activate', 29 'activate-multi', 30 'deactivate', 31 'deactivate-multi', 32 'enabled-auto-update', 33 'disabled-auto-update', 34 'enabled-auto-update-multi', 35 'disabled-auto-update-multi', 36 '_error_nonce', 37 ); 38 39 $_SERVER['REQUEST_URI'] = remove_query_arg( $query_args_to_remove, $_SERVER['REQUEST_URI'] ); 40 41 wp_enqueue_script( 'updates' ); 42 43 if ( $action ) { 44 45 switch ( $action ) { 46 case 'activate': 47 if ( ! current_user_can( 'activate_plugin', $plugin ) ) { 48 wp_die( __( 'Sorry, you are not allowed to activate this plugin.' ) ); 49 } 50 51 if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) { 52 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 53 exit; 54 } 55 56 check_admin_referer( 'activate-plugin_' . $plugin ); 57 58 $result = activate_plugin( $plugin, self_admin_url( 'plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() ); 59 if ( is_wp_error( $result ) ) { 60 if ( 'unexpected_output' === $result->get_error_code() ) { 61 $redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s" ); 62 wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); 63 exit; 64 } else { 65 wp_die( $result ); 66 } 67 } 68 69 if ( ! is_network_admin() ) { 70 $recent = (array) get_option( 'recently_activated' ); 71 unset( $recent[ $plugin ] ); 72 update_option( 'recently_activated', $recent ); 73 } else { 74 $recent = (array) get_site_option( 'recently_activated' ); 75 unset( $recent[ $plugin ] ); 76 update_site_option( 'recently_activated', $recent ); 77 } 78 79 if ( isset( $_GET['from'] ) && 'import' === $_GET['from'] ) { 80 // Overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix. 81 wp_redirect( self_admin_url( 'import.php?import=' . str_replace( '-importer', '', dirname( $plugin ) ) ) ); 82 } elseif ( isset( $_GET['from'] ) && 'press-this' === $_GET['from'] ) { 83 wp_redirect( self_admin_url( 'press-this.php' ) ); 84 } else { 85 // Overrides the ?error=true one above. 86 wp_redirect( self_admin_url( "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s" ) ); 87 } 88 exit; 89 90 case 'activate-selected': 91 if ( ! current_user_can( 'activate_plugins' ) ) { 92 wp_die( __( 'Sorry, you are not allowed to activate plugins for this site.' ) ); 93 } 94 95 check_admin_referer( 'bulk-plugins' ); 96 97 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); 98 99 if ( is_network_admin() ) { 100 foreach ( $plugins as $i => $plugin ) { 101 // Only activate plugins which are not already network activated. 102 if ( is_plugin_active_for_network( $plugin ) ) { 103 unset( $plugins[ $i ] ); 104 } 105 } 106 } else { 107 foreach ( $plugins as $i => $plugin ) { 108 // Only activate plugins which are not already active and are not network-only when on Multisite. 109 if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) { 110 unset( $plugins[ $i ] ); 111 } 112 // Only activate plugins which the user can activate. 113 if ( ! current_user_can( 'activate_plugin', $plugin ) ) { 114 unset( $plugins[ $i ] ); 115 } 116 } 117 } 118 119 if ( empty( $plugins ) ) { 120 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 121 exit; 122 } 123 124 activate_plugins( $plugins, self_admin_url( 'plugins.php?error=true' ), is_network_admin() ); 125 126 if ( ! is_network_admin() ) { 127 $recent = (array) get_option( 'recently_activated' ); 128 } else { 129 $recent = (array) get_site_option( 'recently_activated' ); 130 } 131 132 foreach ( $plugins as $plugin ) { 133 unset( $recent[ $plugin ] ); 134 } 135 136 if ( ! is_network_admin() ) { 137 update_option( 'recently_activated', $recent ); 138 } else { 139 update_site_option( 'recently_activated', $recent ); 140 } 141 142 wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ); 143 exit; 144 145 case 'update-selected': 146 check_admin_referer( 'bulk-plugins' ); 147 148 if ( isset( $_GET['plugins'] ) ) { 149 $plugins = explode( ',', wp_unslash( $_GET['plugins'] ) ); 150 } elseif ( isset( $_POST['checked'] ) ) { 151 $plugins = (array) wp_unslash( $_POST['checked'] ); 152 } else { 153 $plugins = array(); 154 } 155 156 // Used in the HTML title tag. 157 $title = __( 'Update Plugins' ); 158 $parent_file = 'plugins.php'; 159 160 wp_enqueue_script( 'updates' ); 161 require_once ABSPATH . 'wp-admin/admin-header.php'; 162 163 echo '<div class="wrap">'; 164 echo '<h1>' . esc_html( $title ) . '</h1>'; 165 166 $url = self_admin_url( 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) ) ); 167 $url = wp_nonce_url( $url, 'bulk-update-plugins' ); 168 169 echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; 170 echo '</div>'; 171 require_once ABSPATH . 'wp-admin/admin-footer.php'; 172 exit; 173 174 case 'error_scrape': 175 if ( ! current_user_can( 'activate_plugin', $plugin ) ) { 176 wp_die( __( 'Sorry, you are not allowed to activate this plugin.' ) ); 177 } 178 179 check_admin_referer( 'plugin-activation-error_' . $plugin ); 180 181 $valid = validate_plugin( $plugin ); 182 if ( is_wp_error( $valid ) ) { 183 wp_die( $valid ); 184 } 185 186 if ( ! WP_DEBUG ) { 187 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 ); 188 } 189 190 ini_set( 'display_errors', true ); // Ensure that fatal errors are displayed. 191 // Go back to "sandbox" scope so we get the same errors as before. 192 plugin_sandbox_scrape( $plugin ); 193 /** This action is documented in wp-admin/includes/plugin.php */ 194 do_action( "activate_{$plugin}" ); 195 exit; 196 197 case 'deactivate': 198 if ( ! current_user_can( 'deactivate_plugin', $plugin ) ) { 199 wp_die( __( 'Sorry, you are not allowed to deactivate this plugin.' ) ); 200 } 201 202 check_admin_referer( 'deactivate-plugin_' . $plugin ); 203 204 if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) { 205 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 206 exit; 207 } 208 209 deactivate_plugins( $plugin, false, is_network_admin() ); 210 211 if ( ! is_network_admin() ) { 212 update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); 213 } else { 214 update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) ); 215 } 216 217 if ( headers_sent() ) { 218 echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; 219 } else { 220 wp_redirect( self_admin_url( "plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) ); 221 } 222 exit; 223 224 case 'deactivate-selected': 225 if ( ! current_user_can( 'deactivate_plugins' ) ) { 226 wp_die( __( 'Sorry, you are not allowed to deactivate plugins for this site.' ) ); 227 } 228 229 check_admin_referer( 'bulk-plugins' ); 230 231 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); 232 // Do not deactivate plugins which are already deactivated. 233 if ( is_network_admin() ) { 234 $plugins = array_filter( $plugins, 'is_plugin_active_for_network' ); 235 } else { 236 $plugins = array_filter( $plugins, 'is_plugin_active' ); 237 $plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) ); 238 239 foreach ( $plugins as $i => $plugin ) { 240 // Only deactivate plugins which the user can deactivate. 241 if ( ! current_user_can( 'deactivate_plugin', $plugin ) ) { 242 unset( $plugins[ $i ] ); 243 } 244 } 245 } 246 if ( empty( $plugins ) ) { 247 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 248 exit; 249 } 250 251 deactivate_plugins( $plugins, false, is_network_admin() ); 252 253 $deactivated = array(); 254 foreach ( $plugins as $plugin ) { 255 $deactivated[ $plugin ] = time(); 256 } 257 258 if ( ! is_network_admin() ) { 259 update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); 260 } else { 261 update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); 262 } 263 264 wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ); 265 exit; 266 267 case 'delete-selected': 268 if ( ! current_user_can( 'delete_plugins' ) ) { 269 wp_die( __( 'Sorry, you are not allowed to delete plugins for this site.' ) ); 270 } 271 272 check_admin_referer( 'bulk-plugins' ); 273 274 // $_POST = from the plugin form; $_GET = from the FTP details screen. 275 $plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array(); 276 if ( empty( $plugins ) ) { 277 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 278 exit; 279 } 280 281 $plugins = array_filter( $plugins, 'is_plugin_inactive' ); // Do not allow to delete activated plugins. 282 if ( empty( $plugins ) ) { 283 wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); 284 exit; 285 } 286 287 // Bail on all if any paths are invalid. 288 // validate_file() returns truthy for invalid files. 289 $invalid_plugin_files = array_filter( $plugins, 'validate_file' ); 290 if ( $invalid_plugin_files ) { 291 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 292 exit; 293 } 294 295 require ABSPATH . 'wp-admin/update.php'; 296 297 $parent_file = 'plugins.php'; 298 299 if ( ! isset( $_REQUEST['verify-delete'] ) ) { 300 wp_enqueue_script( 'jquery' ); 301 require_once ABSPATH . 'wp-admin/admin-header.php'; 302 303 ?> 304 <div class="wrap"> 305 <?php 306 307 $plugin_info = array(); 308 $have_non_network_plugins = false; 309 310 foreach ( (array) $plugins as $plugin ) { 311 $plugin_slug = dirname( $plugin ); 312 313 if ( '.' === $plugin_slug ) { 314 $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 315 if ( $data ) { 316 $plugin_info[ $plugin ] = $data; 317 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 318 if ( ! $plugin_info[ $plugin ]['Network'] ) { 319 $have_non_network_plugins = true; 320 } 321 } 322 } else { 323 // Get plugins list from that folder. 324 $folder_plugins = get_plugins( '/' . $plugin_slug ); 325 if ( $folder_plugins ) { 326 foreach ( $folder_plugins as $plugin_file => $data ) { 327 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); 328 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 329 if ( ! $plugin_info[ $plugin_file ]['Network'] ) { 330 $have_non_network_plugins = true; 331 } 332 } 333 } 334 } 335 } 336 337 $plugins_to_delete = count( $plugin_info ); 338 339 ?> 340 <?php if ( 1 === $plugins_to_delete ) : ?> 341 <h1><?php _e( 'Delete Plugin' ); ?></h1> 342 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> 343 <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> 344 <?php endif; ?> 345 <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> 346 <?php else : ?> 347 <h1><?php _e( 'Delete Plugins' ); ?></h1> 348 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> 349 <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> 350 <?php endif; ?> 351 <p><?php _e( 'You are about to remove the following plugins:' ); ?></p> 352 <?php endif; ?> 353 <ul class="ul-disc"> 354 <?php 355 356 $data_to_delete = false; 357 358 foreach ( $plugin_info as $plugin ) { 359 if ( $plugin['is_uninstallable'] ) { 360 /* translators: 1: Plugin name, 2: Plugin author. */ 361 echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>'; 362 $data_to_delete = true; 363 } else { 364 /* translators: 1: Plugin name, 2: Plugin author. */ 365 echo '<li>', sprintf( _x( '%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>'; 366 } 367 } 368 369 ?> 370 </ul> 371 <p> 372 <?php 373 374 if ( $data_to_delete ) { 375 _e( 'Are you sure you want to delete these files and data?' ); 376 } else { 377 _e( 'Are you sure you want to delete these files?' ); 378 } 379 380 ?> 381 </p> 382 <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" style="display:inline;"> 383 <input type="hidden" name="verify-delete" value="1" /> 384 <input type="hidden" name="action" value="delete-selected" /> 385 <?php 386 387 foreach ( (array) $plugins as $plugin ) { 388 echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; 389 } 390 391 ?> 392 <?php wp_nonce_field( 'bulk-plugins' ); ?> 393 <?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), '', 'submit', false ); ?> 394 </form> 395 <?php 396 397 $referer = wp_get_referer(); 398 399 ?> 400 <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> 401 <?php submit_button( __( 'No, return me to the plugin list' ), '', 'submit', false ); ?> 402 </form> 403 </div> 404 <?php 405 406 require_once ABSPATH . 'wp-admin/admin-footer.php'; 407 exit; 408 } else { 409 $plugins_to_delete = count( $plugins ); 410 } // End if verify-delete. 411 412 $delete_result = delete_plugins( $plugins ); 413 414 // Store the result in a cache rather than a URL param due to object type & length. 415 set_transient( 'plugins_delete_result_' . $user_ID, $delete_result ); 416 wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); 417 exit; 418 case 'clear-recent-list': 419 if ( ! is_network_admin() ) { 420 update_option( 'recently_activated', array() ); 421 } else { 422 update_site_option( 'recently_activated', array() ); 423 } 424 425 break; 426 case 'resume': 427 if ( is_multisite() ) { 428 return; 429 } 430 431 if ( ! current_user_can( 'resume_plugin', $plugin ) ) { 432 wp_die( __( 'Sorry, you are not allowed to resume this plugin.' ) ); 433 } 434 435 check_admin_referer( 'resume-plugin_' . $plugin ); 436 437 $result = resume_plugin( $plugin, self_admin_url( "plugins.php?error=resuming&plugin_status=$status&paged=$page&s=$s" ) ); 438 439 if ( is_wp_error( $result ) ) { 440 wp_die( $result ); 441 } 442 443 wp_redirect( self_admin_url( "plugins.php?resume=true&plugin_status=$status&paged=$page&s=$s" ) ); 444 exit; 445 case 'enable-auto-update': 446 case 'disable-auto-update': 447 case 'enable-auto-update-selected': 448 case 'disable-auto-update-selected': 449 if ( ! current_user_can( 'update_plugins' ) || ! wp_is_auto_update_enabled_for_type( 'plugin' ) ) { 450 wp_die( __( 'Sorry, you are not allowed to manage plugins automatic updates.' ) ); 451 } 452 453 if ( is_multisite() && ! is_network_admin() ) { 454 wp_die( __( 'Please connect to your network admin to manage plugins automatic updates.' ) ); 455 } 456 457 $redirect = self_admin_url( "plugins.php?plugin_status={$status}&paged={$page}&s={$s}" ); 458 459 if ( 'enable-auto-update' === $action || 'disable-auto-update' === $action ) { 460 if ( empty( $plugin ) ) { 461 wp_redirect( $redirect ); 462 exit; 463 } 464 465 check_admin_referer( 'updates' ); 466 } else { 467 if ( empty( $_POST['checked'] ) ) { 468 wp_redirect( $redirect ); 469 exit; 470 } 471 472 check_admin_referer( 'bulk-plugins' ); 473 } 474 475 $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); 476 477 if ( 'enable-auto-update' === $action ) { 478 $auto_updates[] = $plugin; 479 $auto_updates = array_unique( $auto_updates ); 480 $redirect = add_query_arg( array( 'enabled-auto-update' => 'true' ), $redirect ); 481 } elseif ( 'disable-auto-update' === $action ) { 482 $auto_updates = array_diff( $auto_updates, array( $plugin ) ); 483 $redirect = add_query_arg( array( 'disabled-auto-update' => 'true' ), $redirect ); 484 } else { 485 $plugins = (array) wp_unslash( $_POST['checked'] ); 486 487 if ( 'enable-auto-update-selected' === $action ) { 488 $new_auto_updates = array_merge( $auto_updates, $plugins ); 489 $new_auto_updates = array_unique( $new_auto_updates ); 490 $query_args = array( 'enabled-auto-update-multi' => 'true' ); 491 } else { 492 $new_auto_updates = array_diff( $auto_updates, $plugins ); 493 $query_args = array( 'disabled-auto-update-multi' => 'true' ); 494 } 495 496 // Return early if all selected plugins already have auto-updates enabled or disabled. 497 // Must use non-strict comparison, so that array order is not treated as significant. 498 if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison 499 wp_redirect( $redirect ); 500 exit; 501 } 502 503 $auto_updates = $new_auto_updates; 504 $redirect = add_query_arg( $query_args, $redirect ); 505 } 506 507 /** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */ 508 $all_items = apply_filters( 'all_plugins', get_plugins() ); 509 510 // Remove plugins that don't exist or have been deleted since the option was last updated. 511 $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); 512 513 update_site_option( 'auto_update_plugins', $auto_updates ); 514 515 wp_redirect( $redirect ); 516 exit; 517 default: 518 if ( isset( $_POST['checked'] ) ) { 519 check_admin_referer( 'bulk-plugins' ); 520 521 $screen = get_current_screen()->id; 522 $sendback = wp_get_referer(); 523 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); 524 525 /** This action is documented in wp-admin/edit.php */ 526 $sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $action, $plugins ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 527 wp_safe_redirect( $sendback ); 528 exit; 529 } 530 break; 531 } 532 } 533 534 $wp_list_table->prepare_items(); 535 536 wp_enqueue_script( 'plugin-install' ); 537 add_thickbox(); 538 539 add_screen_option( 'per_page', array( 'default' => 999 ) ); 540 541 get_current_screen()->add_help_tab( 542 array( 543 'id' => 'overview', 544 'title' => __( 'Overview' ), 545 'content' => 546 '<p>' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '</p>' . 547 '<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>' . 548 '<p>' . sprintf( 549 /* translators: %s: WordPress Plugin Directory URL. */ 550 __( '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!' ), 551 __( 'https://wordpress.org/plugins/' ) 552 ) . '</p>', 553 ) 554 ); 555 get_current_screen()->add_help_tab( 556 array( 557 'id' => 'compatibility-problems', 558 'title' => __( 'Troubleshooting' ), 559 'content' => 560 '<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>' . 561 '<p>' . sprintf( 562 /* translators: %s: WP_PLUGIN_DIR constant value. */ 563 __( 'If something goes wrong with a plugin and you cannot use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), 564 '<code>' . WP_PLUGIN_DIR . '</code>' 565 ) . '</p>', 566 ) 567 ); 568 569 $help_sidebar_autoupdates = ''; 570 571 if ( current_user_can( 'update_plugins' ) && wp_is_auto_update_enabled_for_type( 'plugin' ) ) { 572 get_current_screen()->add_help_tab( 573 array( 574 'id' => 'plugins-themes-auto-updates', 575 'title' => __( 'Auto-updates' ), 576 'content' => 577 '<p>' . __( 'Auto-updates can be enabled or disabled for each individual plugin. Plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>' . 578 '<p>' . __( 'Auto-updates are only available for plugins recognized by WordPress.org, or that include a compatible update system.' ) . '</p>' . 579 '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>', 580 ) 581 ); 582 583 $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>'; 584 } 585 586 get_current_screen()->set_help_sidebar( 587 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 588 '<p>' . __( '<a href="https://wordpress.org/support/article/managing-plugins/">Documentation on Managing Plugins</a>' ) . '</p>' . 589 $help_sidebar_autoupdates . 590 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 591 ); 592 593 get_current_screen()->set_screen_reader_content( 594 array( 595 'heading_views' => __( 'Filter plugins list' ), 596 'heading_pagination' => __( 'Plugins list navigation' ), 597 'heading_list' => __( 'Plugins list' ), 598 ) 599 ); 600 601 // Used in the HTML title tag. 602 $title = __( 'Plugins' ); 603 $parent_file = 'plugins.php'; 604 605 require_once ABSPATH . 'wp-admin/admin-header.php'; 606 607 $invalid = validate_active_plugins(); 608 if ( ! empty( $invalid ) ) { 609 foreach ( $invalid as $plugin_file => $error ) { 610 echo '<div id="message" class="error"><p>'; 611 printf( 612 /* translators: 1: Plugin file, 2: Error message. */ 613 __( 'The plugin %1$s has been deactivated due to an error: %2$s' ), 614 '<code>' . esc_html( $plugin_file ) . '</code>', 615 $error->get_error_message() 616 ); 617 echo '</p></div>'; 618 } 619 } 620 621 if ( isset( $_GET['error'] ) ) : 622 623 if ( isset( $_GET['main'] ) ) { 624 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); 625 } elseif ( isset( $_GET['charsout'] ) ) { 626 $errmsg = sprintf( 627 /* translators: %d: Number of characters. */ 628 _n( 629 'The plugin generated %d character of <strong>unexpected output</strong> during activation.', 630 'The plugin generated %d characters of <strong>unexpected output</strong> during activation.', 631 $_GET['charsout'] 632 ), 633 $_GET['charsout'] 634 ); 635 $errmsg .= ' ' . __( 'If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ); 636 } elseif ( 'resuming' === $_GET['error'] ) { 637 $errmsg = __( 'Plugin could not be resumed because it triggered a <strong>fatal error</strong>.' ); 638 } else { 639 $errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' ); 640 } 641 642 ?> 643 <div id="message" class="error"><p><?php echo $errmsg; ?></p> 644 <?php 645 646 if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) 647 && isset( $_GET['_error_nonce'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) 648 ) { 649 $iframe_url = add_query_arg( 650 array( 651 'action' => 'error_scrape', 652 'plugin' => urlencode( $plugin ), 653 '_wpnonce' => urlencode( $_GET['_error_nonce'] ), 654 ), 655 admin_url( 'plugins.php' ) 656 ); 657 658 ?> 659 <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> 660 <?php 661 } 662 663 ?> 664 </div> 665 <?php 666 elseif ( isset( $_GET['deleted'] ) ) : 667 $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); 668 // Delete it once we're done. 669 delete_transient( 'plugins_delete_result_' . $user_ID ); 670 671 if ( is_wp_error( $delete_result ) ) : 672 ?> 673 <div id="message" class="error notice is-dismissible"> 674 <p> 675 <?php 676 printf( 677 /* translators: %s: Error message. */ 678 __( 'Plugin could not be deleted due to an error: %s' ), 679 $delete_result->get_error_message() 680 ); 681 ?> 682 </p> 683 </div> 684 <?php else : ?> 685 <div id="message" class="updated notice is-dismissible"> 686 <p> 687 <?php 688 if ( 1 === (int) $_GET['deleted'] ) { 689 _e( 'The selected plugin has been deleted.' ); 690 } else { 691 _e( 'The selected plugins have been deleted.' ); 692 } 693 ?> 694 </p> 695 </div> 696 <?php endif; ?> 697 <?php elseif ( isset( $_GET['activate'] ) ) : ?> 698 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin activated.' ); ?></p></div> 699 <?php elseif ( isset( $_GET['activate-multi'] ) ) : ?> 700 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins activated.' ); ?></p></div> 701 <?php elseif ( isset( $_GET['deactivate'] ) ) : ?> 702 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin deactivated.' ); ?></p></div> 703 <?php elseif ( isset( $_GET['deactivate-multi'] ) ) : ?> 704 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins deactivated.' ); ?></p></div> 705 <?php elseif ( 'update-selected' === $action ) : ?> 706 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.' ); ?></p></div> 707 <?php elseif ( isset( $_GET['resume'] ) ) : ?> 708 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin resumed.' ); ?></p></div> 709 <?php elseif ( isset( $_GET['enabled-auto-update'] ) ) : ?> 710 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin will be auto-updated.' ); ?></p></div> 711 <?php elseif ( isset( $_GET['disabled-auto-update'] ) ) : ?> 712 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin will no longer be auto-updated.' ); ?></p></div> 713 <?php elseif ( isset( $_GET['enabled-auto-update-multi'] ) ) : ?> 714 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins will be auto-updated.' ); ?></p></div> 715 <?php elseif ( isset( $_GET['disabled-auto-update-multi'] ) ) : ?> 716 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins will no longer be auto-updated.' ); ?></p></div> 717 <?php endif; ?> 718 719 <div class="wrap"> 720 <h1 class="wp-heading-inline"> 721 <?php 722 echo esc_html( $title ); 723 ?> 724 </h1> 725 726 <?php 727 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_plugins' ) ) { 728 ?> 729 <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a> 730 <?php 731 } 732 733 if ( strlen( $s ) ) { 734 echo '<span class="subtitle">'; 735 printf( 736 /* translators: %s: Search query. */ 737 __( 'Search results for: %s' ), 738 '<strong>' . esc_html( urldecode( $s ) ) . '</strong>' 739 ); 740 echo '</span>'; 741 } 742 ?> 743 744 <hr class="wp-header-end"> 745 746 <?php 747 /** 748 * Fires before the plugins list table is rendered. 749 * 750 * This hook also fires before the plugins list table is rendered in the Network Admin. 751 * 752 * Please note: The 'active' portion of the hook name does not refer to whether the current 753 * view is for active plugins, but rather all plugins actively-installed. 754 * 755 * @since 3.0.0 756 * 757 * @param array[] $plugins_all An array of arrays containing information on all installed plugins. 758 */ 759 do_action( 'pre_current_active_plugins', $plugins['all'] ); 760 ?> 761 762 <?php $wp_list_table->views(); ?> 763 764 <form class="search-form search-plugins" method="get"> 765 <?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?> 766 </form> 767 768 <form method="post" id="bulk-action-form"> 769 770 <input type="hidden" name="plugin_status" value="<?php echo esc_attr( $status ); ?>" /> 771 <input type="hidden" name="paged" value="<?php echo esc_attr( $page ); ?>" /> 772 773 <?php $wp_list_table->display(); ?> 774 </form> 775 776 <span class="spinner"></span> 777 </div> 778 779 <?php 780 wp_print_request_filesystem_credentials_modal(); 781 wp_print_admin_notice_templates(); 782 wp_print_update_row_templates(); 783 784 require_once ABSPATH . 'wp-admin/admin-footer.php';
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Nov 23 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |