PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | pages/page-mainwp-plugins.php +760 -508 5.1 → 6.2.1 View file →
@@ -6,8 +6,13 @@
6 6 */
7 7
8 8 namespace MainWP\Dashboard;
9 9
10 +// Exit if accessed directly.
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
14 +
10 15 /**
11 16 * Class MainWP_Plugins
12 17 *
13 18 * @package MainWP\Dashboard\
@@ -86,9 +91,9 @@
86 91 static::get_class_name(),
87 92 'render',
88 93 )
89 94 );
90 - if ( mainwp_current_user_have_right( 'dashboard', 'install_plugins' ) ) {
95 + if ( \mainwp_current_user_can( 'dashboard', 'install_plugins' ) ) {
91 96 $page = add_submenu_page(
92 97 'mainwp_tab',
93 98 __( 'Plugins', 'mainwp' ),
94 99 '<div class="mainwp-hidden">' . esc_html__( 'Install ', 'mainwp' ) . '</div>',
@@ -126,8 +131,19 @@
126 131 );
127 132 add_submenu_page(
128 133 'mainwp_tab',
129 134 __( 'Plugins', 'mainwp' ),
135 + '<div class="mainwp-hidden">' . esc_html__( 'Abandoned Plugins', 'mainwp' ) . '</div>',
136 + 'read',
137 + 'PluginsAbandoned',
138 + array(
139 + static::get_class_name(),
140 + 'render_abandoned_plugins',
141 + )
142 + );
143 + add_submenu_page(
144 + 'mainwp_tab',
145 + __( 'Plugins', 'mainwp' ),
130 146 '<div class="mainwp-hidden">' . esc_html__( 'Ignored Abandoned', 'mainwp' ) . '</div>',
131 147 'read',
132 148 'PluginsIgnoredAbandoned',
133 149 array(
@@ -187,9 +203,9 @@
187 203 <div class="wp-submenu sub-open" >
188 204 <div class="mainwp_boxout">
189 205 <div class="mainwp_boxoutin"></div>
190 206 <a href="<?php echo esc_url( admin_url( 'admin.php?page=PluginsManage' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Manage Plugins', 'mainwp' ); ?></a>
191 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'install_plugins' ) ) : ?>
207 + <?php if ( \mainwp_current_user_can( 'dashboard', 'install_plugins' ) ) : ?>
192 208 <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PluginsInstall' ) ) : ?>
193 209 <a href="<?php echo esc_url( admin_url( 'admin.php?page=PluginsInstall' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Install Plugins', 'mainwp' ); ?></a>
194 210 <?php endif; ?>
195 211 <?php endif; ?>
@@ -278,10 +294,10 @@
278 294 ),
279 295 array(
280 296 'title' => esc_html__( 'Abandoned Plugins', 'mainwp' ),
281 297 'parent_key' => 'PluginsManage',
282 - 'href' => 'admin.php?page=UpdatesManage&tab=abandoned-plugins',
283 - 'slug' => 'PluginsManage&tab=abandoned-plugins',
298 + 'href' => 'admin.php?page=PluginsAbandoned',
299 + 'slug' => 'PluginsAbandoned',
284 300 'right' => '',
285 301 'leftsub_order_level2' => 4.1,
286 302 ),
287 303 array(
@@ -328,9 +344,9 @@
328 344 'href' => 'admin.php?page=PluginsManage',
329 345 'active' => ( 'Manage' === $shownPage ) ? true : false,
330 346 );
331 347
332 - if ( mainwp_current_user_have_right( 'dashboard', 'install_plugins' ) && ! MainWP_Menu::is_disable_menu_item( 3, 'PluginsInstall' ) ) {
348 + if ( \mainwp_current_user_can( 'dashboard', 'install_plugins' ) && ! MainWP_Menu::is_disable_menu_item( 3, 'PluginsInstall' ) ) {
333 349 $renderItems[] = array(
334 350 'title' => esc_html__( 'Install', 'mainwp' ),
335 351 'href' => 'admin.php?page=PluginsInstall',
336 352 'active' => ( 'Install' === $shownPage ) ? true : false,
@@ -422,9 +438,9 @@
422 438 <div class="mainwp-main-content">
423 439 <div class="ui mini form mainwp-actions-bar">
424 440 <div class="ui stackable grid">
425 441 <div class="ui two column row">
426 - <div class="column" >
442 + <div class="middle aligned column">
427 443 <span id="mainwp-plugins-bulk-actions-wapper" style="margin-right:1rem">
428 444 <?php
429 445 if ( is_array( $cachedResult ) && isset( $cachedResult['bulk_actions'] ) ) {
430 446 echo $cachedResult['bulk_actions']; // phpcs:ignore WordPress.Security.EscapeOutput
@@ -442,11 +458,11 @@
442 458 */
443 459 do_action( 'mainwp_plugins_actions_bar_left' );
444 460 ?>
445 461 </div>
446 - <div class="right aligned column">
462 + <div class="right aligned middle aligned column">
447 463 <?php static::render_select_manage_view(); ?>
448 -
464 +
449 465 <?php
450 466 /**
451 467 * Action: mainwp_plugins_actions_bar_right
452 468 *
@@ -459,21 +475,27 @@
459 475 </div>
460 476 </div>
461 477 </div>
462 478 </div>
463 - <div class="ui segment" id="mainwp-plugins-table-wrapper">
479 + <div class="ui padded segment" id="mainwp-plugins-table-wrapper">
464 480 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-manage-plugins-info-message' ) ) : ?>
465 481 <div class="ui info message">
466 482 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-manage-plugins-info-message"></i>
483 + <div class="header"><?php esc_html_e( 'How to Manage Plugins', 'mainwp' ); ?></div>
467 484 <div><?php echo esc_html__( 'Manage installed plugins on your child sites. Here you can activate, deactivate, and delete installed plugins.', 'mainwp' ); ?></div>
468 - <p><?php echo esc_html__( 'To Activate or Delete a specific plugin, you must search only for Inactive plugin on your child sites. If you search for Active or both Active and Inactive, the Activate and Delete actions will be disabled.', 'mainwp' ); ?></p>
469 - <p><?php echo esc_html__( 'To Deactivate a specific plugin, you must search only for Active plugins on your child sites. If you search for Inactive or both Active and Inactive, the Deactivate action will be disabled.', 'mainwp' ); ?></p>
470 - <p><?php printf( esc_html__( 'For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/managing-plugins-with-mainwp/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></p>
485 + <div class="ui bulleted list">
486 + <div class="item"><?php echo esc_html__( 'To Activate or Delete a specific plugin, you must search only for Inactive plugin on your child sites. If you search for Active or both Active and Inactive, the Activate and Delete actions will be disabled.', 'mainwp' ); ?></div>
487 + <div class="item"><?php echo esc_html__( 'To Deactivate a specific plugin, you must search only for Active plugins on your child sites. If you search for Inactive or both Active and Inactive, the Deactivate action will be disabled.', 'mainwp' ); ?></div>
488 + </div>
489 + <div><?php
490 + // translators: 1: Opening anchor tag. 2: Closing anchor tag.
491 + printf( esc_html__( 'For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp" target="_blank">', '</a> <i class="external alternate icon"></i>' );
492 + ?></div>
471 493 </div>
472 494 <?php endif; ?>
473 495 <div id="mainwp-message-zone" class="ui message" style="display:none"></div>
474 - <div id="mainwp-loading-plugins-row" class="ui active inverted dimmer" style="display:none">
475 - <div class="ui large text loader"><?php esc_html_e( 'Loading Plugins...', 'mainwp' ); ?></div>
496 + <div id="mainwp-loading-plugins-row" class="ui active page dimmer" style="display:none">
497 + <div class="ui text double loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div>
476 498 </div>
477 499 <div id="mainwp-plugins-main-content" <?php echo ( null !== $cachedSearch ) ? 'style="display: block;"' : ''; ?> >
478 500 <div id="mainwp-plugins-content">
479 501 <?php if ( is_array( $cachedResult ) && isset( $cachedResult['result'] ) ) : ?>
@@ -478,12 +500,9 @@
478 500 <div id="mainwp-plugins-content">
479 501 <?php if ( is_array( $cachedResult ) && isset( $cachedResult['result'] ) ) : ?>
480 502 <?php echo $cachedResult['result']; // phpcs:ignore WordPress.Security.EscapeOutput ?>
481 503 <?php else : ?>
482 - <div class="ui hidden divider"></div>
483 - <div class="ui hidden divider"></div>
484 - <div class="ui hidden divider"></div>
485 - <?php MainWP_UI::render_empty_element_placeholder( __( 'Use the search options to find the plugin you want to manage', 'mainwp' ) ); ?>
504 + <?php MainWP_UI::render_empty_page_placeholder( __( 'No plugins loaded yet.', 'mainwp' ), __( 'Select one or more Child Sites and click the Show Plugins button to view installed plugins.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' ); ?>
486 505 <?php endif; ?>
487 506 </div>
488 507 </div>
489 508 </div>
@@ -549,12 +568,9 @@
549 568 * @since 4.1
550 569 */
551 570 do_action( 'mainwp_manage_plugins_before_search_options' );
552 571 ?>
553 - <div class="ui info message">
554 - <i class="close icon mainwp-notice-dismiss" notice-id="plugins-manage-info"></i>
555 - <?php esc_html_e( 'A plugin needs to be Inactive for it to be Activated or Deleted.', 'mainwp' ); ?>
556 - </div>
572 +
557 573 <div class="ui mini form">
558 574 <div class="field">
559 575 <select class="ui fluid dropdown" id="mainwp_plugins_search_by_status">
560 576 <option value=""><?php esc_html_e( 'Select status', 'mainwp' ); ?></option>
@@ -615,8 +631,15 @@
615 631 ?>
616 632 </div>
617 633 <div style="clear:both"></div>
618 634 </div>
635 + <script type="text/javascript">
636 + jQuery( document ).ready( function ($) {
637 + if($('#mainwp-plugins-content .mainwp-manage-plugins-reload-data').length){
638 + mainwp_fetch_plugins();
639 + }
640 + } );
641 + </script>
619 642 <?php
620 643 static::render_footer( 'Manage' );
621 644 }
622 645
@@ -644,9 +667,9 @@
644 667 </div>
645 668 </div>
646 669 <div class="ui hidden fitted divider"></div>
647 670 <div class="field">
648 - <div class="ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Display sites not meeting the above search criteria.', 'mainwp' ); ?>" data-position="left center" data-inverted="">
671 + <div class="ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Display sites not meeting the above search criteria.', 'mainwp' ); ?>" data-position="center left" data-inverted="">
649 672 <input type="checkbox" <?php echo $disabledNegative ? 'disabled' : ''; ?> <?php echo $checkedNegative ? 'checked="true"' : ''; ?> value="1" id="display_sites_not_meeting_criteria" />
650 673 <label for="display_sites_not_meeting_criteria"><?php esc_html_e( 'Exclude plugin', 'mainwp' ); ?></label>
651 674 </div>
652 675 </div>
@@ -690,8 +713,9 @@
690 713 * @param mixed $groups Selected Child Site Groups.
691 714 * @param mixed $sites Selected individual Child Sites.
692 715 * @param mixed $not_criteria Show not criteria result.
693 716 * @param mixed $clients Selected Clients.
717 + * @param bool $not_fetchdata True|False fetch data or not.
694 718 *
695 719 * @return string Plugin Table.
696 720 *
697 721 * @uses MainWP_Cache::init_cache()
@@ -715,9 +739,9 @@
715 739 * @uses \MainWP\Dashboard\MainWP_Plugins_Handler::get_class_name()
716 740 * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit()
717 741 * @uses \MainWP\Dashboard\MainWP_Utility::map_site()
718 742 */
719 - public static function render_table( $keyword, $status, $groups, $sites, $not_criteria, $clients ) { // phpcs:ignore -- NOSONAR -Current complexity required to achieve desired results. Pull request solutions appreciated.
743 + public static function render_table( $keyword, $status, $groups, $sites, $not_criteria, $clients, $not_fetchdata = false ) { // phpcs:ignore -- NOSONAR -Current complexity required to achieve desired results. Pull request solutions appreciated.
720 744 $keyword = trim( $keyword );
721 745 MainWP_Cache::init_cache( 'Plugins' );
722 746
723 747 $output = new \stdClass();
@@ -730,64 +754,129 @@
730 754
731 755 $data_fields = MainWP_System_Utility::get_default_map_site_fields();
732 756 $data_fields[] = 'plugins';
733 757 $data_fields[] = 'rollback_updates_data';
758 + $data_fields[] = 'site_info';
734 759
735 - if ( 1 === (int) get_option( 'mainwp_optimize', 1 ) || MainWP_Demo_Handle::is_demo_mode() ) {
760 + if ( ! $not_fetchdata ) {
736 761
737 - $multi_kws = explode( ',', $keyword );
738 - $multi_kws = array_filter( array_map( 'trim', $multi_kws ) );
762 + if ( 1 === (int) get_option( 'mainwp_optimize', 1 ) || MainWP_Demo_Handle::is_demo_mode() ) {
739 763
740 - if ( ! empty( $sites ) ) {
741 - foreach ( $sites as $v ) {
742 - if ( MainWP_Utility::ctype_digit( $v ) ) {
743 - $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data' ) );
744 - $allPlugins = json_decode( $website->plugins, true );
745 - $_count = count( $allPlugins );
746 - $_count_installed = 0;
747 - for ( $i = 0; $i < $_count; $i++ ) {
748 - $plugin = $allPlugins[ $i ];
749 - $is_active = 'active' === $status ? 1 : 0;
750 - if ( ( 'active' === $status || 'inactive' === $status ) && $is_active !== (int) $plugin['active'] ) {
751 - continue;
752 - }
764 + $multi_kws = explode( ',', $keyword );
765 + $multi_kws = array_filter( array_map( 'trim', $multi_kws ) );
753 766
754 - if ( ! empty( $keyword ) ) {
755 - if ( $not_criteria ) {
756 - if ( MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
767 + if ( ! empty( $sites ) ) {
768 + foreach ( $sites as $v ) {
769 + if ( MainWP_Utility::ctype_digit( $v ) ) {
770 + $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data', 'site_info' ) );
771 + $allPlugins = json_decode( $website->plugins, true );
772 + $_count = count( $allPlugins );
773 + $_count_installed = 0;
774 + for ( $i = 0; $i < $_count; $i++ ) {
775 + $plugin = $allPlugins[ $i ];
776 + $is_active = 'active' === $status ? 1 : 0;
777 + if ( ( 'active' === $status || 'inactive' === $status ) && $is_active !== (int) $plugin['active'] ) {
778 + continue;
779 + }
780 +
781 + if ( ! empty( $keyword ) ) {
782 + if ( $not_criteria ) {
783 + if ( MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
784 + continue;
785 + }
786 + } elseif ( ! MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
757 787 continue;
758 788 }
759 - } elseif ( ! MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
760 - continue;
761 789 }
790 +
791 + $plugin['websiteid'] = $website->id;
792 + $plugin['websiteurl'] = $website->url;
793 + $plugin['websitename'] = $website->name;
794 + $plugin['site_info'] = $website->site_info;
795 +
796 + $output->plugins[] = $plugin;
797 + ++$_count_installed;
762 798 }
763 799
764 - $plugin['websiteid'] = $website->id;
765 - $plugin['websiteurl'] = $website->url;
766 - $plugin['websitename'] = $website->name;
767 - $output->plugins[] = $plugin;
768 - ++$_count_installed;
800 + if ( 0 === $_count_installed && 'not_installed' === $status ) {
801 + for ( $i = 0; $i < $_count; $i++ ) {
802 + $plugin = $allPlugins[ $i ];
803 + $plugin['websiteid'] = $website->id;
804 + $plugin['websiteurl'] = $website->url;
805 + $plugin['websitename'] = $website->name;
806 + $plugin['site_info'] = $website->site_info;
807 + $output->plugins_installed[] = $plugin;
808 + }
809 + }
810 + $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'plugin', $website->rollback_updates_data );
769 811 }
812 + }
813 + }
770 814
771 - if ( 0 === $_count_installed && 'not_installed' === $status ) {
772 - for ( $i = 0; $i < $_count; $i++ ) {
773 - $plugin = $allPlugins[ $i ];
774 - $plugin['websiteid'] = $website->id;
775 - $plugin['websiteurl'] = $website->url;
776 - $plugin['websitename'] = $website->name;
777 - $output->plugins_installed[] = $plugin;
815 + if ( '' !== $groups ) {
816 + foreach ( $groups as $v ) {
817 + if ( MainWP_Utility::ctype_digit( $v ) ) {
818 + $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_by_group_id( $v, false, 'wp.url', false, false, null, null, array( 'extra_view' => array( 'site_info', 'rollback_updates_data' ) ) ) );
819 + while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
820 + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
821 + continue;
822 + }
823 + $allPlugins = json_decode( $website->plugins, true );
824 + $_count = count( $allPlugins );
825 + $_count_installed = 0;
826 + for ( $i = 0; $i < $_count; $i++ ) {
827 + $plugin = $allPlugins[ $i ];
828 + $is_active = 'active' === $status ? 1 : 0;
829 + if ( ( 'active' === $status || 'inactive' === $status ) && $is_active !== (int) $plugin['active'] ) {
830 + continue;
831 + }
832 +
833 + if ( ! empty( $keyword ) ) {
834 + if ( $not_criteria ) {
835 + if ( MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
836 + continue;
837 + }
838 + } elseif ( ! MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
839 + continue;
840 + }
841 + }
842 +
843 + $plugin['websiteid'] = $website->id;
844 + $plugin['websiteurl'] = $website->url;
845 + $plugin['websitename'] = $website->name;
846 + $plugin['site_info'] = $website->site_info;
847 +
848 + $output->plugins[] = $plugin;
849 + ++$_count_installed;
850 + }
851 +
852 + if ( 0 === $_count_installed && 'not_installed' === $status ) {
853 + for ( $i = 0; $i < $_count; $i++ ) {
854 + $plugin = $allPlugins[ $i ];
855 + $plugin['websiteid'] = $website->id;
856 + $plugin['websiteurl'] = $website->url;
857 + $plugin['websitename'] = $website->name;
858 + $plugin['site_info'] = $website->site_info;
859 + $output->plugins_installed[] = $plugin;
860 + }
861 + }
862 + $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'plugin', $website->rollback_updates_data );
778 863 }
864 + MainWP_DB::free_result( $websites );
779 865 }
780 - $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'plugin', $website->rollback_updates_data );
781 866 }
782 867 }
783 - }
784 868
785 - if ( '' !== $groups ) {
786 - foreach ( $groups as $v ) {
787 - if ( MainWP_Utility::ctype_digit( $v ) ) {
788 - $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_by_group_id( $v, false, 'wp.url', false, false, null, null, array( 'extra_view' => array( 'site_info', 'rollback_updates_data' ) ) ) );
789 - while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
869 + if ( '' !== $clients && is_array( $clients ) ) {
870 + $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids(
871 + $clients,
872 + array(
873 + 'select_data' => $data_fields,
874 + 'extra_view' => array( 'rollback_updates_data', 'site_info' ),
875 + )
876 + );
877 + if ( $websites ) {
878 + foreach ( $websites as $website ) {
790 879 if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
791 880 continue;
792 881 }
793 882 $allPlugins = json_decode( $website->plugins, true );
@@ -793,11 +882,13 @@
793 882 $allPlugins = json_decode( $website->plugins, true );
794 883 $_count = count( $allPlugins );
795 884 $_count_installed = 0;
796 885 for ( $i = 0; $i < $_count; $i++ ) {
797 - $plugin = $allPlugins[ $i ];
798 - $is_active = 'active' === $status ? 1 : 0;
799 - if ( ( 'active' === $status || 'inactive' === $status ) && $is_active !== (int) $plugin['active'] ) {
886 + $plugin = $allPlugins[ $i ];
887 +
888 + $is_active = ( 'active' === $status ) ? 1 : 0;
889 +
890 + if ( ( ( 'active' === $status ) || ( 'inactive' === $status ) ) && ( $is_active !== (int) $plugin['active'] ) ) {
800 891 continue;
801 892 }
802 893
803 894 if ( ! empty( $keyword ) ) {
@@ -812,12 +903,12 @@
812 903
813 904 $plugin['websiteid'] = $website->id;
814 905 $plugin['websiteurl'] = $website->url;
815 906 $plugin['websitename'] = $website->name;
907 + $plugin['site_info'] = $website->site_info;
816 908 $output->plugins[] = $plugin;
817 909 ++$_count_installed;
818 910 }
819 -
820 911 if ( 0 === $_count_installed && 'not_installed' === $status ) {
821 912 for ( $i = 0; $i < $_count; $i++ ) {
822 913 $plugin = $allPlugins[ $i ];
823 914 $plugin['websiteid'] = $website->id;
@@ -822,97 +913,64 @@
822 913 $plugin = $allPlugins[ $i ];
823 914 $plugin['websiteid'] = $website->id;
824 915 $plugin['websiteurl'] = $website->url;
825 916 $plugin['websitename'] = $website->name;
917 + $plugin['site_info'] = $website->site_info;
826 918 $output->plugins_installed[] = $plugin;
827 919 }
828 920 }
829 921 $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'plugin', $website->rollback_updates_data );
830 922 }
831 - MainWP_DB::free_result( $websites );
832 923 }
833 924 }
834 - }
925 + } else {
926 + $dbwebsites = array();
835 927
836 - if ( '' !== $clients && is_array( $clients ) ) {
837 - $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids(
838 - $clients,
839 - array(
840 - 'select_data' => $data_fields,
841 - 'extra_view' => array( 'rollback_updates_data' ),
842 - )
843 - );
844 - if ( $websites ) {
845 - foreach ( $websites as $website ) {
846 - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
847 - continue;
848 - }
849 - $allPlugins = json_decode( $website->plugins, true );
850 - $_count = count( $allPlugins );
851 - $_count_installed = 0;
852 - for ( $i = 0; $i < $_count; $i++ ) {
853 - $plugin = $allPlugins[ $i ];
928 + if ( '' !== $sites ) {
929 + foreach ( $sites as $v ) {
930 + if ( MainWP_Utility::ctype_digit( $v ) ) {
931 + $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data', 'site_info' ) );
854 932
855 - $is_active = ( 'active' === $status ) ? 1 : 0;
856 -
857 - if ( ( ( 'active' === $status ) || ( 'inactive' === $status ) ) && ( $is_active !== (int) $plugin['active'] ) ) {
933 + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
858 934 continue;
859 935 }
860 936
861 - if ( ! empty( $keyword ) ) {
862 - if ( $not_criteria ) {
863 - if ( MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
864 - continue;
865 - }
866 - } elseif ( ! MainWP_Utility::multi_find_keywords( $plugin['name'], $multi_kws ) ) {
867 - continue;
868 - }
869 - }
870 -
871 - $plugin['websiteid'] = $website->id;
872 - $plugin['websiteurl'] = $website->url;
873 - $plugin['websitename'] = $website->name;
874 - $output->plugins[] = $plugin;
875 - ++$_count_installed;
937 + $dbwebsites[ $website->id ] = MainWP_Utility::map_site(
938 + $website,
939 + $data_fields
940 + );
876 941 }
877 - if ( 0 === $_count_installed && 'not_installed' === $status ) {
878 - for ( $i = 0; $i < $_count; $i++ ) {
879 - $plugin = $allPlugins[ $i ];
880 - $plugin['websiteid'] = $website->id;
881 - $plugin['websiteurl'] = $website->url;
882 - $plugin['websitename'] = $website->name;
883 - $output->plugins_installed[] = $plugin;
884 - }
885 - }
886 - $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'plugin', $website->rollback_updates_data );
887 942 }
888 943 }
889 - }
890 - } else {
891 - $dbwebsites = array();
892 944
893 - if ( '' !== $sites ) {
894 - foreach ( $sites as $v ) {
895 - if ( MainWP_Utility::ctype_digit( $v ) ) {
896 - $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data' ) );
897 -
898 - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
899 - continue;
945 + if ( '' !== $groups ) {
946 + foreach ( $groups as $v ) {
947 + if ( MainWP_Utility::ctype_digit( $v ) ) {
948 + $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_by_group_id( $v, false, 'wp.url', false, false, null, null, array( 'extra_view' => array( 'site_info', 'rollback_updates_data' ) ) ) );
949 + while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
950 + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
951 + continue;
952 + }
953 + $dbwebsites[ $website->id ] = MainWP_Utility::map_site(
954 + $website,
955 + $data_fields
956 + );
957 + }
958 + MainWP_DB::free_result( $websites );
900 959 }
901 -
902 - $dbwebsites[ $website->id ] = MainWP_Utility::map_site(
903 - $website,
904 - $data_fields
905 - );
906 960 }
907 961 }
908 - }
909 962
910 - if ( '' !== $groups ) {
911 - foreach ( $groups as $v ) {
912 - if ( MainWP_Utility::ctype_digit( $v ) ) {
913 - $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_by_group_id( $v, false, 'wp.url', false, false, null, null, array( 'extra_view' => array( 'site_info', 'rollback_updates_data' ) ) ) );
914 - while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
963 + if ( '' !== $clients && is_array( $clients ) ) {
964 + $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids(
965 + $clients,
966 + array(
967 + 'select_data' => $data_fields,
968 + 'extra_view' => array( 'rollback_updates_data', 'site_info' ),
969 + )
970 + );
971 + if ( $websites ) {
972 + foreach ( $websites as $website ) {
915 973 if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
916 974 continue;
917 975 }
918 976 $dbwebsites[ $website->id ] = MainWP_Utility::map_site(
@@ -919,59 +977,37 @@
919 977 $website,
920 978 $data_fields
921 979 );
922 980 }
923 - MainWP_DB::free_result( $websites );
924 981 }
925 982 }
926 - }
927 983
928 - if ( '' !== $clients && is_array( $clients ) ) {
929 - $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids(
930 - $clients,
931 - array(
932 - 'select_data' => $data_fields,
933 - 'extra_view' => array( 'rollback_updates_data' ),
934 - )
984 + $post_data = array(
985 + 'keyword' => $keyword,
935 986 );
936 - if ( $websites ) {
937 - foreach ( $websites as $website ) {
938 - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
939 - continue;
940 - }
941 - $dbwebsites[ $website->id ] = MainWP_Utility::map_site(
942 - $website,
943 - $data_fields
944 - );
945 - }
987 +
988 + if ( 'active' === $status || 'inactive' === $status ) {
989 + $post_data['status'] = $status;
990 + $post_data['filter'] = true;
991 + } else {
992 + $post_data['status'] = '';
993 + $post_data['filter'] = false;
946 994 }
947 - }
948 995
949 - $post_data = array(
950 - 'keyword' => $keyword,
951 - );
996 + if ( 'not_installed' === $status ) {
997 + $post_data['not_installed'] = true;
998 + }
952 999
953 - if ( 'active' === $status || 'inactive' === $status ) {
954 - $post_data['status'] = $status;
955 - $post_data['filter'] = true;
956 - } else {
957 - $post_data['status'] = '';
958 - $post_data['filter'] = false;
959 - }
960 -
961 - if ( 'not_installed' === $status ) {
962 - $post_data['not_installed'] = true;
963 - }
964 -
965 - $post_data['not_criteria'] = $not_criteria ? true : false;
966 - MainWP_Connect::fetch_urls_authed( $dbwebsites, 'get_all_plugins', $post_data, array( MainWP_Plugins_Handler::get_class_name(), 'plugins_search_handler' ), $output );
967 - // phpcs:disable WordPress.Security.EscapeOutput
968 - if ( ! empty( $output->errors ) ) {
969 - foreach ( $output->errors as $siteid => $error ) {
970 - $error_results .= MainWP_Utility::get_nice_url( $dbwebsites[ $siteid ]->url ) . ': ' . $error . ' <br/>';
1000 + $post_data['not_criteria'] = $not_criteria ? true : false;
1001 + MainWP_Connect::fetch_urls_authed( $dbwebsites, 'get_all_plugins', $post_data, array( MainWP_Plugins_Handler::get_class_name(), 'plugins_search_handler' ), $output );
1002 + // phpcs:disable WordPress.Security.EscapeOutput
1003 + if ( ! empty( $output->errors ) ) {
1004 + foreach ( $output->errors as $siteid => $error ) {
1005 + $error_results .= MainWP_Utility::get_nice_url( $dbwebsites[ $siteid ]->url ) . ': ' . $error . ' <br/>';
1006 + }
971 1007 }
1008 + // phpcs:enable
972 1009 }
973 - // phpcs:enable
974 1010 }
975 1011
976 1012 MainWP_Cache::add_context(
977 1013 'Plugins',
@@ -1003,9 +1039,9 @@
1003 1039
1004 1040 if ( 'not_installed' === $status ) {
1005 1041 if ( empty( $output->plugins_installed ) ) {
1006 1042 ?>
1007 - <div class="ui message yellow"><?php esc_html_e( 'No websites found.', 'mainwp' ); ?></div>
1043 + <div class="ui message yellow <?php echo $not_fetchdata ? 'mainwp-manage-plugins-reload-data' : ''; ?>"><?php esc_html_e( 'No websites found.', 'mainwp' ); ?></div>
1008 1044 <?php
1009 1045 } else {
1010 1046 $plugins_list = $output->plugins_installed;
1011 1047 $roll_items_list = ! empty( $output->roll_items ) ? $output->roll_items : array();
@@ -1012,9 +1048,9 @@
1012 1048 $view_mode = MAINWP_VIEW_PER_SITE;
1013 1049 }
1014 1050 } elseif ( empty( $output->plugins ) ) {
1015 1051 ?>
1016 - <div class="ui message yellow"><?php esc_html_e( 'No plugins found.', 'mainwp' ); ?></div>
1052 + <div class="ui message yellow <?php echo $not_fetchdata ? 'mainwp-manage-plugins-reload-data' : ''; ?>"><?php esc_html_e( 'No plugins found.', 'mainwp' ); ?></div>
1017 1053 <?php
1018 1054 } else {
1019 1055 $plugins_list = $output->plugins;
1020 1056 $roll_items_list = ! empty( $output->roll_items ) ? $output->roll_items : array();
@@ -1030,8 +1066,9 @@
1030 1066 $muPlugins = array();
1031 1067 $pluginsName = array();
1032 1068 $pluginsMainWP = array();
1033 1069 $pluginsRealVersion = array();
1070 + $pluginsSlug = array();
1034 1071
1035 1072 if ( ! empty( $plugins_list ) ) {
1036 1073
1037 1074 foreach ( $plugins_list as $plugin ) {
@@ -1038,8 +1075,9 @@
1038 1075 $slug_ver = esc_html( $plugin['slug'] . '_' . $plugin['version'] );
1039 1076 $sites[ $plugin['websiteid'] ] = array(
1040 1077 'websiteurl' => esc_html( $plugin['websiteurl'] ),
1041 1078 'websitename' => $plugin['websitename'],
1079 + 'site_info' => $plugin['site_info'],
1042 1080 );
1043 1081
1044 1082 $pluginsSlug[ $slug_ver ] = isset( $plugin['slug'] ) ? $plugin['slug'] : '';
1045 1083 $muPlugins[ $slug_ver ] = isset( $plugin['mu'] ) ? esc_html( $plugin['mu'] ) : 0;
@@ -1065,8 +1103,9 @@
1065 1103 static::render_manage_per_site_table( $sites, $pluginsSlug, $sitePlugins, $pluginsMainWP, $muPlugins, $pluginsName, $pluginsNameSites, $pluginsRealVersion, $roll_items_list );
1066 1104 }
1067 1105 MainWP_Updates::render_plugin_details_modal();
1068 1106 MainWP_UI::render_modal_upload_icon();
1107 + MainWP_Updates::render_changes_history_modal();
1069 1108 }
1070 1109
1071 1110 $newOutput = ob_get_clean();
1072 1111 $result = array(
@@ -1088,48 +1127,49 @@
1088 1127 */
1089 1128 public static function render_bulk_actions( $status ) {
1090 1129 ob_start();
1091 1130 ?>
1092 - <select class="ui dropdown" id="mainwp-bulk-actions">
1093 - <option value="none"><?php esc_html_e( 'Bulk Actions', 'mainwp' ); ?></option>
1094 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
1131 + <select class="ui compact dropdown" id="mainwp-bulk-actions">
1132 + <option value="none"><?php esc_html_e( 'Bulk actions', 'mainwp' ); ?></option>
1133 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
1095 1134 <option value="ignore_updates" data-value="ignore_updates"><?php esc_html_e( 'Ignore updates', 'mainwp' ); ?></option>
1096 1135 <?php endif; ?>
1097 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_plugins' ) ) : ?>
1136 + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) : ?>
1098 1137 <?php if ( 'active' === $status ) : ?>
1099 - <option value="deactivate" data-value="deactivate"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></option>
1138 + <option value="deactivate" data-value="deactivate"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></option>
1100 1139 <?php else : ?>
1101 - <option value="deactivate" disabled data-value="deactivate"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></option>
1140 + <option value="deactivate" disabled data-value="deactivate"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?><br/><span class="ui small text"><?php esc_html_e( 'To deactivate, view Active plugins.', 'mainwp' ); ?></span></option>
1141 + <?php endif; ?>
1102 1142 <?php endif; ?>
1103 - <?php endif; ?>
1104 1143 <?php if ( 'inactive' === $status ) : ?>
1105 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_plugins' ) ) : ?>
1144 + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) : ?>
1106 1145 <option value="activate" data-value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?></option>
1107 - <?php endif; ?>
1108 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_plugins' ) ) : ?>
1146 + <?php endif; ?>
1147 + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_plugins' ) ) : ?>
1109 1148 <option value="delete" data-value="delete"><?php esc_html_e( 'Delete', 'mainwp' ); ?></option>
1110 - <?php endif; ?>
1149 + <?php endif; ?>
1111 1150 <?php else : ?>
1112 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_plugins' ) ) : ?>
1113 - <option value="activate" disabled data-value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?></option>
1151 + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) : ?>
1152 + <option value="activate" disabled data-value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?><br/><span class="ui small text"><?php esc_html_e( 'To activate, view Inactive plugins.', 'mainwp' ); ?></span></option>
1114 1153 <?php endif; ?>
1115 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_plugins' ) ) : ?>
1116 - <option value="delete" disabled data-value="delete"><?php esc_html_e( 'Delete', 'mainwp' ); ?></option>
1117 - <?php endif; ?>
1118 - <?php endif; ?>
1119 - <?php
1120 - /**
1121 - * Action: mainwp_plugins_bulk_action
1122 - *
1123 - * Adds a new action to the Manage Plugins bulk actions menu.
1124 - *
1125 - * @param string $status Status search parameter.
1126 - *
1127 - * @since 4.1
1128 - */
1129 - do_action( 'mainwp_plugins_bulk_action' );
1130 - ?>
1154 + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_plugins' ) ) : ?>
1155 + <option value="delete" data-value="delete"><?php esc_html_e( 'Delete', 'mainwp' ); ?></option>
1156 + <?php endif; ?>
1157 + <?php endif; ?>
1158 + <?php
1159 + /**
1160 + * Action: mainwp_plugins_bulk_action
1161 + *
1162 + * Adds a new action to the Manage Plugins bulk actions menu.
1163 + *
1164 + * @param string $status Status search parameter.
1165 + *
1166 + * @since 4.1
1167 + */
1168 + do_action( 'mainwp_plugins_bulk_action' );
1169 + ?>
1131 1170 </select>
1171 +
1132 1172 <button class="ui mini basic button" href="javascript:void(0)" id="mainwp-do-plugins-bulk-actions"><?php esc_html_e( 'Apply', 'mainwp' ); ?></button>
1133 1173 <span id="mainwp_bulk_action_loading"><i class="ui active inline loader tiny"></i></span>
1134 1174 <?php
1135 1175 return ob_get_clean();
@@ -1169,15 +1209,25 @@
1169 1209
1170 1210 if ( ! $hide_show_updates_per ) {
1171 1211 ?>
1172 1212 <form method="post" action="" class="ui mini form right aligned">
1173 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
1213 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
1174 1214 <input type="hidden" name="whichview" value="<?php echo esc_attr( $which ); ?>" />
1175 - <div class="inline field">
1176 - <select class="ui dropdown" onchange="mainwp_siteview_onchange(this)" name="select_mainwp_options_plugintheme_view">
1177 - <option value="0" class="item" <?php echo MAINWP_VIEW_PER_PLUGIN_THEME === (int) $view_mode ? 'selected' : ''; ?>><?php echo esc_html( 'plugin' === $which ? esc_html__( 'Show Plugins per Item', 'mainwp' ) : esc_html__( 'Show Themes per Item', 'mainwp' ) ); ?></option>
1178 - <option value="1" class="item" <?php echo MAINWP_VIEW_PER_SITE === (int) $view_mode ? 'selected' : ''; ?>><?php echo esc_html( 'plugin' === $which ? esc_html__( 'Show Plugins per Site', 'mainwp' ) : esc_html__( 'Show Themes per Site', 'mainwp' ) ); ?></option>
1179 - </select>
1215 + <div class="ui mini stackable buttons">
1216 + <button
1217 + type="submit"
1218 + name="select_mainwp_options_plugintheme_view"
1219 + value="0"
1220 + class="ui basic <?php echo esc_attr( MAINWP_VIEW_PER_PLUGIN_THEME === (int) $view_mode ? 'green' : '' ); ?> button">
1221 + <?php echo esc_html( 'plugin' === $which ? esc_html__( 'Show Plugins per Item', 'mainwp' ) : esc_html__( 'Show Themes per Item', 'mainwp' ) ); ?>
1222 + </button>
1223 + <button
1224 + type="submit"
1225 + name="select_mainwp_options_plugintheme_view"
1226 + value="1"
1227 + class="ui basic <?php echo esc_attr( MAINWP_VIEW_PER_SITE === (int) $view_mode ? 'green' : '' ); ?> button">
1228 + <?php echo esc_html( 'plugin' === $which ? esc_html__( 'Show Plugins per Site', 'mainwp' ) : esc_html__( 'Show Themes per Site', 'mainwp' ) ); ?>
1229 + </button>
1180 1230 </div>
1181 1231 </form>
1182 1232 <?php
1183 1233 }
@@ -1214,9 +1264,9 @@
1214 1264
1215 1265 foreach ( $sites as $site_id => $info ) {
1216 1266
1217 1267 $plugin_upgrades = array();
1218 - $website = MainWP_DB::instance()->get_website_by_id( $site_id, false, array( 'rollback_updates_data' ) );
1268 + $website = MainWP_DB::instance()->get_website_by_id( $site_id, false, array( 'rollback_updates_data', 'site_info' ) );
1219 1269
1220 1270 if ( $website && ! $website->is_ignorePluginUpdates ) {
1221 1271 $plugin_upgrades = json_decode( $website->plugin_upgrades, true );
1222 1272 $decodedPremiumUpgrades = MainWP_DB::instance()->get_website_option( $website, 'premium_upgrades' );
@@ -1233,9 +1283,9 @@
1233 1283
1234 1284 $premiumUpgrade = array_filter( $premiumUpgrade );
1235 1285
1236 1286 if ( ! isset( $plugin_upgrades[ $crrSlug ] ) ) {
1237 - $plugin_upgrades[ $crrSlug ] = array();
1287 + continue;
1238 1288 }
1239 1289 $plugin_upgrades[ $crrSlug ] = array_merge( $plugin_upgrades[ $crrSlug ], $premiumUpgrade );
1240 1290 }
1241 1291 }
@@ -1241,13 +1291,14 @@
1241 1291 }
1242 1292 }
1243 1293 $ignored_plugins = json_decode( $website->ignored_plugins, true );
1244 1294 if ( is_array( $ignored_plugins ) ) {
1245 - $plugin_upgrades = array_diff_key( $plugin_upgrades, $ignored_plugins );
1295 + $plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $ignored_plugins );
1296 +
1246 1297 }
1247 1298
1248 1299 if ( is_array( $decodedIgnoredPlugins ) ) {
1249 - $plugin_upgrades = array_diff_key( $plugin_upgrades, $decodedIgnoredPlugins );
1300 + $plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $decodedIgnoredPlugins );
1250 1301 }
1251 1302 }
1252 1303 $updateWebsites[ $site_id ] = $plugin_upgrades;
1253 1304 }
@@ -1260,19 +1311,27 @@
1260 1311 * @since 4.1
1261 1312 */
1262 1313 do_action( 'mainwp_before_plugins_table' );
1263 1314 ?>
1315 +
1316 + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-plugins-bulk-actions-tip' ) ) : ?>
1317 + <div class="ui message">
1318 + <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-plugins-bulk-actions-tip"></i>
1319 + <div><em data-emoji=":bulb:" class="small"></em> <?php esc_html_e( 'Tip: Use Bulk Actions to activate, deactivate, or delete selected plugins.', 'mainwp' ); ?></div>
1320 + </div>
1321 + <?php endif; ?>
1322 +
1264 1323 <div class="ui secondary segment main-master-checkbox">
1265 1324 <div class="ui stackable grid">
1266 - <div class="one wide center aligned middle aligned column">
1325 + <div class="one wide left aligned middle aligned column">
1267 1326 <span class="trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></span>
1268 1327 </div>
1269 1328 <div class="one wide center aligned middle aligned column"><div class="ui checkbox main-master not-auto-init"><input type="checkbox"/><label></label></div></div>
1270 - <div class="five wide middle aligned column"><?php esc_html_e( 'Website', 'mainwp' ); ?></div>
1329 + <div class="six wide middle aligned column"><?php esc_html_e( 'Website', 'mainwp' ); ?></div>
1271 1330 <div class="two wide center aligned middle aligned column"></div>
1272 1331 <div class="two wide center aligned middle aligned column"></div>
1273 1332 <div class="two wide center aligned middle aligned column"></div>
1274 - <div class="two wide center aligned middle aligned column"><?php esc_html_e( 'Plugins', 'mainwp' ); ?></div>
1333 + <div class="two wide right aligned middle aligned column"><?php esc_html_e( 'Plugins', 'mainwp' ); ?></div>
1275 1334 </div>
1276 1335 </div>
1277 1336
1278 1337 <div class="mainwp-manage-plugins-wrapper main-child-checkbox">
@@ -1277,9 +1336,19 @@
1277 1336
1278 1337 <div class="mainwp-manage-plugins-wrapper main-child-checkbox">
1279 1338 <?php foreach ( $sites as $site_id => $website ) : ?>
1280 1339 <?php
1281 - $site_name = $website['websitename'];
1340 + $site_name = $website['websitename'];
1341 + $site_url = $website['websiteurl'];
1342 +
1343 + $wp_info = ! empty( $website['site_info'] ) ? json_decode( $website['site_info'], true ) : array();
1344 + if ( ! is_array( $wp_info ) ) {
1345 + $wp_info = array();
1346 + }
1347 + $use_tzformat = ! empty( $wp_info['format_datetime'] ) && is_array( $wp_info['format_datetime'] ) ? $wp_info['format_datetime'] : array();
1348 + $offs = ! empty( $use_tzformat['gmt_offset'] ) ? intval( $use_tzformat['gmt_offset'] ) : 0;
1349 + $offs_info = esc_html__( '- Timezone:', 'mainwp' ) . ' UTC' . ( $offs >= 0 ? '+' . $offs : $offs );
1350 +
1282 1351 $slugVersions = isset( $sitePlugins[ $site_id ] ) ? $sitePlugins[ $site_id ] : array();
1283 1352
1284 1353 if ( ! is_array( $slugVersions ) ) {
1285 1354 $slugVersions = array();
@@ -1292,9 +1361,9 @@
1292 1361 ?>
1293 1362 <div class="ui accordion mainwp-manage-plugin-accordion mainwp-manage-plugin-item main-child-checkbox" id="<?php echo esc_html( $item_id ); ?>">
1294 1363 <div class="title master-checkbox">
1295 1364 <div class="ui stackable grid">
1296 - <div class="one wide center aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div>
1365 + <div class="one wide left aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div>
1297 1366 <div class="one wide center aligned middle aligned column">
1298 1367 <div class="ui checkbox master">
1299 1368 <input type="checkbox"/>
1300 1369 <label></label>
@@ -1299,14 +1368,14 @@
1299 1368 <input type="checkbox"/>
1300 1369 <label></label>
1301 1370 </div>
1302 1371 </div>
1303 - <div class="three wide middle aligned column"><a target="_blank" href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php echo intval( $site_id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>"><i class="sign in icon"></i></a> <a href="admin.php?page=managesites&dashboard=<?php echo intval( $site_id ); ?>"><?php echo esc_html( $site_name ); ?></a></div>
1372 + <div class="four wide middle aligned column"><a target="_blank" href="<?php MainWP_Site_Open::get_open_site_admin_link( $site_id, true ); //phpcs:ignore -- ok. ?>"><i class="sign in icon"></i></a> <a href="admin.php?page=managesites&dashboard=<?php echo intval( $site_id ); ?>"><?php echo esc_html( $site_name ); ?></a></div>
1304 1373 <div class="two wide center aligned middle aligned column"></div>
1305 1374 <div class="two wide center aligned middle aligned column"></div>
1306 1375 <div class="two wide center aligned middle aligned column"></div>
1307 1376 <div class="two wide center aligned middle aligned column"></div>
1308 - <div class="two wide center aligned middle aligned column"><div class="ui label"><i class="icon plug"></i> <?php echo intval( $count_plugins ); ?></div></div>
1377 + <div class="two wide right aligned middle aligned column"><div class="ui label"><?php echo intval( $count_plugins ) . ' ' . esc_html( _n( 'Plugin', 'Plugins', intval( $count_plugins ), 'mainwp' ) ); ?></div></div>
1309 1378 </div>
1310 1379 </div>
1311 1380 <div class="content child-checkbox">
1312 1381 <?php
@@ -1337,11 +1406,11 @@
1337 1406
1338 1407 if ( isset( $sitePlugins[ $site_id ][ $slug_ver ] ) && ( empty( $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) || 1 === (int) $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) ) {
1339 1408 $actived = true;
1340 1409 if ( isset( $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) && 1 === (int) $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) {
1341 - $plugin_status = '<span class="ui small green basic label">' . esc_html__( 'Active', 'mainwp' ) . '</span>';
1410 + $plugin_status = '<span class="ui tiny grey label"><i class="circle green icon"></i> ' . esc_html__( 'Active', 'mainwp' ) . '</span>';
1342 1411 } elseif ( isset( $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) && 0 === (int) $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) {
1343 - $plugin_status = '<span class="ui small red basic label">' . esc_html__( 'Inactive', 'mainwp' ) . '</span>';
1412 + $plugin_status = '<span class="ui tiny grey label"><i class="circle red icon"></i> ' . esc_html__( 'Inactive', 'mainwp' ) . '</span>';
1344 1413 $actived = false;
1345 1414 } else {
1346 1415 $plugin_status = '';
1347 1416 }
@@ -1359,12 +1428,18 @@
1359 1428 $item_id = preg_replace( '/[[:space:]]+/', '_', $item_id );
1360 1429
1361 1430 $plugin_directory = MainWP_Utility::get_dir_slug( $plugin_slug );
1362 1431 $details_link = self_admin_url( 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $site_id ) . '&plugin=' . rawurlencode( $plugin_directory ) . '&section=changelog' );
1432 +
1433 + $el_id_ite_1 = $item_id;
1434 +
1435 + $compatible_php = isset( $plugin_upgrade['wp_compatible'] ) ? $plugin_upgrade['wp_compatible'] : true;
1436 + $compatible_wp = isset( $plugin_upgrade['php_compatible'] ) ? $plugin_upgrade['php_compatible'] : true;
1437 +
1363 1438 ?>
1364 - <div class="ui very compact stackable grid mainwp-manage-plugin-item-website" plugin-slug="<?php echo esc_attr( rawurlencode( $plugin_slug ) ); ?>" plugin-name="<?php echo esc_html( $plugin_title ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_html( $site_name ); ?>" id="<?php echo esc_html( $item_id ); ?>">
1439 + <div class="ui very compact stackable grid mainwp-manage-plugin-item-website" plugin-slug="<?php echo esc_attr( rawurlencode( $plugin_slug ) ); ?>" plugin-name="<?php echo esc_html( $plugin_title ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_attr( $site_name ); ?>" site-url="<?php echo esc_attr( $site_url ); ?>" tz-info="<?php echo esc_attr( $offs_info ); ?>" id="<?php echo esc_attr( $el_id_ite_1 ); ?>">
1365 1440 <div class="one wide center aligned middle aligned column"></div>
1366 - <div class="one wide center aligned middle aligned column">
1441 + <div class="one wide left aligned middle aligned column">
1367 1442 <div class="ui checkbox child <?php echo 'mainwp-child' === $plugin_directory ? 'disabled' : ''; ?>">
1368 1443 <input type="checkbox"
1369 1444 <?php
1370 1445 echo 'mainwp-child' === $plugin_directory ? 'disabled="disabled"' : 'class="mainwp-selected-plugin-site"';
@@ -1374,13 +1449,14 @@
1374 1449 </div>
1375 1450 <?php // phpcs:disable WordPress.Security.EscapeOutput ?>
1376 1451 <div class="one wide center aligned middle aligned column"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></div>
1377 1452 <?php // phpcs:enable ?>
1378 - <div class="three wide middle aligned column"><a class="open-plugin-details-modal" href="<?php echo esc_url( $details_link ); ?>" target="_blank" ><strong><?php echo esc_html( $plugin_title ); ?></strong></a></div>
1379 - <div class="one wide center aligned middle aligned column"><?php echo $plugin_status; //phpcs:ignore -- escaped. ?></div>
1380 - <div class="two wide center aligned middle aligned column"><?php echo $trusted ? '<span class="ui tiny basic green label">' . esc_html__( 'Trusted', 'mainwp' ) . '</span>' : '<span class="ui tiny basic grey label">' . esc_html__( 'Not Trusted', 'mainwp' ) . '</span>'; ?></div>
1453 + <div class="two wide middle aligned column"><a class="open-plugin-details-modal" href="<?php echo esc_url( $details_link ); ?>" target="_blank" ><?php echo esc_html( $plugin_title ); ?></a></div>
1454 + <div class="two wide center aligned middle aligned column"><?php echo $plugin_status; //phpcs:ignore -- escaped. ?></div>
1455 + <div class="two wide center aligned middle aligned column"><?php echo $trusted ? '<span class="ui tiny green label"><i class="locks icon"></i> ' . esc_html__( 'Trusted', 'mainwp' ) . '</span>' : '<span class="ui tiny red label"><i class="lock open icon"></i> ' . esc_html__( 'Not Trusted', 'mainwp' ) . '</span>'; ?></div>
1381 1456 <div class="one wide center aligned middle aligned column"><?php echo $plugin_mu ? '<span class="ui small label"><i class="exclamation orange triangle icon"></i> MU</span>' : ''; ?></div>
1382 - <div class="two wide center aligned middle aligned column current-version">
1457 + <div class="two wide left aligned middle aligned column current-version">
1458 + <span class="ui small text">
1383 1459 <?php echo esc_html( $plugin_version ); ?>
1384 1460 <?php if ( ! empty( $new_version ) ) : ?>
1385 1461 &rarr;
1386 1462 <?php
@@ -1389,31 +1465,46 @@
1389 1465 }
1390 1466 echo esc_html( $new_version );
1391 1467 ?>
1392 1468 <?php endif; ?>
1469 + </span>
1393 1470 </div>
1394 - <div class="two wide right aligned middle aligned column update-column" updated="0">
1471 +
1472 +
1473 +
1474 +
1475 + <div class="one wide right aligned middle aligned column update-column" updated="0">
1395 1476 <?php if ( ! empty( $upgradeInfo ) && MainWP_Updates::user_can_update_plugins() ) : ?>
1396 - <span data-position="top right" data-tooltip="<?php echo esc_attr__( 'Update ', 'mainwp' ) . esc_html( $plugin_title ) . ' ' . esc_attr__( 'plugin on this child site.', 'mainwp' ); ?>" data-inverted=""><a href="javascript:void(0)" class="ui mini green basic button <?php echo $is_demo ? 'disabled' : ''; ?>" onClick="return manage_plugins_upgrade( '<?php echo esc_js( rawurlencode( $plugin_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update Now', 'mainwp' ); ?></a></span>
1477 + <span data-position="top right" data-tooltip="<?php echo esc_attr__( 'Update ', 'mainwp' ) . esc_html( $plugin_title ) . ' ' . esc_attr__( 'plugin on this child site.', 'mainwp' ); ?>" data-inverted=""><a href="javascript:void(0)" class="ui mini green basic button <?php echo $is_demo ? 'disabled' : ''; ?>" onClick="return manage_plugins_upgrade( '<?php echo esc_js( rawurlencode( $plugin_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update', 'mainwp' ); ?></a></span>
1397 1478 <?php endif; ?>
1398 1479 </div>
1480 + <div class="one wide center aligned middle aligned column"><a href="#" history-view="manage-plugins-per-sites" data-tooltip="<?php esc_attr_e( 'View history', 'mainwp' ); ?>" data-inverted="" data-possition="center left" class="mainwp-show-history ui mini basic grey icon button"><i class="history icon"></i></a></div>
1399 1481 <div class="two wide center aligned middle aligned column column-actions">
1400 - <?php if ( ! $child_plugin ) : ?>
1401 - <?php if ( $actived ) { ?>
1402 - <?php if ( ! $plugin_mu && mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1403 - <a href="#" class="mainwp-manage-plugin-deactivate ui mini fluid button <?php echo $is_demo ? 'disabled' : ''; ?>" data-position="top right" data-tooltip="<?php echo esc_attr__( 'Deactivate ', 'mainwp' ) . esc_html( $plugin_title ) . ' ' . esc_attr__( 'plugin on this child site.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></a>
1482 + <div class="ui mini fluid buttons">
1483 +
1484 + <?php if ( ! $child_plugin ) : ?>
1485 + <?php if ( $actived ) { ?>
1486 + <?php if ( ! $plugin_mu && \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1487 + <a href="#" class="mainwp-manage-plugin-deactivate ui button" data-position="top right" data-tooltip="<?php echo esc_attr__( 'Deactivate ', 'mainwp' ) . esc_html( $plugin_title ) . ' ' . esc_attr__( 'plugin on this child site.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></a>
1488 + <?php } ?>
1489 + <?php } else { ?>
1490 + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1491 + <?php
1492 + if ( $compatible_php && $compatible_wp ) {
1493 + ?>
1494 + <a href="#" class="mainwp-manage-plugin-activate ui green button" data-position="top right" data-tooltip="<?php echo esc_attr__( 'Activate ', 'mainwp' ) . esc_html( wp_strip_all_tags( $plugin_title ) ) . ' ' . esc_attr__( 'plugin on this child site.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Activate', 'mainwp' ); ?></a>
1495 + <?php
1496 + } else {
1497 + static::render_incompatible_active( $compatible_php, $compatible_wp );
1498 + ?>
1499 + <?php } ?>
1500 + <?php } ?>
1404 1501 <?php } ?>
1405 - <?php } else { ?>
1406 - <div class="ui mini fluid buttons">
1407 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1408 - <a href="#" class="mainwp-manage-plugin-activate ui green button <?php echo $is_demo ? 'disabled' : ''; ?>" data-position="top right" data-tooltip="<?php echo esc_attr__( 'Activate ', 'mainwp' ) . esc_html( wp_strip_all_tags( $plugin_title ) ) . ' ' . esc_attr__( 'plugin on this child site.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Activate', 'mainwp' ); ?></a>
1502 + <?php if ( ! $plugin_mu && \mainwp_current_user_can( 'dashboard', 'delete_plugins' ) ) { ?>
1503 + <a href="#" class="mainwp-manage-plugin-delete ui button" data-position="top right" data-tooltip="<?php echo esc_attr__( 'Delete ', 'mainwp' ) . ' ' . esc_html( wp_strip_all_tags( $plugin_title ) ) . ' ' . esc_attr__( 'plugin from this child site.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Delete', 'mainwp' ); ?></a>
1409 1504 <?php } ?>
1410 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_plugins' ) ) { ?>
1411 - <a href="#" class="mainwp-manage-plugin-delete ui button <?php echo $is_demo ? 'disabled' : ''; ?>" data-position="top right" data-tooltip="<?php echo esc_attr__( 'Delete ', 'mainwp' ) . ' ' . esc_html( wp_strip_all_tags( $plugin_title ) ) . ' ' . esc_attr__( 'plugin from this child site.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Delete', 'mainwp' ); ?></a>
1412 - <?php } ?>
1413 - </div>
1414 - <?php } ?>
1415 - <?php endif; ?>
1505 + <?php endif; ?>
1506 + </div>
1416 1507 </div>
1417 1508 </div>
1418 1509 <?php
1419 1510
@@ -1425,13 +1516,15 @@
1425 1516 <?php endforeach; ?>
1426 1517 </div>
1427 1518
1428 1519 <script type="text/javascript">
1429 - jQuery( '.mainwp-manage-plugin-accordion' ).accordion( {
1430 - "selector": {
1431 - "trigger" : '.dropdown-trigger',
1432 - }
1433 - } );
1520 + jQuery(document).ready(function ($) {
1521 + $( '.mainwp-manage-plugin-accordion' ).accordion( {
1522 + "selector": {
1523 + "trigger" : '.dropdown-trigger',
1524 + }
1525 + } );
1526 + });
1434 1527
1435 1528 jQuery( '.trigger-all-accordion' ).on( 'click', function() { // not use document here.
1436 1529 if ( jQuery( this ).hasClass( 'active' ) ) {
1437 1530 jQuery( this ).removeClass( 'active' );
@@ -1517,9 +1610,9 @@
1517 1610 if ( 'plugin' === $premiumUpgrade['type'] ) {
1518 1611 $premiumUpgrade = array_filter( $premiumUpgrade );
1519 1612
1520 1613 if ( ! isset( $plugin_upgrades[ $crrSlug ] ) ) {
1521 - $plugin_upgrades[ $crrSlug ] = array();
1614 + continue;
1522 1615 }
1523 1616 $plugin_upgrades[ $crrSlug ] = array_merge( $plugin_upgrades[ $crrSlug ], $premiumUpgrade );
1524 1617 }
1525 1618 }
@@ -1525,13 +1618,14 @@
1525 1618 }
1526 1619 }
1527 1620 $ignored_plugins = json_decode( $website->ignored_plugins, true );
1528 1621 if ( is_array( $ignored_plugins ) ) {
1529 - $plugin_upgrades = array_diff_key( $plugin_upgrades, $ignored_plugins );
1622 + $plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $ignored_plugins );
1623 +
1530 1624 }
1531 1625
1532 1626 if ( is_array( $decodedIgnoredPlugins ) ) {
1533 - $plugin_upgrades = array_diff_key( $plugin_upgrades, $decodedIgnoredPlugins );
1627 + $plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $decodedIgnoredPlugins );
1534 1628 }
1535 1629 }
1536 1630 $updateWebsites[ $site_id ] = $plugin_upgrades;
1537 1631 }
@@ -1544,11 +1638,19 @@
1544 1638 * @since 4.1
1545 1639 */
1546 1640 do_action( 'mainwp_before_plugins_table' );
1547 1641 ?>
1642 +
1643 + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-plugins-bulk-actions-tip' ) ) : ?>
1644 + <div class="ui message">
1645 + <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-plugins-bulk-actions-tip"></i>
1646 + <div><em data-emoji=":bulb:" class="small"></em> <?php esc_html_e( 'Tip: Use Bulk Actions to activate, deactivate, or delete selected plugins.', 'mainwp' ); ?></div>
1647 + </div>
1648 + <?php endif; ?>
1649 +
1548 1650 <div class="ui secondary segment main-master-checkbox">
1549 1651 <div class="ui stackable grid">
1550 - <div class="one wide center aligned middle aligned column">
1652 + <div class="one wide left aligned middle aligned column">
1551 1653 <span class="trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></span>
1552 1654 </div>
1553 1655 <div class="one wide center aligned middle aligned column"><div class="ui checkbox main-master not-auto-init"><input type="checkbox"/><label></label></div></div>
1554 1656 <div class="one wide center aligned middle aligned column"></div>
@@ -1553,11 +1655,11 @@
1553 1655 <div class="one wide center aligned middle aligned column"><div class="ui checkbox main-master not-auto-init"><input type="checkbox"/><label></label></div></div>
1554 1656 <div class="one wide center aligned middle aligned column"></div>
1555 1657 <div class="five wide middle aligned column"><?php esc_html_e( 'Plugin', 'mainwp' ); ?></div>
1556 1658 <div class="two wide center aligned middle aligned column"></div>
1557 - <div class="two wide center aligned middle aligned column"><?php esc_html_e( 'Latest Version', 'mainwp' ); ?></div>
1659 + <div class="two wide right aligned middle aligned column"><?php esc_html_e( 'Latest Version', 'mainwp' ); ?></div>
1558 1660 <div class="two wide center aligned middle aligned column"></div>
1559 - <div class="two wide center aligned middle aligned column"><?php esc_html_e( 'Websites', 'mainwp' ); ?></div>
1661 + <div class="two wide right aligned middle aligned column"><?php esc_html_e( 'Websites', 'mainwp' ); ?></div>
1560 1662 </div>
1561 1663 </div>
1562 1664
1563 1665 <div class="mainwp-manage-plugins-wrapper main-child-checkbox">
@@ -1584,18 +1686,18 @@
1584 1686 ?>
1585 1687 <div class="ui accordion mainwp-manage-plugin-accordion mainwp-manage-plugin-item main-child-checkbox" id="<?php echo esc_html( $item_id ); ?>">
1586 1688 <div class="title master-checkbox">
1587 1689 <div class="ui grid">
1588 - <div class="one wide center aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div>
1690 + <div class="one wide left aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div>
1589 1691 <div class="one wide center aligned middle aligned column">
1590 1692 <div class="ui checkbox <?php echo 'mainwp-child' === $plugin_directory ? 'disabled' : ''; ?> master"><input type="checkbox" <?php echo 'mainwp-child' === $plugin_directory ? 'disabled="disabled"' : ''; ?>><label></label></div>
1591 1693 </div>
1592 1694 <div class="one wide center aligned middle aligned column"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); // phpcs:ignore WordPress.Security.EscapeOutput ?></div>
1593 - <div class="five wide middle aligned column"><a class="open-plugin-details-modal" href="<?php echo esc_url( $details_link ); ?>" target="_blank" ><strong><?php echo esc_html( $plugin_title ); ?></strong></a></div>
1695 + <div class="five wide middle aligned column"><a class="open-plugin-details-modal" href="<?php echo esc_url( $details_link ); ?>" target="_blank" ><?php echo esc_html( $plugin_title ); ?></a></div>
1594 1696 <div class="two wide center aligned middle aligned column"></div>
1595 - <div class="two wide center aligned middle aligned column lastest-version-info"></div>
1697 + <div class="two wide right aligned middle aligned column lastest-version-info"></div>
1596 1698 <div class="two wide center aligned middle aligned column"></div>
1597 - <div class="two wide center aligned middle aligned column"><div class="ui label"><i class="icon wordpress"></i> <?php echo intval( $count_sites ); // phpcs:ignore -- Prevent modify WP icon. ?></div></div>
1699 + <div class="two wide right aligned middle aligned column"><div class="ui label"><?php echo intval( $count_sites ) . ' ' . esc_html( _n( 'Site', 'Sites', intval( $count_sites ), 'mainwp' ) ); ?></div></div>
1598 1700 </div>
1599 1701 </div>
1600 1702 <div class="content child-checkbox">
1601 1703 <?php
@@ -1601,9 +1703,18 @@
1601 1703 <?php
1602 1704 // phpcs:enable
1603 1705 foreach ( $pluginSites as $site_id => $slugVersions ) :
1604 1706 $site_name = $sites[ $site_id ]['websitename'];
1707 + $site_url = $sites[ $site_id ]['websiteurl'];
1605 1708
1709 + $wp_info = ! empty( $sites[ $site_id ]['site_info'] ) ? json_decode( $sites[ $site_id ]['site_info'], true ) : array();
1710 + if ( ! is_array( $wp_info ) ) {
1711 + $wp_info = array();
1712 + }
1713 + $use_tzformat = ! empty( $wp_info['format_datetime'] ) && is_array( $wp_info['format_datetime'] ) ? $wp_info['format_datetime'] : array();
1714 + $offs = ! empty( $use_tzformat['gmt_offset'] ) ? intval( $use_tzformat['gmt_offset'] ) : 0;
1715 + $offs_info = esc_html__( '- Timezone:', 'mainwp' ) . ' UTC' . ( $offs >= 0 ? '+' . $offs : $offs );
1716 +
1606 1717 foreach ( $slugVersions as $slug_ver ) :
1607 1718
1608 1719 $plugin_slug = $pluginsSlug[ $slug_ver ];
1609 1720 $trusted = in_array( $plugin_slug, $trustedPlugins ) ? true : false;
@@ -1635,11 +1746,11 @@
1635 1746
1636 1747 if ( isset( $sitePlugins[ $site_id ][ $slug_ver ] ) && ( 0 === (int) $sitePlugins[ $site_id ][ $slug_ver ]['active'] || 1 === (int) $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) ) {
1637 1748 $actived = true;
1638 1749 if ( isset( $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) && 1 === (int) $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) {
1639 - $plugin_status = '<span class="ui small green basic label">' . esc_html__( 'Active', 'mainwp' ) . '</span>';
1750 + $plugin_status = '<span class="ui tiny grey label"><i class="circle green icon"></i> ' . esc_html__( 'Active', 'mainwp' ) . '</span>';
1640 1751 } elseif ( isset( $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) && 0 === (int) $sitePlugins[ $site_id ][ $slug_ver ]['active'] ) {
1641 - $plugin_status = '<span class="ui small red basic label">' . esc_html__( 'Inactive', 'mainwp' ) . '</span>';
1752 + $plugin_status = '<span class="ui tiny grey label"><i class="circle red icon"></i> ' . esc_html__( 'Inactive', 'mainwp' ) . '</span>';
1642 1753 $actived = false;
1643 1754 } else {
1644 1755 $plugin_status = '';
1645 1756 }
@@ -1653,69 +1764,87 @@
1653 1764 $item_id = $slug_ver . '_' . $site_id;
1654 1765 $item_id = strtolower( $item_id );
1655 1766 $item_id = preg_replace( '/[[:space:]]+/', '_', $item_id );
1656 1767
1768 + $el_id_ite_2 = $item_id;
1769 +
1770 + $compatible_php = isset( $upgradeInfo['wp_compatible'] ) ? $upgradeInfo['wp_compatible'] : true;
1771 + $compatible_wp = isset( $upgradeInfo['php_compatible'] ) ? $upgradeInfo['php_compatible'] : true;
1772 +
1657 1773 ?>
1658 - <div class="ui stackable grid very compact mainwp-manage-plugin-item-website" plugin-slug="<?php echo esc_attr( rawurlencode( $plugin_slug ) ); ?>" plugin-name="<?php echo esc_html( wp_strip_all_tags( $pluginsName[ $slug_ver ] ) ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_html( $site_name ); ?>" id="<?php echo esc_html( $item_id ); ?>">
1659 - <div class="one wide center aligned middle aligned column"></div>
1660 - <div class="one wide center aligned middle aligned column">
1661 - <?php if ( $child_plugin ) { ?>
1662 - <div class="ui disabled checkbox"><input type="checkbox" disabled="disabled"><label></label></div>
1663 - <?php } else { ?>
1664 - <div class="ui checkbox child">
1665 - <input type="checkbox" class="mainwp-selected-plugin-site" />
1666 - <label></label>
1667 - </div>
1668 - <?php
1774 + <div class="ui stackable grid very compact mainwp-manage-plugin-item-website" plugin-slug="<?php echo esc_attr( rawurlencode( $plugin_slug ) ); ?>" plugin-name="<?php echo esc_html( wp_strip_all_tags( $pluginsName[ $slug_ver ] ) ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_attr( $site_name ); ?>" site-url="<?php echo esc_attr( $site_url ); ?>" tz-info="<?php echo esc_attr( $offs_info ); ?>" id="<?php echo esc_html( $el_id_ite_2 ); ?>">
1775 + <div class="one wide left aligned middle aligned column"></div>
1776 + <div class="one wide center aligned middle aligned column">
1777 + <?php if ( $child_plugin ) : ?>
1778 + <div class="ui disabled checkbox"><input type="checkbox" disabled="disabled"><label></label></div>
1779 + <?php else : ?>
1780 + <div class="ui checkbox child">
1781 + <input type="checkbox" class="mainwp-selected-plugin-site" />
1782 + <label></label>
1783 + </div>
1784 + <?php endif; ?>
1785 + </div>
1786 +
1787 + <div class="two wide middle aligned column"><a target="_blank" href="<?php MainWP_Site_Open::get_open_site_admin_link( $site_id, true ); //phpcs:ignore -- ok. ?>"><i class="sign in icon"></i></a> <a href="admin.php?page=managesites&dashboard=<?php echo intval( $site_id ); ?>"><?php echo esc_html( $site_name ); ?></a></div>
1788 +
1789 + <div class="two wide center aligned middle aligned column"><?php echo $plugin_status; //phpcs:ignore -- escaped. ?></div>
1790 +
1791 + <div class="two wide center aligned middle aligned column"><?php echo $trusted ? '<span class="ui tiny green label"><i class="lock icon"></i> ' . esc_html__( 'Trusted', 'mainwp' ) . '</span>' : '<span class="ui tiny red label"><i class="lock open icon"></i> ' . esc_html__( 'Not Trusted', 'mainwp' ) . '</span>'; ?></div>
1792 +
1793 + <div class="one wide center aligned middle aligned column"><?php echo $plugin_mu ? '<span class="ui small label"><i class="exclamation orange triangle icon"></i> MU</span>' : ''; ?></div>
1794 +
1795 + <div class="two wide center aligned middle aligned column current-version">
1796 + <span class="ui small text">
1797 + <?php echo esc_html( $plugin_version ); ?>
1798 + <?php if ( ! empty( $new_version ) ) : ?>
1799 + &rarr;
1800 + <?php
1801 + if ( ! empty( $roll_list[ $site_id ][ $plugin_slug ][ $new_version ] ) ) {
1802 + echo MainWP_Updates_Helper::get_roll_msg( $roll_list[ $site_id ][ $plugin_slug ][ $new_version ], true, 'notice' ); //phpcs:ignore -- NOSONAR -- ok.
1669 1803 }
1804 + echo esc_html( $new_version );
1670 1805 ?>
1671 - </div>
1672 - <div class="three wide middle aligned column"><a target="_blank" href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php echo intval( $site_id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>"><i class="sign in icon"></i></a> <a href="admin.php?page=managesites&dashboard=<?php echo intval( $site_id ); ?>"><?php echo esc_html( $site_name ); ?></a></div>
1673 - <div class="one wide middle aligned column"></div>
1674 - <div class="one wide center aligned middle aligned column"><?php echo $plugin_status; //phpcs:ignore -- escaped. ?></div>
1675 - <div class="two wide center aligned middle aligned column"><?php echo $trusted ? '<span class="ui tiny basic green label">' . esc_html__( 'Trusted', 'mainwp' ) . '</span>' : '<span class="ui tiny basic grey label">' . esc_html__( 'Not Trusted', 'mainwp' ) . '</span>'; ?></div>
1806 + <?php endif; ?>
1807 + </span>
1808 + </div>
1676 1809
1810 + <div class="two wide right aligned middle aligned column update-column" updated="0">
1811 + <?php if ( ! empty( $upgradeInfo ) && MainWP_Updates::user_can_update_plugins() ) : ?>
1812 + <span data-position="top right" data-tooltip="<?php echo esc_attr__( 'Update ', 'mainwp' ) . esc_html( $plugin_title ) . ' ' . esc_attr__( 'plugin on this child site.', 'mainwp' ); ?>" data-inverted="" ><a href="javascript:void(0)" class="ui mini green basic button <?php echo $is_demo ? 'disabled' : ''; ?>" onClick="return manage_plugins_upgrade( '<?php echo esc_js( rawurlencode( $plugin_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update', 'mainwp' ); ?></a></span>
1813 + <?php endif; ?>
1814 + </div>
1677 1815
1678 - <div class="one wide center aligned middle aligned column"><?php echo $plugin_mu ? '<span class="ui small label"><i class="exclamation orange triangle icon"></i> MU</span>' : ''; ?></div>
1816 + <div class="one wide middle aligned center aligned column"><a href="#" history-view="manage-plugins-per-items" data-tooltip="<?php esc_attr_e( 'View history', 'mainwp' ); ?>" data-inverted="" data-possition="center left" class="mainwp-show-history ui mini icon basic grey button"><i class="history icon"></i></a></div>
1679 1817
1680 - <div class="two wide center aligned middle aligned column current-version">
1681 - <?php echo esc_html( $plugin_version ); ?>
1682 - <?php if ( ! empty( $new_version ) ) : ?>
1683 - &rarr;
1684 - <?php
1685 - if ( ! empty( $roll_list[ $site_id ][ $plugin_slug ][ $new_version ] ) ) {
1686 - echo MainWP_Updates_Helper::get_roll_msg( $roll_list[ $site_id ][ $plugin_slug ][ $new_version ], true, 'notice' ); //phpcs:ignore -- NOSONAR -- ok.
1687 - }
1688 - echo esc_html( $new_version );
1689 - ?>
1690 - <?php endif; ?>
1691 - </div>
1692 - <div class="two wide right aligned middle aligned column update-column" updated="0">
1693 - <?php if ( ! empty( $upgradeInfo ) && MainWP_Updates::user_can_update_plugins() ) : ?>
1694 - <span data-position="top right" data-tooltip="<?php echo esc_attr__( 'Update ', 'mainwp' ) . esc_html( $plugin_title ) . ' ' . esc_attr__( 'lugin on this child site.', 'mainwp' ); ?>" data-inverted="" ><a href="javascript:void(0)" class="ui mini green basic button <?php echo $is_demo ? 'disabled' : ''; ?>" onClick="return manage_plugins_upgrade( '<?php echo esc_js( rawurlencode( $plugin_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update Now', 'mainwp' ); ?></a></span>
1695 - <?php endif; ?>
1696 - </div>
1697 - <div class="two wide center aligned middle aligned column column-actions">
1818 + <div class="two wide center aligned middle aligned column column-actions">
1819 + <div class="ui mini fluid buttons">
1698 1820 <?php if ( ! $child_plugin ) : ?>
1699 1821 <?php if ( $actived ) { ?>
1700 - <?php if ( ! $plugin_mu && mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1701 - <a href="#" class="mainwp-manage-plugin-deactivate ui mini fluid button <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></a>
1822 + <?php if ( ! $plugin_mu && \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1823 + <a href="#" class="mainwp-manage-plugin-deactivate ui button <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></a>
1702 1824 <?php } ?>
1703 - <?php } else { ?>
1704 - <div class="ui mini fluid buttons">
1705 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1706 - <a href="#" class="mainwp-manage-plugin-activate ui green button <?php echo $is_demo ? 'disabled' : ''; ?>" ><?php esc_html_e( 'Activate', 'mainwp' ); ?></a>
1825 + <?php } else { ?>
1826 + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
1827 + <?php
1828 + if ( $compatible_php && $compatible_wp ) {
1829 + ?>
1830 + <a href="#" class="mainwp-manage-plugin-activate ui green button <?php echo $is_demo ? 'disabled' : ''; ?>" ><?php esc_html_e( 'Activate', 'mainwp' ); ?></a>
1831 + <?php
1832 + } else {
1833 + static::render_incompatible_active( $compatible_php, $compatible_wp );
1834 + ?>
1835 + <?php } ?>
1836 +
1837 + <?php } ?>
1707 1838 <?php } ?>
1708 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_plugins' ) ) { ?>
1709 - <a href="#" class="mainwp-manage-plugin-delete ui button <?php echo $is_demo ? 'disabled' : ''; ?>" ><?php esc_html_e( 'Delete', 'mainwp' ); ?></a>
1839 + <?php if ( ! $plugin_mu && \mainwp_current_user_can( 'dashboard', 'delete_plugins' ) ) { ?>
1840 + <a href="#" class="mainwp-manage-plugin-delete ui button <?php echo $is_demo ? 'disabled' : ''; ?>" data-position="top right" data-tooltip="<?php echo esc_attr__( 'Delete ', 'mainwp' ) . ' ' . esc_html( wp_strip_all_tags( $plugin_title ) ) . ' ' . esc_attr__( 'plugin from this child site.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Delete', 'mainwp' ); ?></a>
1710 1841 <?php } ?>
1711 - </div>
1712 - <?php } ?>
1713 - <?php endif; ?>
1842 + <?php endif; ?>
1714 1843 </div>
1715 1844 </div>
1845 + </div>
1716 1846 <?php
1717 -
1718 1847 }
1719 1848 endforeach;
1720 1849 ?>
1721 1850 <span style="display:none" class="lastest-version-hidden" lastest-version="<?php echo esc_html( $lastest_version ); ?>"></span>
@@ -1727,12 +1856,14 @@
1727 1856 <?php endforeach; ?>
1728 1857 </div>
1729 1858
1730 1859 <script type="text/javascript">
1731 - jQuery( '.mainwp-manage-plugin-accordion' ).accordion( {
1732 - "selector": {
1733 - "trigger" : '.dropdown-trigger',
1734 - }
1860 + jQuery(document).ready(function ($) {
1861 + $( '.mainwp-manage-plugin-accordion' ).accordion( {
1862 + "selector": {
1863 + "trigger" : '.dropdown-trigger',
1864 + }
1865 + } );
1735 1866 } );
1736 1867
1737 1868 jQuery( '.trigger-all-accordion' ).on( 'click', function() { // not use document here.
1738 1869 if ( jQuery( this ).hasClass( 'active' ) ) {
@@ -1776,9 +1907,31 @@
1776 1907 */
1777 1908 do_action( 'mainwp_after_plugins_table' );
1778 1909 }
1779 1910
1911 + /**
1912 + * Method render_incompatible_active().
1913 + *
1914 + * @param mixed $compatible_php Compatible php.
1915 + * @param mixed $compatible_wp Compatible wp. *
1916 + * @param mixed $echo_content Print content or not.
1917 + *
1918 + * @return string Message
1919 + */
1920 + public static function render_incompatible_active( $compatible_php, $compatible_wp, $echo_content = true ) {
1921 + $msg = MainWP_Updates_Per_Item::get_incompatible_message( $compatible_php, $compatible_wp );
1922 + if ( ! empty( $msg ) ) {
1923 + $html = '<span class="ui button basic disabled" data-tooltip="' . esc_attr( $msg ) . '" data-position="left center" data-inverted="">' . esc_html__( 'Cannot Activate', 'mainwp' ) . '</span>';
1924 + if ( $echo_content ) {
1925 + echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1926 + } else {
1927 + return $html;
1928 + }
1929 + }
1930 + return '';
1931 + }
1780 1932
1933 +
1781 1934 /** Render Install Subpage. */
1782 1935 public static function render_install() {
1783 1936 static::render_header( 'Install' );
1784 1937 static::render_plugins_table();
@@ -1801,10 +1954,10 @@
1801 1954 * @global object
1802 1955 */
1803 1956 global $tab;
1804 1957
1805 - if ( ! mainwp_current_user_have_right( 'dashboard', 'install_plugins' ) ) {
1806 - mainwp_do_not_have_permissions( esc_html__( 'install plugins', 'mainwp' ) );
1958 + if ( ! \mainwp_current_user_can( 'dashboard', 'install_plugins' ) ) {
1959 + \mainwp_do_not_have_permissions( esc_html__( 'install plugins', 'mainwp' ) );
1807 1960 return;
1808 1961 }
1809 1962 ?>
1810 1963
@@ -1810,81 +1963,94 @@
1810 1963
1811 1964 <div class="ui alt segment" id="mainwp-install-plugins">
1812 1965 <div class="mainwp-main-content">
1813 1966 <div class="mainwp-actions-bar">
1814 - <div class="ui stackable grid">
1815 - <div class="ui two column row">
1816 - <div class="column">
1817 - <div id="mainwp-search-plugins-form" class="ui fluid search focus">
1818 - <div class="ui icon fluid input">
1819 - <input id="mainwp-search-plugins-form-field" class="fluid prompt" type="text" placeholder="<?php esc_attr_e( 'Search plugins...', 'mainwp' ); ?>" value="<?php echo isset( $_GET['s'] ) ? esc_html( sanitize_text_field( wp_unslash( $_GET['s'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>">
1820 - <i class="search icon"></i>
1821 - </div>
1822 - <div class="results"></div>
1823 - </div>
1824 - <script type="text/javascript">
1825 - jQuery( document ).ready(function () {
1826 - jQuery( '#mainwp-search-plugins-form-field' ).on( 'keypress', function(e) {
1827 - let search = jQuery( '#mainwp-search-plugins-form-field' ).val();
1828 - let sel_ids = jQuery( '#plugin_install_selected_sites' ).val();
1829 - if ( '' != sel_ids )
1830 - sel_ids = '&selected_sites=' + sel_ids;
1831 - let origin = '<?php echo esc_url( get_admin_url() ); ?>';
1832 - if ( 13 === e.which ) {
1833 - location.href = origin + 'admin.php?page=PluginsInstall&tab=search&s=' + encodeURIComponent(search) + sel_ids;
1834 - }
1835 - } );
1836 - } );
1837 - </script>
1838 - <?php
1839 - /**
1840 - * Install Plugins actions bar (left)
1841 - *
1842 - * Fires at the left side of the actions bar on the Install Plugins screen, after the Search bar.
1843 - *
1844 - * @since 4.0
1845 - */
1846 - do_action( 'mainwp_install_plugins_actions_bar_left' );
1847 - ?>
1967 + <div class="ui stackable two column grid">
1968 +
1969 + <div class="middle aligned column">
1970 + <div class="ui mini stackable buttons">
1971 + <a href="#" id="MainWPInstallBulkNavSearch" class="ui basic green button mainwp-bulk-install-tabs-header-btn" ><?php esc_html_e( 'Install from WordPress.org', 'mainwp' ); ?></a>
1972 + <a href="#" id="MainWPInstallBulkNavUpload" class="ui basic button mainwp-bulk-install-tabs-header-btn" ><?php esc_html_e( 'Upload .zip file', 'mainwp' ); ?></a>
1973 + <?php do_action( 'mainwp_install_plugin_theme_tabs_header_top', 'plugin' ); ?>
1848 1974 </div>
1975 + <?php
1976 + /**
1977 + * Install Plugins actions bar (right)
1978 + *
1979 + * Fires at the left side of the actions bar on the Install Plugins screen, after the Nav buttons.
1980 + *
1981 + * @since 4.0
1982 + */
1983 + do_action( 'mainwp_install_plugins_actions_bar_right' );
1984 + ?>
1985 + </div>
1986 +
1849 1987 <div class="right aligned column">
1850 - <div class="ui buttons">
1851 - <a href="#" id="MainWPInstallBulkNavSearch" class="ui button" ><?php esc_html_e( 'Install from WordPress.org', 'mainwp' ); ?></a>
1852 - <div class="or"></div>
1853 - <a href="#" id="MainWPInstallBulkNavUpload" class="ui button" ><?php esc_html_e( 'Upload .zip file', 'mainwp' ); ?></a>
1988 + <div id="mainwp-search-plugins-form" class="ui search focus mainwp-bulk-install-showhide-content">
1989 + <div class="ui icon mini input">
1990 + <input id="mainwp-search-plugins-form-field" class="prompt" type="text" placeholder="<?php esc_attr_e( 'Search plugins...', 'mainwp' ); ?>" value="<?php echo isset( $_GET['s'] ) ? esc_html( sanitize_text_field( wp_unslash( $_GET['s'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>">
1991 + <i class="search icon"></i>
1992 + <i class="remove icon"></i>
1993 + </div>
1994 + <div class="results"></div>
1854 1995 </div>
1855 - <?php
1856 - /**
1857 - * Install Plugins actions bar (right)
1858 - *
1859 - * Fires at the left side of the actions bar on the Install Plugins screen, after the Nav buttons.
1860 - *
1861 - * @since 4.0
1862 - */
1863 - do_action( 'mainwp_install_plugins_actions_bar_right' );
1864 - ?>
1996 + <script type="text/javascript">
1997 + jQuery( document ).ready(function () {
1998 + jQuery( '#mainwp-search-plugins-form-field' ).on( 'keypress', function(e) {
1999 + let search = jQuery( '#mainwp-search-plugins-form-field' ).val();
2000 + let sel_ids = jQuery( '#plugin_install_selected_sites' ).val();
2001 + if ( '' != sel_ids )
2002 + sel_ids = '&selected_sites=' + sel_ids;
2003 + if ( 13 === e.which ) {
2004 + location.href = 'admin.php?page=PluginsInstall&tab=search&s=' + encodeURIComponent(search) + sel_ids;
2005 + }
2006 + } );
2007 + jQuery( '#mainwp-search-plugins-form .remove.icon' ).on( 'click', function(e) {
2008 + location.href = 'admin.php?page=PluginsInstall';
2009 + } );
2010 + } );
2011 + </script>
2012 + <?php
2013 + /**
2014 + * Install Plugins actions bar (left)
2015 + *
2016 + * Fires at the left side of the actions bar on the Install Plugins screen, after the Search bar.
2017 + *
2018 + * @since 4.0
2019 + */
2020 + do_action( 'mainwp_install_plugins_actions_bar_left' );
2021 + ?>
1865 2022 </div>
2023 +
1866 2024 </div>
1867 2025 </div>
1868 - </div>
1869 - <div class="ui segment">
1870 - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-install-plugins-info-message' ) ) : ?>
2026 +
2027 +
2028 + <div class="ui padded segment">
2029 + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-install-plugins-info-message' ) ) : ?>
1871 2030 <div class="ui info message">
1872 2031 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-install-plugins-info-message"></i>
1873 - <?php printf( esc_html__( 'Install plugins on your child sites. You can install plugins from the WordPress.org repository or by uploading a ZIP file. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/install-plugins/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?>
2032 + <div class="header"><?php esc_html_e( 'Install plugins on your child sites', 'mainwp' ); ?></div>
2033 + <?php
2034 + // translators: 1: Opening anchor tag. 2: Closing anchor tag.
2035 + printf( esc_html__( 'You can install plugins from the WordPress.org repository or by uploading a ZIP file. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp#install-plugins" target="_blank">', '</a> <i class="external alternate icon"></i>' );
2036 + ?>
1874 2037 </div>
1875 - <?php endif; ?>
2038 + <?php endif; ?>
1876 2039 <div id="mainwp-message-zone" class="ui message" style="display:none;"></div>
1877 - <div class="mainwp-upload-plugin" style="display:none;">
2040 + <div class="mainwp-upload-plugin mainwp-bulk-install-showhide-content" style="display:none;">
1878 2041 <?php MainWP_Install_Bulk::render_upload( 'plugin' ); ?>
1879 2042 </div>
1880 - <div class="mainwp-browse-plugins">
2043 + <div class="mainwp-browse-plugins mainwp-bulk-install-showhide-content">
1881 2044 <form id="plugin-filter" method="post">
1882 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
2045 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
1883 2046 <?php static::$pluginsTable->display(); ?>
1884 2047 </form>
1885 2048 </div>
1886 2049 <?php
2050 + // @since 5.4.
2051 + do_action( 'mainwp_bulk_install_tabs_content', 'plugin' );
2052 +
1887 2053 MainWP_UI::render_modal_install_plugin_theme();
1888 2054 MainWP_Updates::render_plugin_details_modal();
1889 2055 ?>
1890 2056 </div>
@@ -1922,18 +2088,24 @@
1922 2088 <div class="title active"><i class="dropdown icon"></i> <?php esc_html_e( 'Installation Options', 'mainwp' ); ?></div>
1923 2089 <div class="content active">
1924 2090 <div class="ui form">
1925 2091 <div class="field">
1926 - <div class="ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the plugin will be automatically activated after the installation.', 'mainwp' ); ?>" data-position="left center" data-inverted="">
2092 + <label><?php esc_html_e( 'Activate after installation', 'mainwp' ); ?></label>
2093 + <div class="ui toggle checkbox">
1927 2094 <input type="checkbox" value="1" checked="checked" id="chk_activate_plugin" />
1928 - <label for="chk_activate_plugin"><?php esc_html_e( 'Activate after installation', 'mainwp' ); ?></label>
2095 + <label for="chk_activate_plugin"></label>
1929 2096 </div>
2097 + <br />
2098 + <span class="ui small grey text"><?php esc_html_e( 'If enabled, the plugin will be automatically activated after the installation.', 'mainwp' ); ?></span>
1930 2099 </div>
1931 2100 <div class="field">
1932 - <div class="ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled and the plugin already installed on the sites, the already installed version will be overwritten.', 'mainwp' ); ?>" data-position="left center" data-inverted="">
2101 + <label><?php esc_html_e( 'Overwrite existing version', 'mainwp' ); ?></label>
2102 + <div class="ui toggle checkbox">
1933 2103 <input type="checkbox" value="2" checked="checked" id="chk_overwrite" />
1934 - <label for="chk_overwrite"><?php esc_html_e( 'Overwrite existing version', 'mainwp' ); ?></label>
2104 + <label for="chk_overwrite"></label>
1935 2105 </div>
2106 + <br />
2107 + <span class="ui small grey text"><?php esc_html_e( 'If enabled and the plugin already installed on the sites, the already installed version will be overwritten.', 'mainwp' ); ?></span>
1936 2108 </div>
1937 2109 </div>
1938 2110 </div>
1939 2111 <?php do_action( 'mainwp_manage_plugins_after_search_options' ); ?>
@@ -1950,24 +2122,28 @@
1950 2122 * @since 4.1
1951 2123 */
1952 2124 $allow_install = apply_filters( 'file_mod_allowed', true, 'mainwp_install_plugin' );
1953 2125 if ( $allow_install ) {
1954 - $is_demo = MainWP_Demo_Handle::is_demo_mode();
1955 - if ( $is_demo ) {
1956 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<input type="button" disabled="disabled" class="ui green big fluid button disabled" value="' . esc_html__( 'Complete Installation', 'mainwp' ) . '">' );
1957 - } else {
1958 - ?>
1959 - <input type="button" value="<?php esc_attr_e( 'Complete Installation', 'mainwp' ); ?>" class="ui green big fluid button" id="mainwp_plugin_bulk_install_btn" bulk-action="install" name="bulk-install">
1960 - <?php
1961 - }
2126 + ?>
2127 + <input type="button" value="<?php esc_attr_e( 'Complete Installation', 'mainwp' ); ?>" class="ui green big fluid button" id="mainwp_plugin_bulk_install_btn" bulk-action="install" name="bulk-install">
2128 + <?php
1962 2129 }
1963 2130 ?>
1964 - <?php do_action( 'mainwp_manage_plugins_before_submit_button' ); ?>
2131 + <?php do_action( 'mainwp_manage_plugins_before_submit_button' ); ?>
2132 + <?php
2133 + // @since 5.4.
2134 + do_action( 'mainwp_bulk_install_sidebar_submit_bottom', 'plugin' );
2135 + ?>
1965 2136 </div>
1966 2137 <?php do_action( 'mainwp_manage_plugins_sidebar_bottom', 'install' ); ?>
1967 2138 </div>
1968 2139 <div class="ui clearing hidden divider"></div>
1969 2140 </div>
2141 + <script>
2142 + jQuery( document ).ready( function () {
2143 + mainwp_init_button_site_selection_dependency( 'mainwp_plugin_bulk_install_btn' );
2144 + } );
2145 + </script>
1970 2146 <?php
1971 2147 }
1972 2148
1973 2149 /**
@@ -1980,10 +2156,10 @@
1980 2156 $cachedAUSearch = isset( $_SESSION['MainWP_PluginsActiveStatus'] ) ? $_SESSION['MainWP_PluginsActiveStatus'] : null; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized --- ok.
1981 2157
1982 2158 static::render_header( 'AutoUpdate' );
1983 2159
1984 - if ( ! mainwp_current_user_have_right( 'dashboard', 'trust_untrust_updates' ) ) {
1985 - mainwp_do_not_have_permissions( esc_html__( 'trust/untrust updates', 'mainwp' ) );
2160 + if ( ! \mainwp_current_user_can( 'dashboard', 'trust_untrust_updates' ) ) {
2161 + \mainwp_do_not_have_permissions( esc_html__( 'trust/untrust updates', 'mainwp' ) );
1986 2162 } else {
1987 2163 $snPluginAutomaticDailyUpdate = get_option( 'mainwp_pluginAutomaticDailyUpdate' );
1988 2164
1989 2165 if ( false === $snPluginAutomaticDailyUpdate ) {
@@ -1993,60 +2169,72 @@
1993 2169
1994 2170 ?>
1995 2171 <div class="ui alt segment" id="mainwp-plugin-auto-updates">
1996 2172 <div class="mainwp-main-content">
1997 - <div class="mainwp-actions-bar">
2173 + <div class="mainwp-actions-bar" <?php echo ! isset( $_SESSION['MainWP_PluginsActive'] ) ? 'style="display:none"' : ''; ?>>
1998 2174 <div class="ui mini form stackable grid">
1999 2175 <div class="ui two column row">
2000 2176 <div class="left aligned column">
2001 2177 <select id="mainwp-bulk-actions" name="bulk_action" class="ui mini selection dropdown">
2002 2178 <option class="item" value=""><?php esc_html_e( 'Bulk Actions', 'mainwp' ); ?></option>
2003 - <option class="item" value="trust"><?php esc_html_e( 'Trust', 'mainwp' ); ?></option>
2004 - <option class="item" value="untrust"><?php esc_html_e( 'Untrust', 'mainwp' ); ?></option>
2005 - <?php
2006 - /**
2007 - * Action: mainwp_plugins_auto_updates_bulk_action
2008 - *
2009 - * Adds new action to the bulk actions menu on Plugins Auto Updates.
2010 - *
2011 - * @since 4.1
2012 - */
2013 - do_action( 'mainwp_plugins_auto_updates_bulk_action' );
2014 - ?>
2179 + <option class="item" value="trust">
2180 + <?php esc_html_e( 'Mark as Trusted', 'mainwp' ); ?><br/>
2181 + <span class="ui small grey text"><?php esc_html_e( 'Auto updated by your Dashboard', 'mainwp' ); ?></span>
2182 + </option>
2183 + <option class="item" value="untrust">
2184 + <?php esc_html_e( 'Mark as Untrusted', 'mainwp' ); ?><br/>
2185 + <span class="ui small grey text"><?php esc_html_e( 'Require manual updates', 'mainwp' ); ?></span>
2186 + </option>
2187 + <?php
2188 + /**
2189 + * Action: mainwp_plugins_auto_updates_bulk_action
2190 + *
2191 + * Adds new action to the bulk actions menu on Plugins Auto Updates.
2192 + *
2193 + * @since 4.1
2194 + */
2195 + do_action( 'mainwp_plugins_auto_updates_bulk_action' );
2196 + ?>
2015 2197 </select>
2016 - <input type="button" name="" id="mainwp-bulk-trust-plugins-action-apply" class="ui mini basic button" value="<?php esc_attr_e( 'Apply', 'mainwp' ); ?>"/>
2017 - </div>
2018 - <div class="right aligned column"></div>
2019 - </div>
2198 + <input type="button" name="" id="mainwp-bulk-trust-plugins-action-apply" class="ui mini basic button" value="<?php esc_attr_e( 'Apply', 'mainwp' ); ?>"/>
2199 + </div>
2200 + <div class="right aligned column"></div>
2020 2201 </div>
2021 2202 </div>
2203 + </div>
2022 2204
2023 - <?php if ( isset( $_GET['message'] ) && 'saved' === $_GET['message'] ) : // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>
2024 - <div class="ui message green"><?php esc_html_e( 'Settings have been saved.', 'mainwp' ); ?></div>
2025 - <?php endif; ?>
2026 - <div id="mainwp-message-zone" class="ui message" style="display:none"></div>
2027 - <div id="mainwp-auto-updates-plugins-content" class="ui segment">
2028 - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-disable-auto-updates-info-message' ) ) : ?>
2205 + <?php if ( isset( $_GET['message'] ) && 'saved' === $_GET['message'] ) : // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>
2206 + <div class="ui message green"><?php esc_html_e( 'Settings have been saved.', 'mainwp' ); ?></div>
2207 + <?php endif; ?>
2208 + <div id="mainwp-message-zone" class="ui message" style="display:none"></div>
2209 + <div id="mainwp-auto-updates-plugins-content" class="ui padded segment">
2210 + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-plugins-auto-updates-info-message' ) ) : ?>
2029 2211 <div class="ui info message">
2030 - <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-disable-auto-updates-info-message"></i>
2031 - <div><?php printf( esc_html__( 'Check out %1$show to disable the WordPress built in auto-updates feature%2$s.', 'mainwp' ), '<a href="https://mainwp.com/how-to-disable-automatic-plugin-and-theme-updates-on-your-child-sites/" target="_blank">', '</a>' ); // NOSONAR - noopener - open safe. ?></div>
2032 - </div>
2033 - <?php endif; ?>
2034 - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-plugins-auto-updates-info-message' ) ) : ?>
2035 - <div class="ui info message">
2036 2212 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-plugins-auto-updates-info-message"></i>
2213 + <div class="header"><?php esc_html_e( 'Automatically update only the plugins you trust!', 'mainwp' ); ?></div>
2037 2214 <div><?php esc_html_e( 'The MainWP Advanced Auto Updates feature is a tool for your Dashboard to automatically update plugins that you trust to be updated without breaking your Child sites.', 'mainwp' ); ?></div>
2038 2215 <div><?php esc_html_e( 'Only mark plugins as trusted if you are absolutely sure they can be automatically updated by your MainWP Dashboard without causing issues on the Child sites!', 'mainwp' ); ?></div>
2039 2216 <div><strong><?php esc_html_e( 'Advanced Auto Updates a delayed approximately 24 hours from the update release. Ignored plugins can not be automatically updated.', 'mainwp' ); ?></strong></div>
2040 2217 </div>
2041 - <?php endif; ?>
2042 - <div class="ui inverted dimmer">
2043 - <div class="ui text loader"><?php esc_html_e( 'Loading plugins', 'mainwp' ); ?></div>
2218 + <?php endif; ?>
2219 + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-disable-auto-updates-info-message' ) ) : ?>
2220 + <div class="ui message">
2221 + <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-disable-auto-updates-info-message"></i>
2222 + <div><em data-emoji=":bulb:" class="small"></em> <?php
2223 + // translators: 1: Opening anchor tag. 2: Closing anchor tag.
2224 + printf( esc_html__( 'Tip: Check out %1$show to disable the WordPress built in auto-updates feature%2$s.', 'mainwp' ), '<a href="https://mainwp.com/how-to-disable-automatic-plugin-and-theme-updates-on-your-child-sites/" target="_blank">', '</a>' ); // NOSONAR - noopener - open safe.
2225 + ?></div>
2044 2226 </div>
2045 - <div id="mainwp-auto-updates-plugins-table-wrapper">
2227 + <?php endif; ?>
2228 + <div class="ui page dimmer">
2229 + <div class="ui text double loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div>
2230 + </div>
2231 + <div id="mainwp-auto-updates-plugins-table-wrapper">
2046 2232 <?php
2047 2233 if ( isset( $_SESSION['MainWP_PluginsActive'] ) ) {
2048 2234 static::render_all_active_table( $_SESSION['MainWP_PluginsActive'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
2235 + } else {
2236 + MainWP_UI::render_empty_page_placeholder( __( 'No plugins loaded yet.', 'mainwp' ), __( 'Click Show Plugins button to view your installed plugins and manage their trust settings.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' );
2049 2237 }
2050 2238 ?>
2051 2239 </div>
2052 2240 </div>
@@ -2298,15 +2486,15 @@
2298 2486 <table class="ui unstackable table" id="mainwp-all-active-plugins-table">
2299 2487 <thead>
2300 2488 <tr>
2301 2489 <th scope="col" class="no-sort check-column collapsing"><span class="ui checkbox"><input id="cb-select-all-top" type="checkbox" /></span></th>
2302 - <th scope="col" class="no-sort"><?php esc_html_e( '', 'mainwp' ); ?></th>
2490 + <th scope="col" class="no-sort center aligned"></th>
2303 2491 <th scope="col" data-priority="1"><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th>
2304 - <th scope="col" ><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
2305 - <th scope="col" class="collapsing" data-priority="2"><?php esc_html_e( 'Trust Status', 'mainwp' ); ?></th>
2306 - <th scope="col"><?php esc_html_e( 'Ignored Status', 'mainwp' ); ?></th>
2307 - <th scope="col" class="collapsing"></th>
2308 - <th scope="col" class="collapsing"><?php esc_html_e( 'Notes', 'mainwp' ); ?></th>
2492 + <th scope="col" class="collapsing center aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
2493 + <th scope="col" class="collapsing center aligned" data-priority="2"><?php esc_html_e( 'Trust Status', 'mainwp' ); ?></th>
2494 + <th scope="col" class="collapsing center aligned"><?php esc_html_e( 'Ignored Status', 'mainwp' ); ?></th>
2495 + <th scope="col" class="collapsing center aligned"></th>
2496 + <th scope="col" class="collapsing center aligned"><?php esc_html_e( 'Notes', 'mainwp' ); ?></th>
2309 2497 </tr>
2310 2498 </thead>
2311 2499 <tbody>
2312 2500 <?php foreach ( $plugins as $slug => $plugin ) : ?>
@@ -2322,9 +2510,9 @@
2322 2510 if ( 'untrust' === $search_status && in_array( $slug, $trustedPlugins ) ) {
2323 2511 continue;
2324 2512 }
2325 2513
2326 - if ( 'ignored' === $search_status && ! isset( $decodedIgnoredPlugins[ $slug ] ) ) {
2514 + if ( 'ignored' === $search_status && ! MainWP_Common_Functions::instance()->is_ignored_updates( $plugin, $decodedIgnoredPlugins, 'plugin' ) ) {
2327 2515 continue;
2328 2516 }
2329 2517 }
2330 2518 $esc_note = '';
@@ -2336,21 +2524,21 @@
2336 2524
2337 2525 $plugin_directory = dirname( $slug );
2338 2526 ?>
2339 2527 <?php // phpcs:disable WordPress.Security.EscapeOutput ?>
2340 - <tr plugin-slug="<?php echo esc_attr( rawurlencode( $slug ) ); ?>" plugin-name="<?php echo esc_html( wp_strip_all_tags( $name ) ); ?>">
2528 + <tr plugin-slug="<?php echo esc_attr( rawurlencode( $slug ) ); ?>" plugin-name="<?php echo esc_html( wp_strip_all_tags( $name ) ); ?>" <?php echo ( in_array( $slug, $trustedPlugins ) ) ? 'class=""' : 'class="active"'; ?>>
2341 2529 <td class="check-column"><span class="ui checkbox"><input type="checkbox" name="plugin[]" value="<?php echo esc_attr( rawurlencode( $slug ) ); ?>"></span></td>
2342 2530 <td class="collapsing"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></td>
2343 2531 <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $wpid ) . '&plugin=' . rawurlencode( dirname( $slug ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $name ); ?></a></td>
2344 - <td><?php echo ( 1 === (int) $plugin['active'] ) ? esc_html__( 'Active', 'mainwp' ) : esc_html__( 'Inactive', 'mainwp' ); //phpcs:ignore -- escaped. ?></td>
2345 - <td><?php echo ( in_array( $slug, $trustedPlugins ) ) ? '<span class="ui mini green fluid center aligned label">' . esc_html__( 'Trusted', 'mainwp' ) . '</span>' : '<span class="ui mini red fluid center aligned label">' . esc_html__( 'Not Trusted', 'mainwp' ) . '</span>'; ?></td>
2346 - <td><?php echo ( isset( $decodedIgnoredPlugins[ $slug ] ) ) ? '<span class="ui mini label">' . esc_html__( 'Ignored', 'mainwp' ) . '</span>' : ''; ?></td>
2347 - <td><?php echo ( isset( $decodedIgnoredPlugins[ $slug ] ) ) ? '<span data-tooltip="Ignored plugins will not be automatically updated." data-inverted=""><i class="info red circle icon" ></i></span>' : ''; ?></td>
2532 + <td class="collapsing center aligned"><?php echo ( 1 === (int) $plugin['active'] ) ? '<span class="ui tiny grey label"><i class="circle green icon"></i> ' . esc_html__( 'Active', 'mainwp' ) . '</span>' : '<span class="ui tiny grey label"><i class="circle red icon"></i> ' . esc_html__( 'Inactive', 'mainwp' ) . '</span>'; //phpcs:ignore -- escaped. ?></td>
2533 + <td class="collapsing center aligned"><?php echo ( in_array( $slug, $trustedPlugins ) ) ? '<span class="ui mini green label"><i class="lock green icon"></i> ' . esc_html__( 'Trusted', 'mainwp' ) . '</span>' : '<span class="ui mini red label"><i class="lock open red icon"></i> ' . esc_html__( 'Not Trusted', 'mainwp' ) . '</span>'; ?></td>
2534 + <td class="collapsing center aligned"><?php echo MainWP_Common_Functions::instance()->is_ignored_updates( $plugin, $decodedIgnoredPlugins, 'plugin' ) ? '<span class="ui mini basic label">' . esc_html__( 'Ignored', 'mainwp' ) . '</span>' : ''; ?></td>
2535 + <td class="collapsing center aligned"><?php echo MainWP_Common_Functions::instance()->is_ignored_updates( $plugin, $decodedIgnoredPlugins, 'plugin' ) ? '<span data-tooltip="Ignored plugins will not be automatically updated." data-inverted=""><i class="info red circle icon" ></i></span>' : ''; ?></td>
2348 2536 <td class="collapsing center aligned">
2349 2537 <?php if ( '' === $esc_note ) : ?>
2350 2538 <a href="javascript:void(0)" class="mainwp-edit-plugin-note" ><i class="sticky note outline icon"></i></a>
2351 2539 <?php else : ?>
2352 - <a href="javascript:void(0)" class="mainwp-edit-plugin-note" data-tooltip="<?php echo substr( $strip_note, 0, 100 ); //phpcs:ignore -- escaped. ?>" data-position="left center" data-inverted=""><i class="sticky green note icon"></i></a>
2540 + <a href="javascript:void(0)" class="mainwp-edit-plugin-note" data-tooltip="<?php echo substr( $strip_note, 0, 100 ); //phpcs:ignore -- escaped. ?>" data-position="center left" data-inverted=""><i class="sticky green note icon"></i></a>
2353 2541 <?php endif; ?>
2354 2542 <span style="display: none" class="esc-content-note"><?php echo $esc_note; //phpcs:ignore -- escaped. ?></span>
2355 2543 </td>
2356 2544 </tr>
@@ -2356,20 +2544,8 @@
2356 2544 </tr>
2357 2545 <?php // phpcs:enable ?>
2358 2546 <?php endforeach; ?>
2359 2547 </tbody>
2360 - <tfoot>
2361 - <tr>
2362 - <th scope="col" class="no-sort check-column"><span class="ui checkbox"><input id="cb-select-all-bottom" type="checkbox" /></span></th>
2363 - <th scope="col" ></th>
2364 - <th scope="col" ><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th>
2365 - <th scope="col" ><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
2366 - <th scope="col" ><?php esc_html_e( 'Trust Status', 'mainwp' ); ?></th>
2367 - <th scope="col" ><?php esc_html_e( 'Ignored Status', 'mainwp' ); ?></th>
2368 - <th scope="col" class="collapsing"></th>
2369 - <th scope="col" ><?php esc_html_e( 'Notes', 'mainwp' ); ?></th>
2370 - </tr>
2371 - </tfoot>
2372 2548 </table>
2373 2549 <?php
2374 2550 /**
2375 2551 * Action: mainwp_plugins_after_auto_updates_table
@@ -2458,13 +2634,16 @@
2458 2634 }
2459 2635
2460 2636 static::render_header( 'Ignore' );
2461 2637 ?>
2462 - <div id="mainwp-ignored-plugins" class="ui segment">
2638 + <div id="mainwp-ignored-plugins" class="ui padded segment">
2463 2639 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-ignored-plugins-info-message' ) ) : ?>
2464 2640 <div class="ui info message">
2465 2641 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-ignored-plugins-info-message"></i>
2466 - <?php printf( esc_html__( 'Manage plugins you have told your MainWP Dashboard to ignore updates on global or per site level. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/ignore-plugin-updates/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?>
2642 + <?php
2643 + // translators: 1: Opening anchor tag. 2: Closing anchor tag.
2644 + printf( esc_html__( 'Manage plugins you have told your MainWP Dashboard to ignore updates on global or per site level. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-plugin-updates" target="_blank">', '</a> <i class="external alternate icon"></i>' );
2645 + ?>
2467 2646 </div>
2468 2647 <?php endif; ?>
2469 2648 <?php
2470 2649 /**
@@ -2469,14 +2648,15 @@
2469 2648 <?php
2470 2649 /**
2471 2650 * Action: mainwp_plugins_before_ignored_updates
2472 2651 *
2473 - * Fires on the top of the Ignored Plugins Updates page.
2652 + * Fires on the top of the Ignored Plugin Updates page.
2474 2653 *
2475 2654 * @since 4.1
2476 2655 */
2477 2656 do_action( 'mainwp_plugins_before_ignored_updates', $ignoredPlugins, $websites );
2478 2657 ?>
2658 + <?php if ( ! empty( $ignoredPlugins ) ) : ?>
2479 2659 <h3 class="ui header">
2480 2660 <?php esc_html_e( 'Globally Ignored Plugins', 'mainwp' ); ?>
2481 2661 <div class="sub header"><?php esc_html_e( 'These are plugins you have told your MainWP Dashboard to ignore updates on global level and not notify you about pending updates.', 'mainwp' ); ?></div>
2482 2662 </h3>
@@ -2481,18 +2661,24 @@
2481 2661 <div class="sub header"><?php esc_html_e( 'These are plugins you have told your MainWP Dashboard to ignore updates on global level and not notify you about pending updates.', 'mainwp' ); ?></div>
2482 2662 </h3>
2483 2663 <?php static::render_global_ignored( $ignoredPlugins, $decodedIgnoredPlugins ); ?>
2484 2664 <div class="ui hidden divider"></div>
2665 + <?php endif; ?>
2666 + <?php if ( $cnt > 0 ) : ?>
2485 2667 <h3 class="ui header">
2486 - <?php esc_html_e( 'Per Site Ignored Plugins' ); ?>
2668 + <?php esc_html_e( 'Per Site Ignored Plugins', 'mainwp' ); ?>
2487 2669 <div class="sub header"><?php esc_html_e( 'These are plugins you have told your MainWP Dashboard to ignore updates per site level and not notify you about pending updates.', 'mainwp' ); ?></div>
2488 2670 </h3>
2489 2671 <?php static::render_sites_ignored( $cnt, $websites ); ?>
2672 + <?php endif; ?>
2673 + <?php if ( empty( $ignoredPlugins ) && 0 === $cnt ) : ?>
2674 + <?php MainWP_UI::render_empty_page_placeholder( __( 'No Ignored Updates', 'mainwp' ), __( 'All plugin updates are being tracked. When you choose to ignore updates for a specific plugin, they will appear here.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' ); ?>
2675 + <?php endif; ?>
2490 2676 <?php
2491 2677 /**
2492 2678 * Action: mainwp_plugins_after_ignored_updates
2493 2679 *
2494 - * Fires on the bottom of the Ignored Plugins Updates page.
2680 + * Fires on the bottom of the Ignored Plugin Updates page.
2495 2681 *
2496 2682 * @since 4.1
2497 2683 */
2498 2684 do_action( 'mainwp_plugins_after_ignored_updates', $ignoredPlugins, $websites );
@@ -2503,16 +2689,25 @@
2503 2689 static::render_footer( 'Ignore' );
2504 2690 }
2505 2691
2506 2692 /**
2693 + * Method render_abandoned_plugins()
2694 + *
2695 + * Render abandoned plugins list.
2696 + */
2697 + public static function render_abandoned_plugins() {
2698 + MainWP_Updates::render( 'abandoned_plugins' );
2699 + }
2700 +
2701 + /**
2507 2702 * Method render_global_ignored()
2508 2703 *
2509 2704 * Render Global Ignored plugins list.
2510 2705 *
2511 - * @param array $ignoredPlugins Ignored plugins array.
2706 + * @param bool $ignoredPlugins Ignored plugins array.
2512 2707 * @param array $decodedIgnoredPlugins Decoded ignored plugins array.
2513 2708 */
2514 - public static function render_global_ignored( $ignoredPlugins, $decodedIgnoredPlugins ) {
2709 + public static function render_global_ignored( $ignoredPlugins, $decodedIgnoredPlugins ) { //phpcs:ignore -- NOSONAR - complex.
2515 2710 ?>
2516 2711 <table id="mainwp-globally-ignored-plugins" class="ui compact selectable table unstackable">
2517 2712 <thead>
2518 2713 <tr>
@@ -2518,8 +2713,9 @@
2518 2713 <tr>
2519 2714 <th scope="col" class="no-sort"></th>
2520 2715 <th scope="col" ><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th>
2521 2716 <th scope="col" ><?php esc_html_e( 'Plugin slug', 'mainwp' ); ?></th>
2717 + <th scope="col" ><?php esc_html_e( 'Ignored version', 'mainwp' ); ?></th>
2522 2718 <th scope="col" ></th>
2523 2719 </tr>
2524 2720 </thead>
2525 2721 <tbody id="globally-ignored-plugins-list">
@@ -2524,29 +2720,46 @@
2524 2720 </thead>
2525 2721 <tbody id="globally-ignored-plugins-list">
2526 2722 <?php if ( $ignoredPlugins ) : ?>
2527 2723 <?php // phpcs:disable WordPress.Security.EscapeOutput ?>
2528 - <?php foreach ( $decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName ) : ?>
2724 + <?php
2725 + foreach ( $decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName ) :
2726 +
2727 + $ignore_name = 'N/A';
2728 + $ignored_vers = array( 'all_versions' );
2729 + if ( is_string( $ignoredPluginName ) ) {
2730 + $ignore_name = $ignoredPluginName;
2731 + } elseif ( is_array( $ignoredPluginName ) ) {
2732 + $ignore_name = ! empty( $ignoredPluginName['Name'] ) ? $ignoredPluginName['Name'] : $ignore_name;
2733 + $ig_vers = ! empty( $ignoredPluginName['ignored_versions'] ) ? $ignoredPluginName['ignored_versions'] : '';
2734 + if ( ! empty( $ig_vers ) && is_array( $ig_vers ) && ! in_array( 'all_versions', $ig_vers ) ) {
2735 + $ignored_vers = $ig_vers;
2736 + }
2737 + }
2738 + ?>
2529 2739 <?php $plugin_directory = dirname( $ignoredPlugin ); ?>
2530 - <tr plugin-slug="<?php echo esc_attr( rawurlencode( $ignoredPlugin ) ); ?>">
2531 - <td class="collapsing"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></td>
2532 - <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&plugin=' . esc_html( rawurlencode( dirname( $ignoredPlugin ) ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignoredPluginName ); ?></a></td>
2533 - <td><?php echo esc_html( $ignoredPlugin ); ?></td>
2534 - <td class="right aligned">
2535 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2536 - <a href="#" class="ui mini button" onClick="return updatesoverview_plugins_unignore_globally( '<?php echo esc_html( rawurlencode( $ignoredPlugin ) ); ?>' )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a>
2537 - <?php endif; ?>
2538 - </td>
2539 - </tr>
2740 + <?php foreach ( $ignored_vers as $ignored_ver ) { ?>
2741 + <tr plugin-slug="<?php echo esc_attr( rawurlencode( $ignoredPlugin ) ); ?>">
2742 + <td class="collapsing"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></td>
2743 + <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&plugin=' . esc_html( rawurlencode( dirname( $ignoredPlugin ) ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignore_name ); ?></a></td>
2744 + <td><?php echo esc_html( $ignoredPlugin ); ?></td>
2745 + <td><?php echo 'all_versions' === $ignored_ver ? esc_html__( 'All', 'mainwp' ) : esc_html( $ignored_ver ); ?></td>
2746 + <td class="right aligned">
2747 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2748 + <a href="#" class="ui mini button" onClick="return updatesoverview_plugins_unignore_globally( '<?php echo esc_html( rawurlencode( $ignoredPlugin ) ); ?>', '<?php echo esc_js( rawurlencode( $ignored_ver ) ); ?>' )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a>
2749 + <?php endif; ?>
2750 + </td>
2751 + </tr>
2752 + <?php } ?>
2540 2753 <?php endforeach; ?>
2541 2754 <?php // phpcs:enable ?>
2542 2755 <?php endif; ?>
2543 2756 </tbody>
2544 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2757 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2545 2758 <?php if ( $ignoredPlugins ) : ?>
2546 2759 <tfoot class="full-width">
2547 2760 <tr>
2548 - <th scope="col" colspan="4">
2761 + <th scope="col" colspan="5">
2549 2762 <a class="ui right floated small green labeled icon button" onClick="return updatesoverview_plugins_unignore_globally_all();" id="mainwp-unignore-globally-all">
2550 2763 <i class="check icon"></i> <?php esc_html_e( 'Unignore All', 'mainwp' ); ?>
2551 2764 </a>
2552 2765 </th>
@@ -2592,11 +2805,12 @@
2592 2805 <table id="mainwp-per-site-ignored-plugins" class="ui unstackable compact selectable table ">
2593 2806 <thead>
2594 2807 <tr>
2595 2808 <th scope="col" ><?php esc_html_e( 'Site', 'mainwp' ); ?></th>
2596 - <th scope="col" class="no-sort"><?php esc_html_e( '', 'mainwp' ); ?></th>
2809 + <th scope="col" class="no-sort"></th>
2597 2810 <th scope="col" ><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th>
2598 2811 <th scope="col" ><?php esc_html_e( 'Plugin slug', 'mainwp' ); ?></th>
2812 + <th scope="col" ><?php esc_html_e( 'Ignored version', 'mainwp' ); ?></th>
2599 2813 <th scope="col" ></th>
2600 2814 </tr>
2601 2815 </thead>
2602 2816 <tbody id="ignored-plugins-list">
@@ -2615,23 +2829,38 @@
2615 2829 }
2616 2830 $first = true;
2617 2831 // phpcs:disable WordPress.Security.EscapeOutput
2618 2832 foreach ( $decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName ) {
2833 +
2834 + $ignore_name = 'N/A';
2835 + $ignored_vers = array( 'all_versions' );
2836 + if ( is_string( $ignoredPluginName ) ) {
2837 + $ignore_name = $ignoredPluginName;
2838 + } elseif ( is_array( $ignoredPluginName ) ) {
2839 + $ignore_name = ! empty( $ignoredPluginName['Name'] ) ? $ignoredPluginName['Name'] : $ignore_name;
2840 + $ig_vers = ! empty( $ignoredPluginName['ignored_versions'] ) ? $ignoredPluginName['ignored_versions'] : '';
2841 + if ( ! empty( $ig_vers ) && is_array( $ig_vers ) && ! in_array( 'all_versions', $ig_vers ) ) {
2842 + $ignored_vers = $ig_vers;
2843 + }
2844 + }
2619 2845 $plugin_directory = MainWP_Utility::get_dir_slug( rawurldecode( $ignoredPlugin ) );
2620 - ?>
2621 - <tr site-id="<?php echo intval( $website->id ); ?>" plugin-slug="<?php echo esc_attr( rawurlencode( $ignoredPlugin ) ); ?>">
2622 - <?php if ( $first ) : ?>
2623 - <td><div><a href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&dashboard=' . $website->id ) ); ?>"><?php echo esc_html( stripslashes( $website->name ) ); ?></a></div></td>
2624 - <?php $first = false; ?>
2625 - <?php else : ?>
2626 - <td><div style="display:none;"><a href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&dashboard=' . $website->id ) ); ?>"><?php echo esc_html( stripslashes( $website->name ) ); ?></a></div></td>
2627 - <?php endif; ?>
2628 - <td class="collapsing"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></td>
2629 - <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $website->id ) . '&plugin=' . esc_html( rawurlencode( $plugin_directory ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignoredPluginName ); ?></a></td>
2630 - <td><?php echo esc_html( rawurldecode( $ignoredPlugin ) ); ?></td>
2631 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2632 - <td class="right aligned"><a href="#" class="ui mini button" onClick="return updatesoverview_plugins_unignore_detail( '<?php echo esc_js( rawurlencode( $ignoredPlugin ) ); ?>', <?php echo intval( $website->id ); ?> )"> <?php esc_html_e( 'Unignore', 'mainwp' ); ?></a></td>
2633 - <?php endif; ?>
2846 + foreach ( $ignored_vers as $ignored_ver ) {
2847 + ?>
2848 + <tr site-id="<?php echo intval( $website->id ); ?>" plugin-slug="<?php echo esc_attr( rawurlencode( $ignoredPlugin ) ); ?>">
2849 + <?php if ( $first ) : ?>
2850 + <td><div><a href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&dashboard=' . $website->id ) ); ?>"><?php echo esc_html( stripslashes( $website->name ) ); ?></a></div></td>
2851 + <?php $first = false; ?>
2852 + <?php else : ?>
2853 + <td><div style="display:none;"><a href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&dashboard=' . $website->id ) ); ?>"><?php echo esc_html( stripslashes( $website->name ) ); ?></a></div></td>
2854 + <?php endif; ?>
2855 + <td class="collapsing"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></td>
2856 + <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $website->id ) . '&plugin=' . esc_html( rawurlencode( $plugin_directory ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignore_name ); ?></a></td>
2857 + <td><?php echo esc_html( rawurldecode( $ignoredPlugin ) ); ?></td>
2858 + <td><?php echo 'all_versions' === $ignored_ver ? esc_html__( 'All', 'mainwp' ) : esc_html( $ignored_ver ); ?></td>
2859 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2860 + <td class="right aligned"><a href="#" class="ui mini button" onClick="return updatesoverview_plugins_unignore_detail( '<?php echo esc_js( rawurlencode( $ignoredPlugin ) ); ?>', <?php echo intval( $website->id ); ?>, '<?php echo esc_js( rawurlencode( $ignored_ver ) ); ?>' )"> <?php esc_html_e( 'Unignore', 'mainwp' ); ?></a></td>
2861 + <?php endif; ?>
2862 + <?php } ?>
2634 2863 </tr>
2635 2864 <?php
2636 2865 }
2637 2866 // phpcs:enable
@@ -2640,13 +2869,13 @@
2640 2869 MainWP_DB::free_result( $websites );
2641 2870 ?>
2642 2871 <?php endif; ?>
2643 2872 </tbody>
2644 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2873 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2645 2874 <?php if ( 0 < $cnt ) : ?>
2646 2875 <tfoot class="full-width">
2647 2876 <tr>
2648 - <th scope="col" colspan="5">
2877 + <th scope="col" colspan="6">
2649 2878 <a class="ui right floated small green labeled icon button" onClick="return updatesoverview_plugins_unignore_detail_all();" id="mainwp-unignore-detail-all">
2650 2879 <i class="check icon"></i> <?php esc_html_e( 'Unignore All', 'mainwp' ); ?>
2651 2880 </a>
2652 2881 </th>
@@ -2701,13 +2930,16 @@
2701 2930 }
2702 2931
2703 2932 static::render_header( 'IgnoreAbandoned' );
2704 2933 ?>
2705 - <div id="mainwp-ignored-abandoned-plugins" class="ui segment">
2934 + <div id="mainwp-ignored-abandoned-plugins" class="ui padded segment">
2706 2935 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-ignored-abandoned-plugins-info-message' ) ) : ?>
2707 2936 <div class="ui info message">
2708 2937 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-ignored-abandoned-plugins-info-message"></i>
2709 - <?php printf( esc_html__( 'Manage abandoned plugins you have told your MainWP Dashboard to ignore on global or per site level. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/abandoned-plugins/" target="_blank">', '</a> <i class="external alternate icon"></i> ' ); ?>
2938 + <?php
2939 + // translators: 1: Opening anchor tag. 2: Closing anchor tag.
2940 + printf( esc_html__( 'Manage abandoned plugins you have told your MainWP Dashboard to ignore on global or per site level. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp" target="_blank">', '</a> <i class="external alternate icon"></i> ' );
2941 + ?>
2710 2942 </div>
2711 2943 <?php endif; ?>
2712 2944 <?php
2713 2945 /**
@@ -2718,19 +2950,26 @@
2718 2950 * @since 4.1
2719 2951 */
2720 2952 do_action( 'mainwp_plugins_before_ignored_abandoned', $ignoredPlugins, $websites );
2721 2953 ?>
2954 + <?php if ( ! empty( $ignoredPlugins ) ) : ?>
2722 2955 <h3 class="ui header">
2723 - <?php esc_html_e( 'Globally Ignored Abandoned Plugins' ); ?>
2956 + <?php esc_html_e( 'Globally Ignored Abandoned Plugins', 'mainwp' ); ?>
2724 2957 <div class="sub header"><?php esc_html_e( 'These are plugins you have told your MainWP Dashboard to ignore on global level even though they have passed your Abandoned Plugin Tolerance date', 'mainwp' ); ?></div>
2725 2958 </h3>
2726 2959 <?php static::render_global_ignored_abandoned( $ignoredPlugins, $decodedIgnoredPlugins ); ?>
2727 2960 <div class="ui hidden divider"></div>
2961 + <?php endif; ?>
2962 + <?php if ( $cnt > 0 ) : ?>
2728 2963 <h3 class="ui header">
2729 - <?php esc_html_e( 'Per Site Ignored Abandoned Plugins' ); ?>
2964 + <?php esc_html_e( 'Per Site Ignored Abandoned Plugins', 'mainwp' ); ?>
2730 2965 <div class="sub header"><?php esc_html_e( 'These are plugins you have told your MainWP Dashboard to ignore per site level even though they have passed your Abandoned Plugin Tolerance date', 'mainwp' ); ?></div>
2731 2966 </h3>
2732 2967 <?php static::render_sites_ignored_abandoned( $cnt, $websites ); ?>
2968 + <?php endif; ?>
2969 + <?php if ( empty( $ignoredPlugins ) && 0 === $cnt ) : ?>
2970 + <?php MainWP_UI::render_empty_page_placeholder( __( 'No Ignored Abandoned Plugins', 'mainwp' ), __( 'All plugins are being monitored for abandonment. When you choose to ignore the abandoned status for a specific plugin, it will appear here.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' ); ?>
2971 + <?php endif; ?>
2733 2972 <?php
2734 2973 /**
2735 2974 * Action: mainwp_plugins_after_ignored_abandoned
2736 2975 *
@@ -2757,9 +2996,9 @@
2757 2996 ?>
2758 2997 <table id="mainwp-globally-ignored-abandoned-plugins" class="ui compact selectable table unstackable">
2759 2998 <thead>
2760 2999 <tr>
2761 - <th scope="col" class="no-sort"><?php esc_html_e( ' ', 'mainwp' ); ?></th>
3000 + <th scope="col" class="no-sort">&nbsp;</th>
2762 3001 <th scope="col" ><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th>
2763 3002 <th scope="col" ><?php esc_html_e( 'Plugin slug', 'mainwp' ); ?></th>
2764 3003 <th scope="col" ></th>
2765 3004 </tr>
@@ -2768,16 +3007,23 @@
2768 3007 <?php if ( $ignoredPlugins ) : ?>
2769 3008 <?php
2770 3009 // phpcs:disable WordPress.Security.EscapeOutput
2771 3010 foreach ( $decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName ) :
3011 + $ignore_name = 'N/A';
3012 + if ( is_string( $ignoredPluginName ) ) {
3013 + $ignore_name = $ignoredPluginName;
3014 + } elseif ( is_array( $ignoredPluginName ) && ! empty( $ignoredPluginName['Name'] ) ) {
3015 + $ignore_name = $ignoredPluginName['Name'];
3016 + }
3017 +
2772 3018 $plugin_directory = MainWP_Utility::get_dir_slug( rawurldecode( $ignoredPlugin ) );
2773 3019 ?>
2774 3020 <tr plugin-slug="<?php echo esc_attr( rawurlencode( $ignoredPlugin ) ); ?>">
2775 3021 <td class="collapsing"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></td>
2776 - <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&plugin=' . esc_html( rawurlencode( $plugin_directory ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignoredPluginName ); ?></a></td>
3022 + <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&plugin=' . esc_html( rawurlencode( $plugin_directory ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignore_name ); ?></a></td>
2777 3023 <td><?php echo esc_html( $ignoredPlugin ); ?></td>
2778 3024 <td class="right aligned">
2779 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
3025 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2780 3026 <a href="#" class="ui mini button" onClick="return updatesoverview_plugins_abandoned_unignore_globally( '<?php echo esc_html( rawurlencode( $ignoredPlugin ) ); ?>' )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a>
2781 3027 <?php endif; ?>
2782 3028 </td>
2783 3029 </tr>
@@ -2784,9 +3030,9 @@
2784 3030 <?php endforeach; ?>
2785 3031 <?php // phpcs:enable ?>
2786 3032 <?php endif; ?>
2787 3033 </tbody>
2788 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
3034 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2789 3035 <?php if ( $ignoredPlugins ) : ?>
2790 3036 <tfoot class="full-width">
2791 3037 <tr>
2792 3038 <th scope="col" colspan="4">
@@ -2836,9 +3082,9 @@
2836 3082 <table id="mainwp-per-site-ignored-abandoned-plugins" class="ui compact selectable table unstackable">
2837 3083 <thead>
2838 3084 <tr>
2839 3085 <th scope="col" ><?php esc_html_e( 'Site', 'mainwp' ); ?></th>
2840 - <th scope="col" class="no-sort"><?php esc_html_e( ' ', 'mainwp' ); ?></th>
3086 + <th scope="col" class="no-sort">&nbsp;</th>
2841 3087 <th scope="col" ><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th>
2842 3088 <th scope="col" ><?php esc_html_e( 'Plugin slug', 'mainwp' ); ?></th>
2843 3089 <th scope="col" ></th>
2844 3090 </tr>
@@ -2857,8 +3103,15 @@
2857 3103 }
2858 3104 $first = true;
2859 3105 // phpcs:disable WordPress.Security.EscapeOutput
2860 3106 foreach ( $decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName ) {
3107 + $ignore_name = 'N/A';
3108 + if ( is_string( $ignoredPluginName ) ) {
3109 + $ignore_name = $ignoredPluginName;
3110 + } elseif ( is_array( $ignoredPluginName ) && ! empty( $ignoredPluginName['Name'] ) ) {
3111 + $ignore_name = $ignoredPluginName['Name'];
3112 + }
3113 +
2861 3114 $plugin_directory = MainWP_Utility::get_dir_slug( rawurldecode( $ignoredPlugin ) );
2862 3115 ?>
2863 3116 <tr site-id="<?php echo esc_attr( $website->id ); ?>" plugin-slug="<?php echo esc_attr( rawurlencode( $ignoredPlugin ) ); ?>">
2864 3117 <?php if ( $first ) : ?>
@@ -2869,9 +3122,9 @@
2869 3122 <?php else : ?>
2870 3123 <td><div style="display:none;"><a href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&dashboard=' . $website->id ) ); ?>"><?php echo esc_html( stripslashes( $website->name ) ); ?></a></div></td>
2871 3124 <?php endif; ?>
2872 3125 <td class="collapsing"><?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); ?></td>
2873 - <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $website->id ) . '&plugin=' . esc_html( rawurlencode( $plugin_directory ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignoredPluginName ); ?></a></td>
3126 + <td><a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $website->id ) . '&plugin=' . esc_html( rawurlencode( $plugin_directory ) ); ?>" target="_blank" class="open-plugin-details-modal"><?php echo esc_html( $ignore_name ); ?></a></td>
2874 3127 <td><?php echo esc_html( $ignoredPlugin ); ?></td>
2875 3128 <td class="right aligned"><a href="#" class="ui mini button" onClick="return updatesoverview_plugins_unignore_abandoned_detail( '<?php echo esc_html( rawurlencode( $ignoredPlugin ) ); ?>', <?php echo intval( $website->id ); ?> )"> <?php esc_html_e( 'Unignore', 'mainwp' ); ?></a></td>
2876 3129 </tr>
2877 3130 <?php
@@ -2881,9 +3134,9 @@
2881 3134 MainWP_DB::free_result( $websites );
2882 3135 ?>
2883 3136 <?php endif; ?>
2884 3137 </tbody>
2885 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
3138 + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?>
2886 3139 <?php if ( 0 < $cnt ) : ?>
2887 3140 <tfoot class="full-width">
2888 3141 <tr>
2889 3142 <th scope="col" colspan="5">
@@ -2916,9 +3169,11 @@
2916 3169 <?php
2917 3170 }
2918 3171
2919 3172 /**
2920 - * Hooks the section help content to the Help Sidebar element.
3173 + * Method mainwp_help_content()
3174 + *
3175 + * Creates the MainWP Help Documentation List for the help component in the sidebar.
2921 3176 */
2922 3177 public static function mainwp_help_content() {
2923 3178 // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
2924 3179 if ( isset( $_GET['page'] ) && ( 'PluginsManage' === $_GET['page'] || 'PluginsInstall' === $_GET['page'] || 'PluginsAutoUpdate' === $_GET['page'] || 'PluginsIgnore' === $_GET['page'] || 'PluginsIgnoredAbandoned' === $_GET['page'] ) ) {
@@ -2923,17 +3178,14 @@
2923 3178 // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
2924 3179 if ( isset( $_GET['page'] ) && ( 'PluginsManage' === $_GET['page'] || 'PluginsInstall' === $_GET['page'] || 'PluginsAutoUpdate' === $_GET['page'] || 'PluginsIgnore' === $_GET['page'] || 'PluginsIgnoredAbandoned' === $_GET['page'] ) ) {
2925 3180 ?>
2926 3181 <p><?php esc_html_e( 'If you need help with managing plugins, please review following help documents', 'mainwp' ); ?></p>
2927 - <div class="ui relaxed bulleted list">
2928 - <div class="item"><a href="https://kb.mainwp.com/docs/managing-plugins-with-mainwp/" target="_blank">Managing Plugins with MainWP</a> <i class="external alternate icon"></i></div>
2929 - <div class="item"><a href="https://kb.mainwp.com/docs/install-plugins/" target="_blank">Install Plugins</a> <i class="external alternate icon"></i></div>
2930 - <div class="item"><a href="https://kb.mainwp.com/docs/activate-plugins/" target="_blank">Activate Plugins</a> <i class="external alternate icon"></i></div>
2931 - <div class="item"><a href="https://kb.mainwp.com/docs/delete-plugins/" target="_blank">Delete Plugins</a> <i class="external alternate icon"></i></div>
2932 - <div class="item"><a href="https://kb.mainwp.com/docs/abandoned-plugins/" target="_blank">Abandoned Plugins</a> <i class="external alternate icon"></i></div>
2933 - <div class="item"><a href="https://kb.mainwp.com/docs/update-plugins/" target="_blank">Update Plugins</a> <i class="external alternate icon"></i></div>
2934 - <div class="item"><a href="https://kb.mainwp.com/docs/plugins-auto-updates/" target="_blank">Plugins Auto Updates</a> <i class="external alternate icon"></i></div>
2935 - <div class="item"><a href="https://kb.mainwp.com/docs/ignore-plugin-updates/" target="_blank">Ignore Plugin Updates</a> <i class="external alternate icon"></i></div>
3182 + <div class="ui list">
3183 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp" target="_blank">Managing Plugins with MainWP</a></div>
3184 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp#install-plugins" target="_blank">Install Plugins</a></div>
3185 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp#activate-plugins" target="_blank">Activate Plugins</a></div>
3186 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp#delete-plugins" target="_blank">Delete Plugins</a></div>
3187 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/plugins/managing-plugins-with-mainwp#update-plugins" target="_blank">Update Plugins</a></div>
2936 3188 <?php
2937 3189 /**
2938 3190 * Action: mainwp_plugins_help_item
2939 3191 *