337 $plugins_to_delete = count( $plugin_info ); |
339 $plugins_to_delete = count( $plugin_info ); |
338 |
340 |
339 ?> |
341 ?> |
340 <?php if ( 1 === $plugins_to_delete ) : ?> |
342 <?php if ( 1 === $plugins_to_delete ) : ?> |
341 <h1><?php _e( 'Delete Plugin' ); ?></h1> |
343 <h1><?php _e( 'Delete Plugin' ); ?></h1> |
342 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
344 <?php |
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> |
345 if ( $have_non_network_plugins && is_network_admin() ) : |
344 <?php endif; ?> |
346 $maybe_active_plugin = '<strong>' . __( 'Caution:' ) . '</strong> ' . __( 'This plugin may be active on other sites in the network.' ); |
|
347 wp_admin_notice( |
|
348 $maybe_active_plugin, |
|
349 array( |
|
350 'additional_classes' => array( 'error' ), |
|
351 ) |
|
352 ); |
|
353 endif; |
|
354 ?> |
345 <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
355 <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
346 <?php else : ?> |
356 <?php else : ?> |
347 <h1><?php _e( 'Delete Plugins' ); ?></h1> |
357 <h1><?php _e( 'Delete Plugins' ); ?></h1> |
348 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
358 <?php |
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> |
359 if ( $have_non_network_plugins && is_network_admin() ) : |
350 <?php endif; ?> |
360 $maybe_active_plugins = '<strong>' . __( 'Caution:' ) . '</strong> ' . __( 'These plugins may be active on other sites in the network.' ); |
|
361 wp_admin_notice( |
|
362 $maybe_active_plugins, |
|
363 array( |
|
364 'additional_classes' => array( 'error' ), |
|
365 ) |
|
366 ); |
|
367 endif; |
|
368 ?> |
351 <p><?php _e( 'You are about to remove the following plugins:' ); ?></p> |
369 <p><?php _e( 'You are about to remove the following plugins:' ); ?></p> |
352 <?php endif; ?> |
370 <?php endif; ?> |
353 <ul class="ul-disc"> |
371 <ul class="ul-disc"> |
354 <?php |
372 <?php |
355 |
373 |
409 $plugins_to_delete = count( $plugins ); |
427 $plugins_to_delete = count( $plugins ); |
410 } // End if verify-delete. |
428 } // End if verify-delete. |
411 |
429 |
412 $delete_result = delete_plugins( $plugins ); |
430 $delete_result = delete_plugins( $plugins ); |
413 |
431 |
414 // Store the result in a cache rather than a URL param due to object type & length. |
432 // Store the result in an option rather than a URL param due to object type & length. |
415 set_transient( 'plugins_delete_result_' . $user_ID, $delete_result ); |
433 // Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete. |
|
434 update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false ); |
416 wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); |
435 wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); |
417 exit; |
436 exit; |
418 case 'clear-recent-list': |
437 case 'clear-recent-list': |
419 if ( ! is_network_admin() ) { |
438 if ( ! is_network_admin() ) { |
420 update_option( 'recently_activated', array() ); |
439 update_option( 'recently_activated', array() ); |
545 'content' => |
564 '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>' . |
565 '<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>' . |
566 '<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( |
567 '<p>' . sprintf( |
549 /* translators: %s: WordPress Plugin Directory URL. */ |
568 /* 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!' ), |
569 __( 'If you would like to see more plugins to choose from, click on the “Add New Plugin” 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/' ) |
570 __( 'https://wordpress.org/plugins/' ) |
552 ) . '</p>', |
571 ) . '</p>', |
553 ) |
572 ) |
554 ); |
573 ); |
555 get_current_screen()->add_help_tab( |
574 get_current_screen()->add_help_tab( |
578 '<p>' . __( 'Auto-updates are only available for plugins recognized by WordPress.org, or that include a compatible update system.' ) . '</p>' . |
597 '<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>', |
598 '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>', |
580 ) |
599 ) |
581 ); |
600 ); |
582 |
601 |
583 $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>'; |
602 $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>'; |
584 } |
603 } |
585 |
604 |
586 get_current_screen()->set_help_sidebar( |
605 get_current_screen()->set_help_sidebar( |
587 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
606 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
588 '<p>' . __( '<a href="https://wordpress.org/support/article/managing-plugins/">Documentation on Managing Plugins</a>' ) . '</p>' . |
607 '<p>' . __( '<a href="https://wordpress.org/documentation/article/manage-plugins/">Documentation on Managing Plugins</a>' ) . '</p>' . |
589 $help_sidebar_autoupdates . |
608 $help_sidebar_autoupdates . |
590 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
609 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' |
591 ); |
610 ); |
592 |
611 |
593 get_current_screen()->set_screen_reader_content( |
612 get_current_screen()->set_screen_reader_content( |
594 array( |
613 array( |
595 'heading_views' => __( 'Filter plugins list' ), |
614 'heading_views' => __( 'Filter plugins list' ), |
605 require_once ABSPATH . 'wp-admin/admin-header.php'; |
624 require_once ABSPATH . 'wp-admin/admin-header.php'; |
606 |
625 |
607 $invalid = validate_active_plugins(); |
626 $invalid = validate_active_plugins(); |
608 if ( ! empty( $invalid ) ) { |
627 if ( ! empty( $invalid ) ) { |
609 foreach ( $invalid as $plugin_file => $error ) { |
628 foreach ( $invalid as $plugin_file => $error ) { |
610 echo '<div id="message" class="error"><p>'; |
629 $deactivated_message = sprintf( |
611 printf( |
|
612 /* translators: 1: Plugin file, 2: Error message. */ |
630 /* translators: 1: Plugin file, 2: Error message. */ |
613 __( 'The plugin %1$s has been deactivated due to an error: %2$s' ), |
631 __( 'The plugin %1$s has been deactivated due to an error: %2$s' ), |
614 '<code>' . esc_html( $plugin_file ) . '</code>', |
632 '<code>' . esc_html( $plugin_file ) . '</code>', |
615 esc_html( $error->get_error_message() ) |
633 esc_html( $error->get_error_message() ) |
616 ); |
634 ); |
617 echo '</p></div>'; |
635 wp_admin_notice( |
|
636 $deactivated_message, |
|
637 array( |
|
638 'id' => 'message', |
|
639 'additional_classes' => array( 'error' ), |
|
640 ) |
|
641 ); |
618 } |
642 } |
619 } |
643 } |
620 |
644 |
621 if ( isset( $_GET['error'] ) ) : |
645 // Used by wp_admin_notice() updated notices. |
|
646 $updated_notice_args = array( |
|
647 'id' => 'message', |
|
648 'additional_classes' => array( 'updated' ), |
|
649 'dismissible' => true, |
|
650 ); |
|
651 if ( isset( $_GET['error'] ) ) { |
622 |
652 |
623 if ( isset( $_GET['main'] ) ) { |
653 if ( isset( $_GET['main'] ) ) { |
624 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
654 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
625 } elseif ( isset( $_GET['charsout'] ) ) { |
655 } elseif ( isset( $_GET['charsout'] ) ) { |
626 $errmsg = sprintf( |
656 $errmsg = sprintf( |
653 '_wpnonce' => urlencode( $_GET['_error_nonce'] ), |
679 '_wpnonce' => urlencode( $_GET['_error_nonce'] ), |
654 ), |
680 ), |
655 admin_url( 'plugins.php' ) |
681 admin_url( 'plugins.php' ) |
656 ); |
682 ); |
657 |
683 |
658 ?> |
684 $errmsg .= '<iframe style="border:0" width="100%" height="70px" src="' . esc_url( $iframe_url ) . '"></iframe>'; |
659 <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> |
|
660 <?php |
|
661 } |
685 } |
662 |
686 |
663 ?> |
687 wp_admin_notice( |
664 </div> |
688 $errmsg, |
665 <?php |
689 array( |
666 elseif ( isset( $_GET['deleted'] ) ) : |
690 'id' => 'message', |
667 $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); |
691 'additional_classes' => array( 'error' ), |
|
692 ) |
|
693 ); |
|
694 |
|
695 } elseif ( isset( $_GET['deleted'] ) ) { |
|
696 $delete_result = get_option( 'plugins_delete_result_' . $user_ID ); |
668 // Delete it once we're done. |
697 // Delete it once we're done. |
669 delete_transient( 'plugins_delete_result_' . $user_ID ); |
698 delete_option( 'plugins_delete_result_' . $user_ID ); |
670 |
699 |
671 if ( is_wp_error( $delete_result ) ) : |
700 if ( is_wp_error( $delete_result ) ) { |
672 ?> |
701 $plugin_not_deleted_message = sprintf( |
673 <div id="message" class="error notice is-dismissible"> |
702 /* translators: %s: Error message. */ |
674 <p> |
703 __( 'Plugin could not be deleted due to an error: %s' ), |
675 <?php |
704 esc_html( $delete_result->get_error_message() ) |
676 printf( |
705 ); |
677 /* translators: %s: Error message. */ |
706 wp_admin_notice( |
678 __( 'Plugin could not be deleted due to an error: %s' ), |
707 $plugin_not_deleted_message, |
679 esc_html( $delete_result->get_error_message() ) |
708 array( |
680 ); |
709 'id' => 'message', |
681 ?> |
710 'additional_classes' => array( 'error' ), |
682 </p> |
711 'dismissible' => true, |
683 </div> |
712 ) |
684 <?php else : ?> |
713 ); |
685 <div id="message" class="updated notice is-dismissible"> |
714 } else { |
686 <p> |
715 if ( 1 === (int) $_GET['deleted'] ) { |
687 <?php |
716 $plugins_deleted_message = __( 'The selected plugin has been deleted.' ); |
688 if ( 1 === (int) $_GET['deleted'] ) { |
717 } else { |
689 _e( 'The selected plugin has been deleted.' ); |
718 $plugins_deleted_message = __( 'The selected plugins have been deleted.' ); |
690 } else { |
719 } |
691 _e( 'The selected plugins have been deleted.' ); |
720 wp_admin_notice( $plugins_deleted_message, $updated_notice_args ); |
692 } |
721 } |
693 ?> |
722 } elseif ( isset( $_GET['activate'] ) ) { |
694 </p> |
723 wp_admin_notice( __( 'Plugin activated.' ), $updated_notice_args ); |
695 </div> |
724 } elseif ( isset( $_GET['activate-multi'] ) ) { |
696 <?php endif; ?> |
725 wp_admin_notice( __( 'Selected plugins activated.' ), $updated_notice_args ); |
697 <?php elseif ( isset( $_GET['activate'] ) ) : ?> |
726 } elseif ( isset( $_GET['deactivate'] ) ) { |
698 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin activated.' ); ?></p></div> |
727 wp_admin_notice( __( 'Plugin deactivated.' ), $updated_notice_args ); |
699 <?php elseif ( isset( $_GET['activate-multi'] ) ) : ?> |
728 } elseif ( isset( $_GET['deactivate-multi'] ) ) { |
700 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins activated.' ); ?></p></div> |
729 wp_admin_notice( __( 'Selected plugins deactivated.' ), $updated_notice_args ); |
701 <?php elseif ( isset( $_GET['deactivate'] ) ) : ?> |
730 } elseif ( 'update-selected' === $action ) { |
702 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin deactivated.' ); ?></p></div> |
731 wp_admin_notice( __( 'All selected plugins are up to date.' ), $updated_notice_args ); |
703 <?php elseif ( isset( $_GET['deactivate-multi'] ) ) : ?> |
732 } elseif ( isset( $_GET['resume'] ) ) { |
704 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins deactivated.' ); ?></p></div> |
733 wp_admin_notice( __( 'Plugin resumed.' ), $updated_notice_args ); |
705 <?php elseif ( 'update-selected' === $action ) : ?> |
734 } elseif ( isset( $_GET['enabled-auto-update'] ) ) { |
706 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.' ); ?></p></div> |
735 wp_admin_notice( __( 'Plugin will be auto-updated.' ), $updated_notice_args ); |
707 <?php elseif ( isset( $_GET['resume'] ) ) : ?> |
736 } elseif ( isset( $_GET['disabled-auto-update'] ) ) { |
708 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin resumed.' ); ?></p></div> |
737 wp_admin_notice( __( 'Plugin will no longer be auto-updated.' ), $updated_notice_args ); |
709 <?php elseif ( isset( $_GET['enabled-auto-update'] ) ) : ?> |
738 } elseif ( isset( $_GET['enabled-auto-update-multi'] ) ) { |
710 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin will be auto-updated.' ); ?></p></div> |
739 wp_admin_notice( __( 'Selected plugins will be auto-updated.' ), $updated_notice_args ); |
711 <?php elseif ( isset( $_GET['disabled-auto-update'] ) ) : ?> |
740 } elseif ( isset( $_GET['disabled-auto-update-multi'] ) ) { |
712 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin will no longer be auto-updated.' ); ?></p></div> |
741 wp_admin_notice( __( 'Selected plugins will no longer be auto-updated.' ), $updated_notice_args ); |
713 <?php elseif ( isset( $_GET['enabled-auto-update-multi'] ) ) : ?> |
742 } |
714 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins will be auto-updated.' ); ?></p></div> |
743 ?> |
715 <?php elseif ( isset( $_GET['disabled-auto-update-multi'] ) ) : ?> |
744 |
716 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins will no longer be auto-updated.' ); ?></p></div> |
745 <?php WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies(); ?> |
717 <?php endif; ?> |
746 <?php WP_Plugin_Dependencies::display_admin_notice_for_circular_dependencies(); ?> |
718 |
|
719 <div class="wrap"> |
747 <div class="wrap"> |
720 <h1 class="wp-heading-inline"> |
748 <h1 class="wp-heading-inline"> |
721 <?php |
749 <?php |
722 echo esc_html( $title ); |
750 echo esc_html( $title ); |
723 ?> |
751 ?> |
724 </h1> |
752 </h1> |
725 |
753 |
726 <?php |
754 <?php |
727 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_plugins' ) ) { |
755 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_plugins' ) ) { |
728 ?> |
756 ?> |
729 <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a> |
757 <a href="<?php echo esc_url( self_admin_url( 'plugin-install.php' ) ); ?>" class="page-title-action"><?php echo esc_html__( 'Add New Plugin' ); ?></a> |
730 <?php |
758 <?php |
731 } |
759 } |
732 |
760 |
733 if ( strlen( $s ) ) { |
761 if ( strlen( $s ) ) { |
734 echo '<span class="subtitle">'; |
762 echo '<span class="subtitle">'; |