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-updates.php +690 -458 5.2 → 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_Updates
12 17 *
13 18 * @package MainWP\Dashboard
@@ -70,8 +75,15 @@
70 75 */
71 76 public static $continue_update_slug = '';
72 77
73 78 /**
79 + * Cached ignored updates counts.
80 + *
81 + * @var array $ignored_updates_counts Cached ignored updates counts.
82 + */
83 + public static $ignored_updates_counts = array();
84 +
85 + /**
74 86 * Public static varable to hold Subpages information.
75 87 *
76 88 * @var array $subPages
77 89 */
@@ -103,11 +115,11 @@
103 115 /**
104 116 * This hook allows you to render the Post page header via the 'mainwp-pageheader-updates' action.
105 117 *
106 118 * This hook is normally used in the same context of 'mainwp-getsubpages-updates'
107 - *
108 - * @see \MainWP_Updates::render_header
109 - */
119 + *
120 + * @see \MainWP_Updates::render_header
121 + */
110 122 add_action( 'mainwp-pageheader-updates', array( MainWP_Post::get_class_name(), 'render_header' ) );
111 123
112 124 /**
113 125 * This hook allows you to render the Updates page footer via the 'mainwp-pagefooter-updates' action.
@@ -118,11 +130,19 @@
118 130 */
119 131 add_action( 'mainwp-pagefooter-updates', array( MainWP_Post::get_class_name(), 'render_footer' ) );
120 132
121 133 add_action( 'mainwp_help_sidebar_content', array( static::get_class_name(), 'mainwp_help_content' ) );
134 + add_action( 'admin_init', array( static::get_class_name(), 'admin_init' ) );
122 135 }
123 136
124 137 /**
138 + * Init method.
139 + */
140 + public static function admin_init() {
141 + static::handle_post_staging_sites_view();
142 + }
143 +
144 + /**
125 145 * Renders init updates menu.
126 146 *
127 147 * @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu()
128 148 */
@@ -161,25 +181,25 @@
161 181 $label_color_translations = '';
162 182 $label_color_total = '';
163 183
164 184 if ( isset( $updates_count['plugins'] ) && 0 < $updates_count['plugins'] ) {
165 - $label_color_plugins = ' blue ';
185 + $label_color_plugins = 'green';
166 186 }
167 187
168 188 if ( isset( $updates_count['wp'] ) && 0 < $updates_count['wp'] ) {
169 - $label_color_wp = ' blue ';
189 + $label_color_wp = 'green';
170 190 }
171 191
172 192 if ( isset( $updates_count['themes'] ) && 0 < $updates_count['themes'] ) {
173 - $label_color_themes = ' blue ';
193 + $label_color_themes = 'green';
174 194 }
175 195
176 196 if ( isset( $updates_count['translations'] ) && 0 < $updates_count['translations'] ) {
177 - $label_color_translations = ' blue ';
197 + $label_color_translations = 'green';
178 198 }
179 199
180 200 if ( isset( $updates_count['total'] ) && 0 < $updates_count['total'] ) {
181 - $label_color_total = ' blue ';
201 + $label_color_total = 'green';
182 202 }
183 203
184 204 MainWP_Menu::add_left_menu(
185 205 array(
@@ -195,9 +215,9 @@
195 215 );
196 216
197 217 $init_sub_subleftmenu = array(
198 218 array(
199 - 'title' => esc_html__( 'Plugins', 'mainwp' ) . ' <span class="ui ' . $label_color_plugins . ' label">' . intval( $updates_count['plugins'] ) . '</span>',
219 + 'title' => esc_html__( 'Plugins', 'mainwp' ) . ' <span class="ui ' . $label_color_plugins . ' tiny label">' . intval( $updates_count['plugins'] ) . '</span>',
200 220 'parent_key' => 'UpdatesManage',
201 221 'href' => 'admin.php?page=UpdatesManage&tab=plugins-updates',
202 222 'slug' => 'UpdatesManage',
203 223 'right' => '',
@@ -202,9 +222,9 @@
202 222 'slug' => 'UpdatesManage',
203 223 'right' => '',
204 224 ),
205 225 array(
206 - 'title' => esc_html__( 'Themes', 'mainwp' ) . ' <span class="ui ' . $label_color_themes . ' label">' . intval( $updates_count['themes'] ) . '</span>',
226 + 'title' => esc_html__( 'Themes', 'mainwp' ) . ' <span class="ui ' . $label_color_themes . ' tiny label">' . intval( $updates_count['themes'] ) . '</span>',
207 227 'parent_key' => 'UpdatesManage',
208 228 'href' => 'admin.php?page=UpdatesManage&tab=themes-updates',
209 229 'slug' => 'UpdatesManage',
210 230 'right' => '',
@@ -209,9 +229,9 @@
209 229 'slug' => 'UpdatesManage',
210 230 'right' => '',
211 231 ),
212 232 array(
213 - 'title' => esc_html__( 'WordPress', 'mainwp' ) . ' <span class="ui ' . $label_color_wp . ' label">' . intval( $updates_count['wp'] ) . '</span>',
233 + 'title' => esc_html__( 'WordPress', 'mainwp' ) . ' <span class="ui ' . $label_color_wp . ' tiny label">' . intval( $updates_count['wp'] ) . '</span>',
214 234 'parent_key' => 'UpdatesManage',
215 235 'href' => 'admin.php?page=UpdatesManage&tab=wordpress-updates',
216 236 'slug' => 'UpdatesManage&tab=wordpress-updates',
217 237 'right' => '',
@@ -228,9 +248,9 @@
228 248
229 249 $show_language_updates = get_option( 'mainwp_show_language_updates', 1 );
230 250 if ( $show_language_updates ) {
231 251 $init_sub_subleftmenu[] = array(
232 - 'title' => esc_html__( 'Translation', 'mainwp' ) . ' <span class="ui ' . $label_color_translations . ' label">' . intval( $updates_count['translations'] ) . '</span>',
252 + 'title' => esc_html__( 'Translation', 'mainwp' ) . ' <span class="ui ' . $label_color_translations . ' tiny label">' . intval( $updates_count['translations'] ) . '</span>',
233 253 'parent_key' => 'UpdatesManage',
234 254 'href' => 'admin.php?page=UpdatesManage&tab=translations-updates',
235 255 'slug' => 'UpdatesManage&tab=translations-updates',
236 256 'right' => '',
@@ -268,9 +288,9 @@
268 288 * @return mixed Page Settings button.
269 289 */
270 290 public static function screen_options( $input ) {
271 291 return $input .
272 - '<a class="ui button basic icon" onclick="mainwp_manage_updates_screen_options(); return false;" data-inverted="" data-position="bottom right" href="#" target="_blank" data-tooltip="' . esc_html__( 'Page Settings', 'mainwp' ) . '">
292 + '<a class="ui button basic icon" onclick="mainwp_manage_updates_screen_options(); return false;" data-inverted="" data-position="bottom right" href="#" target="_blank" data-tooltip="' . esc_html__( 'Page Settings', 'mainwp' ) . '">
273 293 <i class="cog icon"></i>
274 294 </a>';
275 295 }
276 296
@@ -278,12 +298,20 @@
278 298 * Sets the MainWP Update page page title and pass it off to method MainWP_UI::render_top_header().
279 299 *
280 300 * @uses \MainWP\Dashboard\MainWP_UI::render_top_header()
281 301 */
282 - public static function render_header() {
302 + public static function render_header( $current_tab = '' ) {
283 303
304 + $title = esc_html__( 'Available Updates', 'mainwp' );
305 +
306 + if ( 'abandoned-plugins' === $current_tab ) {
307 + $title = esc_html__( 'Abandoned Plugins', 'mainwp' );
308 + } elseif ( 'abandoned-themes' === $current_tab ) {
309 + $title = esc_html__( 'Abandoned Themes', 'mainwp' );
310 + }
311 +
284 312 $params = array(
285 - 'title' => esc_html__( 'Available Updates', 'mainwp' ),
313 + 'title' => $title,
286 314 );
287 315
288 316 MainWP_UI::render_top_header( $params );
289 317 }
@@ -318,9 +346,9 @@
318 346 * @return bool Whether user can ignore updates or not.
319 347 */
320 348 public static function user_can_ignore_updates() {
321 349 if ( null === static::$user_can_ignore_updates ) {
322 - static::$user_can_ignore_updates = mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' );
350 + static::$user_can_ignore_updates = \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' );
323 351 }
324 352 return static::$user_can_ignore_updates;
325 353 }
326 354
@@ -330,9 +358,9 @@
330 358 * @return bool Whether user can update translations or not.
331 359 */
332 360 public static function user_can_update_trans() {
333 361 if ( null === static::$user_can_update_trans ) {
334 - static::$user_can_update_trans = mainwp_current_user_have_right( 'dashboard', 'update_translations' );
362 + static::$user_can_update_trans = \mainwp_current_user_can( 'dashboard', 'update_translations' );
335 363 }
336 364 return static::$user_can_update_trans;
337 365 }
338 366
@@ -342,9 +370,9 @@
342 370 * @return bool Whether user can update WordPress or not.
343 371 */
344 372 public static function user_can_update_wp() {
345 373 if ( null === static::$user_can_update_wp ) {
346 - static::$user_can_update_wp = mainwp_current_user_have_right( 'dashboard', 'update_wordpress' );
374 + static::$user_can_update_wp = \mainwp_current_user_can( 'dashboard', 'update_wordpress' );
347 375 }
348 376 return static::$user_can_update_wp;
349 377 }
350 378
@@ -354,9 +382,9 @@
354 382 * @return bool Whether user can update themes or not.
355 383 */
356 384 public static function user_can_update_themes() {
357 385 if ( null === static::$user_can_update_themes ) {
358 - static::$user_can_update_themes = mainwp_current_user_have_right( 'dashboard', 'update_themes' );
386 + static::$user_can_update_themes = \mainwp_current_user_can( 'dashboard', 'update_themes' );
359 387 }
360 388 return static::$user_can_update_themes;
361 389 }
362 390
@@ -366,9 +394,9 @@
366 394 * @return bool Whether user can update plugins or not.
367 395 */
368 396 public static function user_can_update_plugins() {
369 397 if ( null === static::$user_can_update_plugins ) {
370 - static::$user_can_update_plugins = mainwp_current_user_have_right( 'dashboard', 'update_plugins' );
398 + static::$user_can_update_plugins = \mainwp_current_user_can( 'dashboard', 'update_plugins' );
371 399 }
372 400 return static::$user_can_update_plugins;
373 401 }
374 402
@@ -374,8 +402,10 @@
374 402
375 403 /**
376 404 * Renders updates page.
377 405 *
406 + * @param string $abandoned_tab Render abandoned plugins|themes tab, abandoned_plugins|abandoned_themes.
407 + *
378 408 * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension()
379 409 * @uses \MainWP\Dashboard\MainWP_DB_Common::get_groups_for_current_user()
380 410 * @uses \MainWP\Dashboard\MainWP_DB::get_websites_by_group_id()
381 411 * @uses \MainWP\Dashboard\MainWP_DB::get_website_option()
@@ -382,9 +412,9 @@
382 412 * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
383 413 * @uses \MainWP\Dashboard\MainWP_DB::data_seek()
384 414 * @uses \MainWP\Dashboard\MainWP_Utility::array_sort()
385 415 */
386 - public static function render() { // phpcs:ignore Generic.Metrics.CyclomaticComplexity -- NOSONAR - current complexity is the only way to achieve desired results, pull request solutions appreciated.
416 + public static function render( $abandoned_tab = '' ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity -- NOSONAR - current complexity is the only way to achieve desired results, pull request solutions appreciated.
387 417
388 418 static::handle_limit_sites();
389 419
390 420 $websites = static::get_sites_for_current_user();
@@ -429,10 +459,10 @@
429 459 $all_groups[0] = esc_html__( 'Others', 'mainwp' );
430 460 }
431 461 }
432 462
433 - $decodedDismissedPlugins = json_decode( $userExtension->dismissed_plugins, true );
434 - $decodedDismissedThemes = json_decode( $userExtension->dismissed_themes, true );
463 + $decodedDismissedPlugins = ! empty( $userExtension->dismissed_plugins ) ? json_decode( $userExtension->dismissed_plugins, true ) : array();
464 + $decodedDismissedThemes = ! empty( $userExtension->dismissed_themes ) ? json_decode( $userExtension->dismissed_themes, true ) : array();
435 465 $decodedDismissedCores = ! empty( $userExtension->ignored_wp_upgrades ) ? json_decode( $userExtension->ignored_wp_upgrades, true ) : array();
436 466
437 467 $total_wp_upgrades = 0;
438 468 $total_plugin_upgrades = 0;
@@ -468,8 +498,12 @@
468 498 }
469 499
470 500 $translation_upgrades = json_decode( $website->translation_upgrades, true );
471 501
502 + if ( ! empty( $website->ignored_trans_updates ) ) {
503 + $translation_upgrades = array();
504 + }
505 +
472 506 $plugin_upgrades = json_decode( $website->plugin_upgrades, true );
473 507 if ( $website->is_ignorePluginUpdates ) {
474 508 $plugin_upgrades = array();
475 509 }
@@ -492,9 +526,9 @@
492 526 }
493 527 if ( ! $website->is_ignorePluginUpdates ) {
494 528 $premiumUpgrade = array_filter( $premiumUpgrade );
495 529 if ( ! isset( $plugin_upgrades[ $crrSlug ] ) ) {
496 - $plugin_upgrades[ $crrSlug ] = array();
530 + continue; // to fix missing update name.
497 531 }
498 532 $plugin_upgrades[ $crrSlug ] = array_merge( $plugin_upgrades[ $crrSlug ], $premiumUpgrade );
499 533 }
500 534 } elseif ( 'theme' === $premiumUpgrade['type'] ) {
@@ -527,14 +561,14 @@
527 561
528 562 if ( is_array( $theme_upgrades ) ) {
529 563 $_ignored_themes = json_decode( $website->ignored_themes, true );
530 564 if ( is_array( $_ignored_themes ) ) {
531 - $theme_upgrades = array_diff_key( $theme_upgrades, $_ignored_themes );
565 + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $_ignored_themes );
532 566 }
533 567
534 568 $_ignored_themes = json_decode( $userExtension->ignored_themes, true );
535 569 if ( is_array( $_ignored_themes ) ) {
536 - $theme_upgrades = array_diff_key( $theme_upgrades, $_ignored_themes );
570 + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $_ignored_themes );
537 571 }
538 572
539 573 $total_theme_upgrades += count( $theme_upgrades );
540 574 }
@@ -580,8 +614,38 @@
580 614
581 615 $total_themes_outdate += count( $themes_outdate );
582 616 }
583 617
618 + // to fix displaying per sites/tags.
619 + if ( is_array( $plugins_outdate ) ) {
620 + foreach ( $plugins_outdate as $slug => $plugin_outdate ) {
621 + $slug = esc_html( $slug );
622 + if ( ! isset( $allPluginsOutdate[ $slug ] ) ) {
623 + $allPluginsOutdate[ $slug ] = array(
624 + 'name' => esc_html( $plugin_outdate['Name'] ),
625 + 'cnt' => 1,
626 + 'uri' => esc_html( $plugin_outdate['PluginURI'] ),
627 + );
628 + } else {
629 + ++$allPluginsOutdate[ $slug ]['cnt'];
630 + }
631 + }
632 + }
633 +
634 + if ( is_array( $themes_outdate ) ) {
635 + foreach ( $themes_outdate as $slug => $theme_outdate ) {
636 + $slug = esc_html( $slug );
637 + if ( ! isset( $allThemesOutdate[ $slug ] ) ) {
638 + $allThemesOutdate[ $slug ] = array(
639 + 'name' => esc_html( $theme_outdate['Name'] ),
640 + 'cnt' => 1,
641 + );
642 + } else {
643 + ++$allThemesOutdate[ $slug ]['cnt'];
644 + }
645 + }
646 + }
647 +
584 648 if ( MAINWP_VIEW_PER_PLUGIN_THEME === $site_view ) {
585 649 if ( is_array( $translation_upgrades ) ) {
586 650 foreach ( $translation_upgrades as $translation_upgrade ) {
587 651 $slug = esc_html( $translation_upgrade['slug'] );
@@ -633,43 +697,20 @@
633 697 } else {
634 698 ++$allThemes[ $slug ]['cnt'];
635 699 }
636 700
701 + $up_th_name = isset( $theme_upgrade['Name'] ) ? esc_html( $theme_upgrade['Name'] ) : '';
702 +
703 + if ( empty( $up_th_name ) ) {
704 + $up_th_name = isset( $theme_upgrade['name'] ) ? esc_html( $theme_upgrade['name'] ) : 'N/A';
705 + }
706 +
637 707 $themesInfo[ $slug ] = array(
638 - 'name' => esc_html( $theme_upgrade['Name'] ),
708 + 'name' => $up_th_name,
639 709 'premium' => ( isset( $theme_upgrade['premium'] ) ? esc_html( $theme_upgrade['premium'] ) : 0 ),
640 710 );
641 711 }
642 712 }
643 -
644 - if ( is_array( $plugins_outdate ) ) {
645 - foreach ( $plugins_outdate as $slug => $plugin_outdate ) {
646 - $slug = esc_html( $slug );
647 - if ( ! isset( $allPluginsOutdate[ $slug ] ) ) {
648 - $allPluginsOutdate[ $slug ] = array(
649 - 'name' => esc_html( $plugin_outdate['Name'] ),
650 - 'cnt' => 1,
651 - 'uri' => esc_html( $plugin_outdate['PluginURI'] ),
652 - );
653 - } else {
654 - ++$allPluginsOutdate[ $slug ]['cnt'];
655 - }
656 - }
657 - }
658 -
659 - if ( is_array( $themes_outdate ) ) {
660 - foreach ( $themes_outdate as $slug => $theme_outdate ) {
661 - $slug = esc_html( $slug );
662 - if ( ! isset( $allThemesOutdate[ $slug ] ) ) {
663 - $allThemesOutdate[ $slug ] = array(
664 - 'name' => esc_html( $theme_outdate['Name'] ),
665 - 'cnt' => 1,
666 - );
667 - } else {
668 - ++$allThemesOutdate[ $slug ]['cnt'];
669 - }
670 - }
671 - }
672 713 }
673 714
674 715 if ( '' !== $website->sync_errors ) {
675 716 ++$total_sync_errors;
@@ -748,26 +789,33 @@
748 789 $current_tab = '';
749 790
750 791 if ( isset( $_GET['tab'] ) ) {
751 792 $current_tab = sanitize_text_field( wp_unslash( $_GET['tab'] ) );
752 - if ( ! in_array( $current_tab, array( 'wordpress-updates', 'updates-ignore', 'plugins-updates', 'themes-updates', 'translations-updates', 'abandoned-plugins', 'abandoned-themes', true ) ) ) {
793 + if ( ! in_array( $current_tab, array( 'wordpress-updates', 'updates-ignore', 'plugins-updates', 'themes-updates', 'translations-updates', true ) ) ) {
753 794 $current_tab = 'plugins-updates';
754 795 }
755 - } else {
796 + } elseif ( 'abandoned_plugins' === $abandoned_tab ) {
797 + $current_tab = 'abandoned-plugins';
798 + } elseif ( 'abandoned_themes' === $abandoned_tab ) {
799 + $current_tab = 'abandoned-themes';
800 + }
801 +
802 + if ( empty( $current_tab ) ) {
756 803 $current_tab = 'plugins-updates';
757 804 }
805 +
758 806 // phpcs:enable
759 - static::render_header( 'UpdatesManage' );
807 + static::render_header( $current_tab );
760 808
761 809 static::render_header_tabs( $mainwp_show_language_updates, $current_tab, $total_wp_upgrades, $total_plugin_upgrades, $total_theme_upgrades, $total_translation_upgrades, $total_plugins_outdate, $total_themes_outdate, $site_view );
762 810
763 811 ?>
764 - <div class="ui segment" id="mainwp-manage-updates">
765 - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-manage-updates-message' ) ) { ?>
812 + <div class="ui padded segment" id="mainwp-manage-updates">
813 + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-manage-updates-message' ) ) { ?>
766 814 <div class="ui info message">
767 815 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-manage-updates-message"></i>
768 - <div><?php printf( esc_html__( 'Manage available updates for all your child sites. From here, you can update update %1$splugins%2$s, %3$sthemes%4$s, and %5$sWordPress core%6$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/update-plugins/" target="_blank">', '</a>', '<a href="https://kb.mainwp.com/docs/update-themes/" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://kb.mainwp.com/docs/update-wordpress-core/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></div>
769 - <div><?php printf( esc_html__( 'Also, from here, you can ignore updates for %1$sWordPress core%2$s, %3$splugins%4$s, and %5$sthemes%6$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/ignore-wordpress-core-update/" target="_blank">', '</a>', '<a href="https://kb.mainwp.com/docs/ignore-plugin-updates/" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://kb.mainwp.com/docs/ignore-theme-updates/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></div>
816 + <div><?php /* translators: 1: opening anchor tag for plugins, 2: closing anchor tag, 3: opening anchor tag for themes, 4: closing anchor tag with icon, 5: opening anchor tag for WordPress core, 6: closing anchor tag with icon */ printf( esc_html__( 'Manage available updates for all your child sites. From here, you can update update %1$splugins%2$s, %3$sthemes%4$s, and %5$sWordPress core%6$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/updates/manage-updates#plugin-updates" target="_blank">', '</a>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#theme-updates" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#wordpress-core-updates" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></div>
817 + <div><?php /* translators: 1: opening anchor tag for WordPress core, 2: closing anchor tag with icon, 3: opening anchor tag for plugins, 4: closing anchor tag with icon, 5: opening anchor tag for themes, 6: closing anchor tag with icon */ printf( esc_html__( 'Also, from here, you can ignore updates for %1$sWordPress core%2$s, %3$splugins%4$s, and %5$sthemes%6$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/updates/manage-updates#wordpress-core-updates" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-plugin-updates" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-theme-updates" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></div>
770 818 </div>
771 819 <?php } ?>
772 820 <?php
773 821
@@ -799,8 +847,9 @@
799 847
800 848 static::render_plugin_details_modal();
801 849 MainWP_UI::render_modal_upload_icon();
802 850 static::render_screen_options_modal();
851 + static::render_changes_history_modal();
803 852 static::render_footer();
804 853 ?>
805 854 <script type="text/javascript">
806 855 mainwp_manage_updates_screen_options = function () {
@@ -831,13 +880,28 @@
831 880 */
832 881 public static function render_wp_update_tab( $websites, $userExtension, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups, $site_view ) {
833 882 ?>
834 883 <div class="ui active tab" data-tab="wordpress-updates">
835 - <?php
884 + <?php
885 + /**
886 + * Action: mainwp_updates_before_wp_updates
887 + *
888 + * Fires at the top of the WP updates tab.
889 + *
890 + * @param object $websites Object containing child sites info.
891 + * @param int $total_wp_upgrades Number of available WP upates.
892 + * @param array $all_groups_sites Array containing all groups and sites.
893 + * @param array $all_groups Array containing all groups.
894 + * @param int $site_offset_for_groups Offset value.
895 + *
896 + * @since 4.1
897 + */
898 + do_action( 'mainwp_updates_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
899 + if ( MAINWP_VIEW_PER_GROUP === $site_view ) {
836 900 /**
837 - * Action: mainwp_updates_before_wp_updates
901 + * Action: mainwp_updates_pergroup_before_wp_updates
838 902 *
839 - * Fires at the top of the WP updates tab.
903 + * Fires at the top of the WP updates tab, per Group view.
840 904 *
841 905 * @param object $websites Object containing child sites info.
842 906 * @param int $total_wp_upgrades Number of available WP upates.
843 907 * @param array $all_groups_sites Array containing all groups and sites.
@@ -845,75 +909,14 @@
845 909 * @param int $site_offset_for_groups Offset value.
846 910 *
847 911 * @since 4.1
848 912 */
849 - do_action( 'mainwp_updates_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
850 - if ( MAINWP_VIEW_PER_GROUP === $site_view ) {
851 - /**
852 - * Action: mainwp_updates_pergroup_before_wp_updates
853 - *
854 - * Fires at the top of the WP updates tab, per Group view.
855 - *
856 - * @param object $websites Object containing child sites info.
857 - * @param int $total_wp_upgrades Number of available WP upates.
858 - * @param array $all_groups_sites Array containing all groups and sites.
859 - * @param array $all_groups Array containing all groups.
860 - * @param int $site_offset_for_groups Offset value.
861 - *
862 - * @since 4.1
863 - */
864 - do_action( 'mainwp_updates_pergroup_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
865 - MainWP_Updates_Per_Group::render_wpcore_updates( $websites, $userExtension, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
866 - /**
867 - * Action: mainwp_updates_pergroup_after_wp_updates
868 - *
869 - * Fires at the bottom of the WP updates tab, per Group view.
870 - *
871 - * @param object $websites Object containing child sites info.
872 - * @param int $total_wp_upgrades Number of available WP upates.
873 - * @param array $all_groups_sites Array containing all groups and sites.
874 - * @param array $all_groups Array containing all groups.
875 - * @param int $site_offset_for_groups Offset value.
876 - *
877 - * @since 4.1
878 - */
879 - do_action( 'mainwp_updates_pergroup_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
880 - } else {
881 - /**
882 - * Action: mainwp_updates_persite_before_wp_updates
883 - *
884 - * Fires at the top of the WP updates tab, per Site view.
885 - *
886 - * @param object $websites Object containing child sites info.
887 - * @param int $total_wp_upgrades Number of available WP upates.
888 - * @param array $all_groups_sites Array containing all groups and sites.
889 - * @param array $all_groups Array containing all groups.
890 - * @param int $site_offset_for_groups Offset value.
891 - *
892 - * @since 4.1
893 - */
894 - do_action( 'mainwp_updates_pergroup_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
895 - MainWP_DB::data_seek( $websites, 0 );
896 - MainWP_Updates_Per_Site::render_wpcore_updates( $websites, $userExtension, $total_wp_upgrades );
897 - /**
898 - * Action: mainwp_updates_persite_after_wp_updates
899 - *
900 - * Fires at the bottom of the WP updates tab, per Site view.
901 - *
902 - * @param object $websites Object containing child sites info.
903 - * @param int $total_wp_upgrades Number of available WP upates.
904 - * @param array $all_groups_sites Array containing all groups and sites.
905 - * @param array $all_groups Array containing all groups.
906 - * @param int $site_offset_for_groups Offset value.
907 - *
908 - * @since 4.1
909 - */
910 - do_action( 'mainwp_updates_persite_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
911 - }
913 + do_action( 'mainwp_updates_pergroup_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
914 + MainWP_Updates_Per_Group::render_wpcore_updates( $websites, $userExtension, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
912 915 /**
913 - * Action: mainwp_updates_after_wp_updates
916 + * Action: mainwp_updates_pergroup_after_wp_updates
914 917 *
915 - * Fires at the top of the WP updates tab.
918 + * Fires at the bottom of the WP updates tab, per Group view.
916 919 *
917 920 * @param object $websites Object containing child sites info.
918 921 * @param int $total_wp_upgrades Number of available WP upates.
919 922 * @param array $all_groups_sites Array containing all groups and sites.
@@ -921,10 +924,56 @@
921 924 * @param int $site_offset_for_groups Offset value.
922 925 *
923 926 * @since 4.1
924 927 */
925 - do_action( 'mainwp_updates_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
926 - ?>
928 + do_action( 'mainwp_updates_pergroup_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
929 + } else {
930 + /**
931 + * Action: mainwp_updates_persite_before_wp_updates
932 + *
933 + * Fires at the top of the WP updates tab, per Site view.
934 + *
935 + * @param object $websites Object containing child sites info.
936 + * @param int $total_wp_upgrades Number of available WP upates.
937 + * @param array $all_groups_sites Array containing all groups and sites.
938 + * @param array $all_groups Array containing all groups.
939 + * @param int $site_offset_for_groups Offset value.
940 + *
941 + * @since 4.1
942 + */
943 + do_action( 'mainwp_updates_pergroup_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
944 + MainWP_DB::data_seek( $websites, 0 );
945 + MainWP_Updates_Per_Site::render_wpcore_updates( $websites, $userExtension, $total_wp_upgrades );
946 + /**
947 + * Action: mainwp_updates_persite_after_wp_updates
948 + *
949 + * Fires at the bottom of the WP updates tab, per Site view.
950 + *
951 + * @param object $websites Object containing child sites info.
952 + * @param int $total_wp_upgrades Number of available WP upates.
953 + * @param array $all_groups_sites Array containing all groups and sites.
954 + * @param array $all_groups Array containing all groups.
955 + * @param int $site_offset_for_groups Offset value.
956 + *
957 + * @since 4.1
958 + */
959 + do_action( 'mainwp_updates_persite_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
960 + }
961 + /**
962 + * Action: mainwp_updates_after_wp_updates
963 + *
964 + * Fires at the top of the WP updates tab.
965 + *
966 + * @param object $websites Object containing child sites info.
967 + * @param int $total_wp_upgrades Number of available WP upates.
968 + * @param array $all_groups_sites Array containing all groups and sites.
969 + * @param array $all_groups Array containing all groups.
970 + * @param int $site_offset_for_groups Offset value.
971 + *
972 + * @since 4.1
973 + */
974 + do_action( 'mainwp_updates_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
975 + ?>
927 976 </div>
928 977 <?php
929 978 }
930 979
@@ -998,9 +1047,9 @@
998 1047 *
999 1048 * @since 4.1
1000 1049 */
1001 1050 do_action( 'mainwp_updates_persite_before_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups );
1002 - MainWP_Updates_Per_Site::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $trustedPlugins );
1051 + MainWP_Updates_Per_Site::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $trustedPlugins );
1003 1052 /**
1004 1053 * Action: mainwp_updates_persite_after_plugin_updates
1005 1054 *
1006 1055 * Fires at the bottom of the Plugin updates tab, per Site view.
@@ -1034,9 +1083,9 @@
1034 1083 *
1035 1084 * @since 4.1
1036 1085 */
1037 1086 do_action( 'mainwp_updates_pergroup_before_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups );
1038 - MainWP_Updates_Per_Group::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $site_offset_for_groups, $trustedPlugins );
1087 + MainWP_Updates_Per_Group::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $site_offset_for_groups, $trustedPlugins );
1039 1088 /**
1040 1089 * Action: mainwp_updates_pergroup_after_plugin_updates
1041 1090 *
1042 1091 * Fires at the bottom of the Plugin updates tab, per Group view.
@@ -1070,9 +1119,9 @@
1070 1119 *
1071 1120 * @since 4.1
1072 1121 */
1073 1122 do_action( 'mainwp_updates_perplugin_before_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups );
1074 - MainWP_Updates_Per_Item::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $allPlugins, $pluginsInfo, $trustedPlugins );
1123 + MainWP_Updates_Per_Item::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $allPlugins, $pluginsInfo, $trustedPlugins );
1075 1124 /**
1076 1125 * Action: mainwp_updates_perplugin_after_plugin_updates
1077 1126 *
1078 1127 * Fires at the bottom of the Plugin updates tab, per Plugin view.
@@ -1342,9 +1391,9 @@
1342 1391 *
1343 1392 * @since 4.1
1344 1393 */
1345 1394 do_action( 'mainwp_updates_persite_before_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups );
1346 - MainWP_Updates_Per_Site::render_trans_update( $websites, $total_translation_upgrades );
1395 + MainWP_Updates_Per_Site::render_trans_update( $websites, $total_translation_upgrades, $userExtension );
1347 1396 /**
1348 1397 * Action: mainwp_updates_persite_after_translation_updates
1349 1398 *
1350 1399 * Fires at the bottom of the Translation updates tab, per Site view.
@@ -1378,9 +1427,9 @@
1378 1427 *
1379 1428 * @since 4.1
1380 1429 */
1381 1430 do_action( 'mainwp_updates_pergroup_before_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups );
1382 - MainWP_Updates_Per_Group::render_trans_update( $websites, $total_translation_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups );
1431 + MainWP_Updates_Per_Group::render_trans_update( $websites, $total_translation_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups, $userExtension );
1383 1432 /**
1384 1433 * Action: mainwp_updates_pergroup_after_translation_updates
1385 1434 *
1386 1435 * Fires at the bottom of the Translation updates tab, per Group view.
@@ -1506,9 +1555,9 @@
1506 1555 *
1507 1556 * @since 4.1
1508 1557 */
1509 1558 do_action( 'mainwp_updates_persite_before_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups );
1510 - MainWP_Updates_Per_Site::render_abandoned_plugins( $websites, $decodedDismissedPlugins );
1559 + MainWP_Updates_Per_Site::render_abandoned_plugins( $websites, $allPluginsOutdate, $decodedDismissedPlugins );
1511 1560 /**
1512 1561 * Action: mainwp_updates_persite_after_abandoned_plugins
1513 1562 *
1514 1563 * Fires at the bottom of the Abandoned plugins tab, per Site view.
@@ -1538,9 +1587,9 @@
1538 1587 *
1539 1588 * @since 4.1
1540 1589 */
1541 1590 do_action( 'mainwp_updates_pergroup_before_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups );
1542 - MainWP_Updates_Per_Group::render_abandoned_plugins( $websites, $all_groups_sites, $all_groups, $site_offset_for_groups, $decodedDismissedPlugins );
1591 + MainWP_Updates_Per_Group::render_abandoned_plugins( $websites, $allPluginsOutdate, $all_groups_sites, $all_groups, $site_offset_for_groups, $decodedDismissedPlugins );
1543 1592 /**
1544 1593 * Action: mainwp_updates_pergroup_after_abandoned_plugins
1545 1594 *
1546 1595 * Fires at the bottom of the Abandoned plugins tab, per Group view.
@@ -1657,9 +1706,9 @@
1657 1706 *
1658 1707 * @since 4.1
1659 1708 */
1660 1709 do_action( 'mainwp_updates_persite_before_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups );
1661 - MainWP_Updates_Per_Site::render_abandoned_themes( $websites, $decodedDismissedThemes );
1710 + MainWP_Updates_Per_Site::render_abandoned_themes( $websites, $allThemesOutdate, $decodedDismissedThemes );
1662 1711 /**
1663 1712 * Action: mainwp_updates_persite_after_abandoned_themes
1664 1713 *
1665 1714 * Fires at the bottom of the Abandoned themes tab, per Site view.
@@ -1689,9 +1738,9 @@
1689 1738 *
1690 1739 * @since 4.1
1691 1740 */
1692 1741 do_action( 'mainwp_updates_pergroup_before_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups );
1693 - MainWP_Updates_Per_Group::render_abandoned_themes( $websites, $all_groups_sites, $all_groups, $site_offset_for_groups, $decodedDismissedThemes );
1742 + MainWP_Updates_Per_Group::render_abandoned_themes( $websites, $allThemesOutdate, $all_groups_sites, $all_groups, $site_offset_for_groups, $decodedDismissedThemes );
1694 1743 /**
1695 1744 * Action: mainwp_updates_pergroup_after_abandoned_themes
1696 1745 *
1697 1746 * Fires at the bottom of the Abandoned themes tab, per Group view.
@@ -1782,9 +1831,9 @@
1782 1831 */
1783 1832 $table_features = apply_filters( 'mainwp_updates_table_features', $table_features );
1784 1833 ?>
1785 1834 <script type="text/javascript">
1786 - jQuery( document ).ready( function () {
1835 + jQuery( document ).ready( function ($) {
1787 1836 jQuery( '#mainwp-manage-updates .ui.accordion' ).accordion( {
1788 1837 "exclusive": <?php echo esc_html( $table_features['exclusive'] ); ?>,
1789 1838 "duration": <?php echo esc_html( $table_features['duration'] ); ?>,
1790 1839 onOpen: function(){
@@ -1790,14 +1839,35 @@
1790 1839 onOpen: function(){
1791 1840 //mainwp_datatable_init_and_fix_recalc('table.mainwp-manage-updates-item-table');
1792 1841 }
1793 1842 } );
1843 +
1844 + $('table.mainwp-js-persistent-table').each(function () {
1845 + const table = this; // DOM element
1846 + new TablePersistentState(table, {
1847 + headerSelector: '.handle-accordion-sorting',
1848 + onPersist:function( { table, column, direction, isrestore } ){
1849 + if(isrestore){
1850 + const $th = $(table).find(
1851 + `.handle-accordion-sorting[data-key="${column}"]` // header column must have data-key property.
1852 + );
1853 + if (!$th) return;
1854 + setTimeout(function () {// to fix binding delay issue.
1855 + $($th).trigger('click');
1856 + if(direction === 'desc'){
1857 + $($th).trigger('click');
1858 + }
1859 + }, 500);
1860 + }
1861 + }
1862 + });
1863 + });
1864 +
1794 1865 } );
1795 1866
1796 1867 mainwp_datatable_init_and_fix_recalc = function(selector){
1797 1868 jQuery(selector).each( function(e) {
1798 1869 if(jQuery(this).is(":visible")){
1799 - console.log('visible ' + jQuery(this).attr('id'));
1800 1870 jQuery(this).css( 'display', 'table' );
1801 1871 jQuery(this).DataTable().destroy();
1802 1872 let tb = jQuery(this).DataTable({
1803 1873 "paging":false,
@@ -1811,8 +1881,10 @@
1811 1881 }
1812 1882 });
1813 1883 }
1814 1884
1885 +
1886 +
1815 1887 jQuery( document ).on( 'click', '.trigger-all-accordion', function() {
1816 1888 if ( jQuery( this ).hasClass( 'active' ) ) {
1817 1889 jQuery( this ).removeClass( 'active' );
1818 1890 jQuery( '#mainwp-manage-updates .ui.accordion tr.title' ).each( function( i ) {
@@ -1866,20 +1938,21 @@
1866 1938 global $current_user;
1867 1939
1868 1940 $current_wpid = MainWP_System_Utility::get_current_wpid();
1869 1941 if ( $current_wpid ) {
1870 - $sql = MainWP_DB::instance()->get_sql_website_by_id( $current_wpid, false, array( 'premium_upgrades', 'plugins_outdate_dismissed', 'themes_outdate_dismissed', 'plugins_outdate_info', 'themes_outdate_info', 'favi_icon' ) );
1942 + $sql = MainWP_DB::instance()->get_sql_website_by_id( $current_wpid, false, array( 'premium_upgrades', 'plugins_outdate_dismissed', 'themes_outdate_dismissed', 'ignored_wp_upgrades', 'ignored_trans_updates', 'plugins_outdate_info', 'themes_outdate_info', 'favi_icon', 'site_info' ) );
1871 1943 } else {
1872 1944 $staging_enabled = is_plugin_active( 'mainwp-staging-extension/mainwp-staging-extension.php' ) || is_plugin_active( 'mainwp-timecapsule-extension/mainwp-timecapsule-extension.php' );
1873 1945 $is_staging = 'no';
1874 1946 if ( $staging_enabled ) {
1875 - $staging_updates_view = MainWP_System_Utility::get_staging_options_sites_view_for_current_users();
1947 + $staging_updates_view = MainWP_System_Utility::get_select_staging_view_sites();
1876 1948 if ( 'staging' === $staging_updates_view ) {
1877 1949 $is_staging = 'yes';
1878 1950 }
1879 1951 }
1880 1952 $params = array(
1881 - 'connected' => 'yes',
1953 + 'connected' => 'yes',
1954 + 'maybe_cache' => true,
1882 1955 );
1883 1956
1884 1957 $limit_sites = get_option( 'mainwp_manage_updates_limit_sites' );
1885 1958 if ( ! empty( $limit_sites ) ) {
@@ -1884,9 +1957,9 @@
1884 1957 $limit_sites = get_option( 'mainwp_manage_updates_limit_sites' );
1885 1958 if ( ! empty( $limit_sites ) ) {
1886 1959 $params['limit_sites'] = $limit_sites;
1887 1960 }
1888 - $sql = MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, false, array( 'wp_upgrades', 'ignored_wp_upgrades', 'premium_upgrades', 'plugins_outdate_dismissed', 'themes_outdate_dismissed', 'plugins_outdate_info', 'themes_outdate_info', 'favi_icon' ), $is_staging, $params );
1961 + $sql = MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, false, array( 'wp_upgrades', 'ignored_wp_upgrades', 'ignored_trans_updates', 'premium_upgrades', 'rollback_updates_data', 'plugins_outdate_dismissed', 'themes_outdate_dismissed', 'plugins_outdate_info', 'themes_outdate_info', 'favi_icon', 'site_info' ), $is_staging, $params );
1889 1962 }
1890 1963 return MainWP_DB::instance()->query( $sql );
1891 1964 }
1892 1965
@@ -1916,14 +1989,14 @@
1916 1989
1917 1990 $header_tabs = array(
1918 1991 'plugins-updates' => array(
1919 1992 'slug' => 'plugins-updates',
1920 - 'title' => esc_html__( 'Plugins Updates', 'mainwp' ),
1993 + 'title' => esc_html__( 'Plugin Updates', 'mainwp' ),
1921 1994 'total_upgrades' => $total_plugin_upgrades,
1922 1995 ),
1923 1996 'themes-updates' => array(
1924 1997 'slug' => 'themes-updates',
1925 - 'title' => esc_html__( 'Themes Updates', 'mainwp' ),
1998 + 'title' => esc_html__( 'Theme Updates', 'mainwp' ),
1926 1999 'total_upgrades' => $total_theme_upgrades,
1927 2000 ),
1928 2001 'wordpress-updates' => array(
1929 2002 'slug' => 'wordpress-updates',
@@ -1956,18 +2029,18 @@
1956 2029
1957 2030 ?>
1958 2031 <div id="mainwp-page-navigation-wrapper">
1959 2032 <div class="ui vertical menu mainwp-page-navigation">
1960 - <?php
1961 - foreach ( $header_tabs as $slug => $tab ) {
1962 - if ( empty( $tab['title'] ) ) {
1963 - continue;
1964 - }
1965 - ?>
2033 + <?php
2034 + foreach ( $header_tabs as $slug => $tab ) {
2035 + if ( empty( $tab['title'] ) ) {
2036 + continue;
2037 + }
2038 + ?>
1966 2039 <a class="<?php echo $slug === $current_tab ? 'active' : ''; ?> item" data-tab="<?php echo esc_html( $slug ); ?>" href="admin.php?page=UpdatesManage&tab=<?php echo esc_html( $slug ); ?>"><?php echo esc_html( $tab['title'] ); ?><div class="ui small <?php echo empty( $tab['total_upgrades'] ) ? 'green' : 'red'; ?> label" timestamp="<?php echo esc_html( time() ); ?>"><?php echo intval( $tab['total_upgrades'] ); ?></div></a>
1967 2040 <?php
1968 - }
1969 - ?>
2041 + }
2042 + ?>
1970 2043 </div>
1971 2044 </div>
1972 2045 <?php
1973 2046
@@ -1974,8 +2047,33 @@
1974 2047 $hide_show_updates_per = 'updates-ignore' === $current_tab ? true : false;
1975 2048
1976 2049 $hide_show_updates_per = apply_filters( 'mainwp_updates_hide_show_updates_per', $hide_show_updates_per, $current_tab );
1977 2050
2051 + $show_select_staging_sites = is_plugin_active( 'mainwp-staging-extension/mainwp-staging-extension.php' );
2052 + $has_ignored_updates = in_array(
2053 + $current_tab,
2054 + array( 'wordpress-updates', 'plugins-updates', 'themes-updates' ),
2055 + true
2056 + ) && 0 < static::get_ignored_updates_count( $current_tab );
2057 + $show_updates_actions_bar = $has_ignored_updates
2058 + || ( 'plugins-updates' === $current_tab && 0 < $total_plugin_upgrades )
2059 + || ( 'themes-updates' === $current_tab && 0 < $total_theme_upgrades )
2060 + || ( 'wordpress-updates' === $current_tab && 0 < $total_wp_upgrades )
2061 + || ( 'translations-updates' === $current_tab && 0 < $total_translation_upgrades )
2062 + || 'abandoned-plugins' === $current_tab
2063 + || 'abandoned-themes' === $current_tab;
2064 + $current_tab_updates_count = 0;
2065 +
2066 + if ( 'plugins-updates' === $current_tab ) {
2067 + $current_tab_updates_count = $total_plugin_upgrades;
2068 + } elseif ( 'themes-updates' === $current_tab ) {
2069 + $current_tab_updates_count = $total_theme_upgrades;
2070 + } elseif ( 'wordpress-updates' === $current_tab ) {
2071 + $current_tab_updates_count = $total_wp_upgrades;
2072 + } elseif ( 'translations-updates' === $current_tab ) {
2073 + $current_tab_updates_count = $total_translation_upgrades;
2074 + }
2075 +
1978 2076 /**
1979 2077 * Action: mainwp_updates_after_nav_tabs
1980 2078 *
1981 2079 * Fires after the navigation tabs on the Updates page.
@@ -1991,121 +2089,352 @@
1991 2089 *
1992 2090 * @since 4.1
1993 2091 */
1994 2092 do_action( 'mainwp_updates_before_actions_bar' );
2093 + ?>
1995 2094
1996 - if ( ! $hide_show_updates_per ) {
1997 - $is_demo = MainWP_Demo_Handle::is_demo_mode();
1998 - ?>
1999 - <div class="mainwp-sub-header">
2000 - <div class="ui grid">
2001 - <div class="equal width row">
2002 - <div class="middle aligned column">
2003 - <form method="post" action="" class="ui mini form">
2004 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
2005 - <div class="inline field">
2006 - <select class="ui dropdown" onchange="mainwp_siteview_onchange(this)" id="mainwp_select_options_siteview" name="select_mainwp_options_siteview">
2007 - <option value="1" class="item" <?php echo MAINWP_VIEW_PER_SITE === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Site', 'mainwp' ); ?></option>
2008 - <option value="0" class="item" <?php echo MAINWP_VIEW_PER_PLUGIN_THEME === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Item', 'mainwp' ); ?></option>
2009 - <option value="2" class="item" <?php echo MAINWP_VIEW_PER_GROUP === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Tag', 'mainwp' ); ?></option>
2010 - </select>
2011 - </div>
2012 - </form>
2095 + <?php if ( ! $hide_show_updates_per || $show_select_staging_sites ) : ?>
2096 + <?php if ( $show_updates_actions_bar ) : ?>
2097 + <div class="mainwp-sub-header">
2098 + <div class="ui three column grid">
2099 + <div class="left aligned middle aligned column">
2100 + <?php static::render_updates_view_options( $site_view ); ?>
2101 + <?php
2102 + if ( $show_select_staging_sites ) {
2103 + static::render_select_staging_sites_view();
2104 + }
2105 + ?>
2106 + </div>
2107 + <div class="center aligned middle aligned column"></div>
2108 + <div class="right aligned middle aligned column">
2109 + <?php
2110 + /**
2111 + * Action: mainwp_widget_updates_actions_top
2112 + *
2113 + * Updates actions top content.
2114 + *
2115 + * @since 5.5
2116 + */
2117 + do_action( 'mainwp_widget_updates_actions_top', $current_tab );
2118 + ?>
2119 + <?php static::render_updates_actions_buttons( $current_tab, $current_tab_updates_count ); ?>
2120 + <?php static::render_button_view_ignored_updates( $current_tab ); ?>
2121 + <?php static::render_abandoned_plugins_themes_buttons( $current_tab ); ?>
2122 + </div>
2013 2123 </div>
2014 - <div class="middle aligned right aligned column">
2015 - <?php
2016 - /**
2017 - * Filter: mainwp_widgetupdates_actions_top
2018 - *
2019 - * Filters the udpates actions top content.
2020 - *
2021 - * @since Unknown
2022 - */
2023 - echo apply_filters( 'mainwp_widgetupdates_actions_top', '' ); // phpcs:ignore WordPress.Security.EscapeOutput
2024 - if ( 'abandoned-plugins' === $current_tab ) {
2025 - if ( $is_demo ) {
2026 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui green mini basic button disabled" disabled="disabled">' . esc_html__( 'Check for Abandoned Plugins', 'mainwp' ) . '</a>' );
2027 - } else {
2028 - ?>
2029 - <a href="#" onClick="updatesoverview_bulk_check_abandoned('plugin'); return false;" class="ui green mini basic button" data-tooltip="<?php esc_html_e( 'Check for Abandoned Plugins.', 'mainwp' ); ?>" data-inverted="" data-position="top center"><?php esc_html_e( 'Check for Abandoned Plugins', 'mainwp' ); ?></a>
2030 - <?php
2031 - }
2032 - } elseif ( 'abandoned-themes' === $current_tab ) {
2033 - if ( $is_demo ) {
2034 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui green mini basic button disabled" disabled="disabled">' . esc_html__( 'Check for Abandoned Themes', 'mainwp' ) . '</a>' );
2035 - } else {
2036 - ?>
2037 - <a href="#" onClick="updatesoverview_bulk_check_abandoned('theme'); return false;" class="ui green mini basic button" data-tooltip="<?php esc_html_e( 'Check for Abandoned Themes.', 'mainwp' ); ?>" data-inverted="" data-position="top center"><?php esc_html_e( 'Check for Abandoned Themes', 'mainwp' ); ?></a>
2038 - <?php
2039 - }
2040 - }
2041 - ?>
2124 + </div>
2125 + <?php elseif ( $show_select_staging_sites ) : ?>
2126 + <div class="mainwp-sub-header">
2127 + <div class="ui three column grid">
2128 + <div class="left aligned middle aligned column">
2129 + <?php static::render_select_staging_sites_view(); ?>
2130 + </div>
2131 + <div class="center aligned middle aligned column"></div>
2132 + <div class="right aligned middle aligned column">
2133 + </div>
2042 2134 </div>
2043 - </div>
2044 - </div>
2045 - </div>
2135 + </div>
2136 + <?php endif; ?>
2137 + <?php endif; ?>
2046 2138 <?php
2047 - static::render_button_view_ignored_updates( $current_tab );
2139 + /**
2140 + * Action: mainwp_updates_after_actions_bar
2141 + *
2142 + * Fires after the actions bar on the Updates page.
2143 + *
2144 + * @since 4.1
2145 + */
2146 + do_action( 'mainwp_updates_after_actions_bar' );
2147 + }
2148 +
2149 + /**
2150 + * Method handle_post_staging_sites_view.
2151 + *
2152 + * @return void
2153 + */
2154 + public static function handle_post_staging_sites_view() {
2155 + //phpcs:disable WordPress.Security.NonceVerification.Missing
2156 + if ( isset( $_POST['mainwpStagingNonceView'] ) && wp_verify_nonce( sanitize_key( $_POST['mainwpStagingNonceView'] ), 'mainwpStagingNonceView' ) ) {
2157 + global $current_user;
2158 + if ( isset( $_POST['select_staging_options_siteview'] ) && in_array( $_POST['select_staging_options_siteview'], array( 'live', 'staging' ), true ) ) {
2159 + update_user_option( $current_user->ID, 'mainwp_staging_options_updates_view', $_POST['select_staging_options_siteview'] );
2160 + }
2048 2161 }
2162 + //phpcs:enable WordPress.Security.NonceVerification.Missing
2163 + }
2049 2164
2050 2165 /**
2051 - * Action: mainwp_updates_after_actions_bar
2166 + * Method render_select_staging_sites_view.
2052 2167 *
2053 - * Fires after the actions bar on the Updates page.
2054 - *
2055 - * @since 4.1
2168 + * @return void
2056 2169 */
2057 - do_action( 'mainwp_updates_after_actions_bar' );
2170 + public static function render_select_staging_sites_view() {
2171 + $view = MainWP_System_Utility::get_select_staging_view_sites();
2172 + $view_stagings = 'staging' === (string) $view ? true : false;
2173 +
2174 + ?>
2175 + <form method="post" action="" style="display:inline">
2176 + <select class="ui dropdown mini" id="mainwp_staging_select_options_siteview" name="select_staging_options_siteview">
2177 + <option value="live" <?php echo $view_stagings ? '' : 'selected'; ?>><?php esc_html_e( 'Production sites', 'mainwp' ); ?></option>
2178 + <option value="staging" <?php echo $view_stagings ? 'selected' : ''; ?>><?php esc_html_e( 'Staging sites', 'mainwp' ); ?></option>
2179 + </select>
2180 + <?php wp_nonce_field( 'mainwpStagingNonceView', 'mainwpStagingNonceView' ); ?>
2181 + </form>
2182 + <script type="text/javascript">
2183 + jQuery(document).ready(function ($) {
2184 + jQuery("#mainwp_staging_select_options_siteview").change(function() {
2185 + jQuery(this).closest("form").submit();
2186 + });
2187 + })
2188 + </script>
2189 + <?php
2058 2190 }
2059 2191
2060 2192
2061 2193 /**
2062 - * Method render_button_view_ignored_updates().
2194 + * Method render_updates_view_options().
2063 2195 *
2064 - * @param string $current_tab current tab.
2065 - *
2066 - * @return null
2196 + * @param mixed $site_view Site view.
2197 + * @return void
2067 2198 */
2068 - public static function render_button_view_ignored_updates( $current_tab = '' ) {
2199 + public static function render_updates_view_options( $site_view = '' ) {
2200 + ?>
2201 + <form method="post" action="" class="ui mini form" style="display:inline flow-root">
2202 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
2203 + <select class="ui mini dropdown" onchange="mainwp_siteview_onchange(this)" id="mainwp_select_options_siteview" name="select_mainwp_options_siteview">
2204 + <option value="1" class="item" <?php echo MAINWP_VIEW_PER_SITE === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Site', 'mainwp' ); ?></option>
2205 + <option value="0" class="item" <?php echo MAINWP_VIEW_PER_PLUGIN_THEME === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Item', 'mainwp' ); ?></option>
2206 + <option value="2" class="item" <?php echo MAINWP_VIEW_PER_GROUP === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Tag', 'mainwp' ); ?></option>
2207 + </select>
2208 + </form>
2209 + <?php
2210 + }
2211 +
2212 + /**
2213 + * Method render_abandoned_plugins_themes_buttons().
2214 + *
2215 + * @param mixed $current_tab Current tab.
2216 + * @return void
2217 + */
2218 + public static function render_abandoned_plugins_themes_buttons( $current_tab = '' ) {
2219 + if ( 'abandoned-plugins' === $current_tab ) {
2220 + ?>
2221 + <a href="#" onClick="updatesoverview_bulk_check_abandoned('plugin'); return false;" class="ui green mini basic button"><?php esc_html_e( 'Check for Abandoned Plugins', 'mainwp' ); ?></a>
2222 + <?php } elseif ( 'abandoned-themes' === $current_tab ) { ?>
2223 + <a href="#" onClick="updatesoverview_bulk_check_abandoned('theme'); return false;" class="ui green mini basic button"><?php esc_html_e( 'Check for Abandoned Themes', 'mainwp' ); ?></a>
2224 + <?php
2225 + }
2226 + }
2227 +
2228 + /**
2229 + * Method get_ignored_core_versions().
2230 + *
2231 + * @param array $decodedIgnoredCores Decoded ignored cores.
2232 + *
2233 + * @return array Ignored core versions.
2234 + */
2235 + public static function get_ignored_core_versions( $decodedIgnoredCores ) {
2236 + if (
2237 + ! is_array( $decodedIgnoredCores )
2238 + || empty( $decodedIgnoredCores['ignored_versions'] )
2239 + || ! is_array( $decodedIgnoredCores['ignored_versions'] )
2240 + ) {
2241 + return array();
2242 + }
2243 +
2244 + return array_filter( $decodedIgnoredCores['ignored_versions'] );
2245 + }
2246 +
2247 + /**
2248 + * Method get_ignored_updates_count().
2249 + *
2250 + * @param string $current_tab Current tab.
2251 + *
2252 + * @return int Ignored updates count.
2253 + */
2254 + public static function get_ignored_updates_count( $current_tab = '' ) { //phpcs:ignore -- NOSONAR - complex.
2255 + if ( ! in_array( $current_tab, array( 'wordpress-updates', 'plugins-updates', 'themes-updates' ), true ) ) {
2256 + return 0;
2257 + }
2258 +
2259 + if ( isset( static::$ignored_updates_counts[ $current_tab ] ) ) {
2260 + return static::$ignored_updates_counts[ $current_tab ];
2261 + }
2262 +
2263 + $count = 0;
2264 + $userExtension = MainWP_DB_Common::instance()->get_user_extension();
2265 +
2266 + if ( 'plugins-updates' === $current_tab ) {
2267 + $decodedIgnoredPlugins = is_object( $userExtension ) && ! empty( $userExtension->ignored_plugins ) ? json_decode( $userExtension->ignored_plugins, true ) : array();
2268 + $count = is_array( $decodedIgnoredPlugins ) ? count( $decodedIgnoredPlugins ) : 0;
2269 + } elseif ( 'themes-updates' === $current_tab ) {
2270 + $decodedIgnoredThemes = is_object( $userExtension ) && ! empty( $userExtension->ignored_themes ) ? json_decode( $userExtension->ignored_themes, true ) : array();
2271 + $count = is_array( $decodedIgnoredThemes ) ? count( $decodedIgnoredThemes ) : 0;
2272 + } elseif ( 'wordpress-updates' === $current_tab ) {
2273 + $decodedIgnoredCores = is_object( $userExtension ) && ! empty( $userExtension->ignored_wp_upgrades ) ? json_decode( $userExtension->ignored_wp_upgrades, true ) : array();
2274 + $count = count( static::get_ignored_core_versions( $decodedIgnoredCores ) );
2275 + }
2276 +
2277 + $websites = MainWP_DB::instance()->query(
2278 + MainWP_DB::instance()->get_sql_websites_for_current_user(
2279 + false,
2280 + null,
2281 + 'wp.url',
2282 + false,
2283 + false,
2284 + null,
2285 + false,
2286 + array( 'ignored_wp_upgrades' )
2287 + )
2288 + );
2289 +
2290 + while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
2291 + if ( 'plugins-updates' === $current_tab ) {
2292 + $decodedIgnoredPlugins = ! empty( $website->ignored_plugins ) ? json_decode( $website->ignored_plugins, true ) : array();
2293 + if ( ! empty( $decodedIgnoredPlugins ) && is_array( $decodedIgnoredPlugins ) ) {
2294 + ++$count;
2295 + }
2296 + } elseif ( 'themes-updates' === $current_tab ) {
2297 + $decodedIgnoredThemes = ! empty( $website->ignored_themes ) ? json_decode( $website->ignored_themes, true ) : array();
2298 + if ( ! empty( $decodedIgnoredThemes ) && is_array( $decodedIgnoredThemes ) ) {
2299 + ++$count;
2300 + }
2301 + } elseif ( 'wordpress-updates' === $current_tab && empty( $website->is_ignoreCoreUpdates ) ) {
2302 + $decodedIgnoredCores = ! empty( $website->ignored_wp_upgrades ) ? json_decode( $website->ignored_wp_upgrades, true ) : array();
2303 + if ( ! empty( static::get_ignored_core_versions( $decodedIgnoredCores ) ) ) {
2304 + ++$count;
2305 + }
2306 + }
2307 + }
2308 +
2309 + if ( $websites ) {
2310 + MainWP_DB::free_result( $websites );
2311 + }
2312 +
2313 + static::$ignored_updates_counts[ $current_tab ] = $count;
2314 +
2315 + return $count;
2316 + }
2317 +
2318 + /**
2319 + * Method render_updates_actions_buttons().
2320 + *
2321 + * @param mixed $current_tab Current tab.
2322 + * @param int $updates_count Available updates count.
2323 + * @return void
2324 + */
2325 + public static function render_updates_actions_buttons( $current_tab, $updates_count = 0 ) {
2326 + $has_updates = 0 < intval( $updates_count );
2327 +
2328 + if ( 'plugins-updates' === $current_tab ) {
2329 + if ( static::user_can_update_plugins() ) {
2330 + if ( $has_updates ) {
2331 + static::set_continue_update_html_selector( 'plugins_global_upgrade_all' );
2332 + ?>
2333 + <a href="javascript:void(0)" onClick="updatesoverview_plugins_global_upgrade_all( false, true ); return false;" class="mainwp-update-selected-button ui mini green basic button"><?php esc_html_e( 'Update Selected Plugins', 'mainwp' ); ?></a>
2334 + <a href="javascript:void(0)" onClick="updatesoverview_plugins_global_upgrade_all(); return false;" class="mainwp-update-all-button ui mini green button"><?php esc_html_e( 'Update All Plugins', 'mainwp' ); ?></a>
2335 + <?php
2336 + } else {
2337 + ?>
2338 + <a href="javascript:void(0)" class="mainwp-update-selected-button ui mini green basic disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update Selected Plugins', 'mainwp' ); ?></a>
2339 + <a href="javascript:void(0)" class="mainwp-update-all-button ui mini green disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update All Plugins', 'mainwp' ); ?></a>
2340 + <?php
2341 + }
2342 + }
2343 + } elseif ( 'themes-updates' === $current_tab ) {
2344 + if ( static::user_can_update_themes() ) {
2345 + if ( $has_updates ) {
2346 + static::set_continue_update_html_selector( 'themes_global_upgrade_all' );
2347 + ?>
2348 + <a href="javascript:void(0)" onClick="updatesoverview_themes_global_upgrade_all( false, true ); return false;" class="mainwp-update-selected-button ui mini green basic button"><?php esc_html_e( 'Update Selected Themes', 'mainwp' ); ?></a>
2349 + <a href="javascript:void(0)" onClick="updatesoverview_themes_global_upgrade_all(); return false;" class="mainwp-update-all-button ui mini green button"><?php esc_html_e( 'Update All Themes', 'mainwp' ); ?></a>
2350 + <?php
2351 + } else {
2352 + ?>
2353 + <a href="javascript:void(0)" class="mainwp-update-selected-button ui mini green basic disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update Selected Themes', 'mainwp' ); ?></a>
2354 + <a href="javascript:void(0)" class="mainwp-update-all-button ui mini green disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update All Themes', 'mainwp' ); ?></a>
2355 + <?php
2356 + }
2357 + }
2358 + } elseif ( 'wordpress-updates' === $current_tab ) {
2359 + if ( static::user_can_update_wp() ) {
2360 + if ( $has_updates ) {
2361 + static::set_continue_update_html_selector( 'wpcore_global_upgrade_all' );
2362 + ?>
2363 + <a href="javascript:void(0)" class="mainwp-update-selected-button ui green mini basic button" onclick="event.stopPropagation(); updatesoverview_wordpress_global_upgrade_all( false, true ); return false;"><?php esc_html_e( 'Update Selected WP Cores', 'mainwp' ); ?></a>
2364 + <a href="javascript:void(0)" class="mainwp-update-all-button ui green mini button" onclick="updatesoverview_wordpress_global_upgrade_all(); return false;"><?php esc_html_e( 'Update All WP Cores', 'mainwp' ); ?></a>
2365 + <?php
2366 + } else {
2367 + ?>
2368 + <a href="javascript:void(0)" class="mainwp-update-selected-button ui green mini basic disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update Selected WP Cores', 'mainwp' ); ?></a>
2369 + <a href="javascript:void(0)" class="mainwp-update-all-button ui green mini disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update All WP Cores', 'mainwp' ); ?></a>
2370 + <?php
2371 + }
2372 + }
2373 + } elseif ( 'translations-updates' === $current_tab ) {
2374 + if ( static::user_can_update_trans() ) {
2375 + ?>
2376 + <a href="javascript:void(0)" onClick="updatesoverview_translations_global_upgrade_all( false, true ); return false;" class="mainwp-update-selected-button ui button mini basic green"><?php esc_html_e( 'Update Selected Translations', 'mainwp' ); ?></a>
2377 + <a href="javascript:void(0)" onClick="updatesoverview_translations_global_upgrade_all(); return false;" class="mainwp-update-all-button ui button mini green"><?php esc_html_e( 'Update All Translations', 'mainwp' ); ?></a>
2378 + <?php
2379 + }
2380 + }
2381 + }
2382 +
2383 +
2384 + /**
2385 + * Method render_button_view_ignored_updates().
2386 + *
2387 + * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension()
2388 + * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
2389 + * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
2390 + *
2391 + * @param string $current_tab current tab.
2392 + *
2393 + * @return null
2394 + */
2395 + public static function render_button_view_ignored_updates( $current_tab = '' ) { //phpcs:ignore -- NOSONAR - complex.
2069 2396 if ( ! in_array( $current_tab, array( 'wordpress-updates', 'plugins-updates', 'themes-updates' ) ) ) {
2070 2397 return;
2071 2398 }
2399 + $count_ignored_updates = static::get_ignored_updates_count( $current_tab );
2400 + $ignored_core_url = add_query_arg(
2401 + array(
2402 + 'page' => 'UpdatesManage',
2403 + 'tab' => 'updates-ignore',
2404 + ),
2405 + admin_url( 'admin.php' )
2406 + );
2407 + $ignored_plugins_url = add_query_arg(
2408 + array(
2409 + 'page' => 'PluginsIgnore',
2410 + ),
2411 + admin_url( 'admin.php' )
2412 + );
2413 + $ignored_themes_url = add_query_arg(
2414 + array(
2415 + 'page' => 'ThemesIgnore',
2416 + ),
2417 + admin_url( 'admin.php' )
2418 + );
2072 2419 ?>
2073 - <div class="mainwp-sub-header">
2074 - <div class="ui grid">
2075 - <div class="equal width row">
2076 - <div class="middle aligned column">
2077 - </div>
2078 - <div class="middle aligned right aligned column">
2079 - <?php
2080 - if ( 'wordpress-updates' === $current_tab ) {
2081 - ?>
2082 - <a class="ui green mini basic button" href="admin.php?page=UpdatesManage&tab=updates-ignore" data-position="top right" data-tooltip="Update WordPress Core files on selected child sites." data-inverted=""><?php esc_html_e( 'View Ignored Core Updates', 'mainwp' ); ?></a>
2083 - <?php
2084 - } elseif ( 'plugins-updates' === $current_tab ) {
2085 - ?>
2086 - <a class="ui green mini basic button" href="admin.php?page=PluginsIgnore" data-position="top right" data-tooltip="Update WordPress Core files on selected child sites." data-inverted=""><?php esc_html_e( 'View Ignored Plugins Updates', 'mainwp' ); ?></a>
2087 - <?php
2088 - } elseif ( 'themes-updates' === $current_tab ) {
2089 - ?>
2090 - <a class="ui green mini basic button" href="admin.php?page=ThemesIgnore" data-position="top right" data-tooltip="Update WordPress Core files on selected child sites." data-inverted=""><?php esc_html_e( 'View Ignored Themes Updates', 'mainwp' ); ?></a>
2091 - <?php
2092 - }
2093 - ?>
2094 - </div>
2095 - </div>
2096 - </div>
2097 - </div>
2098 - <?php
2420 + <?php if ( 'wordpress-updates' === $current_tab && 0 < $count_ignored_updates ) : ?>
2421 + <a class="ui mini basic button" href="<?php echo esc_url( $ignored_core_url ); ?>" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Click here to see the list of ignored WordPress core updates.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'View Ignored Updates', 'mainwp' ); ?></a>
2422 + <?php elseif ( 'plugins-updates' === $current_tab && 0 < $count_ignored_updates ) : ?>
2423 + <a class="ui mini basic button" href="<?php echo esc_url( $ignored_plugins_url ); ?>"><?php esc_html_e( 'View Ignored Updates', 'mainwp' ); ?></a>
2424 + <?php elseif ( 'themes-updates' === $current_tab && 0 < $count_ignored_updates ) : ?>
2425 + <a class="ui mini basic button" href="<?php echo esc_url( $ignored_themes_url ); ?>" ><?php esc_html_e( 'View Ignored Updates', 'mainwp' ); ?></a>
2426 + <?php endif; ?>
2427 + <?php
2099 2428 }
2100 2429
2101 - /**
2102 - * Method handle_limit_sites().
2103 - */
2430 + /**
2431 + * Method handle_limit_sites().
2432 + */
2104 2433 public static function handle_limit_sites(){ // phpcs:ignore -- NOSONAR - complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated.
2105 - // put hook here before loading sites.
2106 - $limit_number = apply_filters( 'mainwp_manage_updates_limit_loading', false, 'updates' );
2107 - $current_limit = get_option( 'mainwp_manage_updates_limit_sites' );
2434 + // put hook here before loading sites.
2435 + $limit_number = apply_filters( 'mainwp_manage_updates_limit_loading', false, 'updates' );
2436 + $current_limit = get_option( 'mainwp_manage_updates_limit_sites' );
2108 2437
2109 2438 if ( (int) $limit_number !== (int) $current_limit ) {
2110 2439 update_option( 'mainwp_manage_updates_limit_sites', $limit_number );
2111 2440 update_option( 'mainwp_manage_updates_limit_current_page', 1 );
@@ -2132,22 +2461,22 @@
2132 2461 update_option( 'mainwp_manage_updates_limit_current_page', $current_page );
2133 2462 }
2134 2463 }
2135 2464
2136 - /**
2137 - * Method render_limit_load_sites().
2138 - *
2139 - * @param int $limit_number limit loading sites.
2140 - */
2465 + /**
2466 + * Method render_limit_load_sites().
2467 + *
2468 + * @param int $limit_number limit loading sites.
2469 + */
2141 2470 public static function render_limit_load_sites( $limit_number) { // phpcs:ignore -- NOSONAR - complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated.
2142 2471
2143 - $count = MainWP_DB::instance()->get_websites_count( null, true );
2144 - $total_page = ceil( $count / $limit_number );
2472 + $count = MainWP_DB::instance()->get_websites_count( null, true );
2473 + $total_page = ceil( $count / $limit_number );
2145 2474
2146 - $current_page = (int) get_option( 'mainwp_manage_updates_limit_current_page' );
2475 + $current_page = (int) get_option( 'mainwp_manage_updates_limit_current_page' );
2147 2476
2148 - $first = 1 === $current_page;
2149 - $last = $total_page <= $current_page;
2477 + $first = 1 === $current_page;
2478 + $last = $total_page <= $current_page;
2150 2479
2151 2480 ?>
2152 2481 <div class="dt-paging paging_full_numbers">
2153 2482 <div class="ui stackable pagination menu"><menu>
@@ -2174,169 +2503,19 @@
2174 2503 <?php } ?>
2175 2504 </menu></div>
2176 2505 </div>
2177 2506 <br/>
2178 - <?php
2507 + <?php
2179 2508 }
2180 2509
2181 - /**
2182 - * Renders the HTTP Check html content.
2183 - *
2184 - * @param object $websites Child Sites.
2185 - *
2186 - * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
2187 - * @uses \MainWP\Dashboard\MainWP_DB::data_seek()
2188 - */
2189 - public static function render_http_checks( $websites ) { //phpcs:ignore -- NOSONAR - complex.
2190 -
2191 - $enable_legacy_backup = get_option( 'mainwp_enableLegacyBackupFeature' );
2192 - $mainwp_primaryBackup = get_option( 'mainwp_primaryBackup' );
2193 -
2194 2510 /**
2195 - * Custom backup pages
2511 + * Cheks which primary backup plugin is being used.
2196 2512 *
2197 - * Filters backup options to set correct page for restore options.
2513 + * @param mixed $what Which backup plugin is being use.
2514 + * @param object $website Website array of information.
2198 2515 *
2199 - * @since 4.0
2516 + * @return boolean True|False.
2200 2517 */
2201 - $customPage = apply_filters_deprecated( 'mainwp-getcustompage-backups', array( false ), '4.0.7.2', 'mainwp_getcustompage_backups' ); // @deprecated Use 'mainwp_getcustompage_backups' instead. NOSONAR - not IP.
2202 - $customPage = apply_filters( 'mainwp_getcustompage_backups', $customPage );
2203 -
2204 - $restorePageSlug = '';
2205 - if ( empty( $enable_legacy_backup ) && ! empty( $mainwp_primaryBackup ) && is_array( $customPage ) && isset( $customPage['managesites_slug'] ) ) {
2206 - $restorePageSlug = 'admin.php?page=ManageSites' . $customPage['managesites_slug'];
2207 - } elseif ( $enable_legacy_backup ) {
2208 - $restorePageSlug = 'admin.php?page=managesites';
2209 - }
2210 - ?>
2211 - <div class="" id="mainwp-http-response-issues">
2212 - <?php
2213 - /**
2214 - * Action: mainwp_updates_before_http_response_table
2215 - *
2216 - * Fires before the HTTP responses table on the Updates pages
2217 - *
2218 - * @since 4.1
2219 - */
2220 - do_action( 'mainwp_updates_before_http_response_table' );
2221 - ?>
2222 - <table class="ui single line inverted unstackable table" id="mainwp-http-response-issues-table">
2223 - <thead>
2224 - <tr>
2225 - <th scope="col" class="no-sort" colspan="3"><?php esc_html_e( 'HTTP Response Check Results', 'mainwp' ); ?></th>
2226 - </tr>
2227 - <tr>
2228 - <th scope="col"><?php esc_html_e( 'Website', 'mainwp' ); ?></th>
2229 - <th scope="col"><?php esc_html_e( 'HTTP Code', 'mainwp' ); ?></th>
2230 - <th scope="col" class="collapsing no-sort"></th>
2231 - </tr>
2232 - </thead>
2233 - <tbody>
2234 - <?php
2235 - MainWP_DB::data_seek( $websites, 0 );
2236 - while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
2237 - if ( 1 === (int) $website->offline_check_result || '-1' === $website->http_response_code ) {
2238 - continue;
2239 - }
2240 -
2241 - $restoreSlug = '';
2242 -
2243 - if ( ! empty( $restorePageSlug ) ) {
2244 - if ( $enable_legacy_backup ) {
2245 - $restoreSlug = $restorePageSlug . '&backupid=' . intval( $website->id );
2246 - } elseif ( static::activated_primary_backup_plugin( $mainwp_primaryBackup, $website ) ) {
2247 - $restoreSlug = $restorePageSlug . '&id=' . intval( $website->id );
2248 - }
2249 - }
2250 - ?>
2251 - <tr id="child-site-<?php echo intval( $website->id ); ?>" class="child-site mainwp-child-site-<?php echo intval( $website->id ); ?>" siteid="<?php echo intval( $website->id ); ?>" site-url="<?php echo esc_url( $website->url ); ?>">
2252 - <td>
2253 - <?php static::render_site_link_dashboard( $website ); ?>
2254 - </td>
2255 - <td id="wp_http_response_code_<?php echo esc_attr( $website->id ); ?>">
2256 - <label class="ui red label http-code"><?php echo 'HTTP ' . esc_html( $website->http_response_code ); ?></label>
2257 - </td>
2258 - <td class="right aligned">
2259 - <a href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php echo esc_attr( $website->id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" class="ui mini button" target="_blank"><?php esc_html_e( 'WP Admin', 'mainwp' ); ?></a>
2260 - <a href="javascript:void(0)" onclick="return updatesoverview_recheck_http( this, <?php echo intval( $website->id ); ?> )" class="ui basic mini green button"><?php esc_html_e( 'Recheck', 'mainwp' ); ?></a>
2261 - <?php if ( ! empty( $website->sync_errors ) ) { ?>
2262 - <a href="#" class="mainwp_site_reconnect ui green mini button"><?php esc_html_e( 'Reconnect', 'mainwp' ); ?></a>
2263 - <?php } ?>
2264 - <a href="javascript:void(0)" onClick="return updatesoverview_ignore_http_response( this, <?php echo intval( $website->id ); ?> )" class="ui basic mini button"><?php esc_html_e( 'Ignore', 'mainwp' ); ?></a>
2265 - <?php if ( ! empty( $restoreSlug ) ) { ?>
2266 - <a href="<?php echo esc_url( $restoreSlug ); ?>" class="ui green mini basic button"><?php esc_html_e( 'Restore', 'mainwp' ); ?></a>
2267 - <?php } ?>
2268 - </td>
2269 - </tr>
2270 - <?php
2271 - }
2272 - ?>
2273 - </tbody>
2274 - <tfoot>
2275 - <tr>
2276 - <th scope="col" ><?php esc_html_e( 'Website', 'mainwp' ); ?></th>
2277 - <th scope="col" ><?php esc_html_e( 'HTTP Code', 'mainwp' ); ?></th>
2278 - <th scope="col" class="collapsing no-sort"></th>
2279 - </tr>
2280 - </tfoot>
2281 - </table>
2282 - <?php
2283 - /**
2284 - * Action: mainwp_updates_after_http_response_table
2285 - *
2286 - * Fires after the HTTP responses table on the Updates pages.
2287 - *
2288 - * @since 4.1
2289 - */
2290 - do_action( 'mainwp_updates_after_http_response_table' );
2291 -
2292 - $table_features = array(
2293 - 'searching' => 'false',
2294 - 'paging' => 'false',
2295 - 'stateSave' => 'true',
2296 - 'info' => 'false',
2297 - 'responsive' => 'true',
2298 - );
2299 -
2300 - /**
2301 - * Filter: mainwp_updates_http_responses_datatable_features
2302 - *
2303 - * Filters the DataTable options for the HTTP Responses table on the Updates page.
2304 - *
2305 - * @since 4.1
2306 - */
2307 - $table_features = apply_filters( 'mainwp_updates_http_responses_datatable_features', $table_features );
2308 - ?>
2309 - <script>
2310 - jQuery( document ).ready( function() {
2311 - let responsive = <?php echo esc_html( $table_features['responsive'] ); ?>;
2312 - if( jQuery( window ).width() > 1140 ) {
2313 - responsive = false;
2314 - }
2315 - jQuery( '#mainwp-http-response-issues-table' ).DataTable( {
2316 - "responsive": responsive,
2317 - "searching": <?php echo esc_html( $table_features['searching'] ); ?>,
2318 - "paging" : <?php echo esc_html( $table_features['paging'] ); ?>,
2319 - "stateSave": <?php echo esc_html( $table_features['stateSave'] ); ?>,
2320 - "info" : <?php echo esc_html( $table_features['info'] ); ?>,
2321 - "columnDefs" : [ { "orderable": false, "targets": "no-sort" } ],
2322 - "language" : { "emptyTable": "No HTTP issues detected." },
2323 - } );
2324 - } );
2325 - </script>
2326 - </div>
2327 - <div class="ui hidden clearing divider"></div>
2328 - <?php
2329 - }
2330 -
2331 - /**
2332 - * Cheks which primary backup plugin is being used.
2333 - *
2334 - * @param mixed $what Which backup plugin is being use.
2335 - * @param object $website Website array of information.
2336 - *
2337 - * @return boolean True|False.
2338 - */
2339 2518 public static function activated_primary_backup_plugin( $what, $website ) {
2340 2519 $plugins = json_decode( $website->plugins, 1 );
2341 2520 if ( ! is_array( $plugins ) || empty( $plugins ) ) {
2342 2521 return false;
@@ -2368,14 +2547,14 @@
2368 2547
2369 2548 return $installed;
2370 2549 }
2371 2550
2372 - /**
2373 - * Sets the HTML selector to continue updates.
2374 - *
2375 - * @param string $current_update current update string.
2376 - * @param bool $slug Whether to update slug.
2377 - */
2551 + /**
2552 + * Sets the HTML selector to continue updates.
2553 + *
2554 + * @param string $current_update current update string.
2555 + * @param bool $slug Whether to update slug.
2556 + */
2378 2557 public static function set_continue_update_html_selector( $current_update, $slug = false ) {
2379 2558
2380 2559 $check_slug = true;
2381 2560 if ( ! empty( $slug ) ) {
@@ -2388,20 +2567,20 @@
2388 2567 static::$continue_selector = '';
2389 2568 }
2390 2569 }
2391 2570
2392 - /**
2393 - * Gets the HTML selector to continue updates.
2394 - *
2395 - * @return void.
2396 - */
2571 + /**
2572 + * Gets the HTML selector to continue updates.
2573 + *
2574 + * @return void.
2575 + */
2397 2576 public static function get_continue_update_selector() {
2398 2577 echo esc_attr( static::$continue_selector );
2399 2578 }
2400 2579
2401 - /**
2402 - * Displays the updates modal window during updates.
2403 - */
2580 + /**
2581 + * Displays the updates modal window during updates.
2582 + */
2404 2583 public static function render_updates_modal() {
2405 2584 ?>
2406 2585 <div class="ui modal" id="updatesoverview-backup-box">
2407 2586 <div class="header"><?php esc_html_e( 'Backup Check', 'mainwp' ); ?></div>
@@ -2411,14 +2590,14 @@
2411 2590 <a id="updatesoverview-backup-now" href="javascript:void(0)" target="_blank" style="display: none" class="button-primary button"><?php esc_html_e( 'Backup Now', 'mainwp' ); ?></a>&nbsp;
2412 2591 <input id="updatesoverview-backup-ignore" type="button" name="Ignore" value="<?php esc_html_e( 'Ignore', 'mainwp' ); ?>" class="button"/>
2413 2592 </div>
2414 2593 </div>
2415 - <?php
2594 + <?php
2416 2595 }
2417 2596
2418 - /**
2419 - * Displays the plugin details modal window.
2420 - */
2597 + /**
2598 + * Displays the plugin details modal window.
2599 + */
2421 2600 public static function render_plugin_details_modal() {
2422 2601 ?>
2423 2602 <div class="ui modal" id="mainwp-plugin-details-modal">
2424 2603 <i class="close icon"></i>
@@ -2428,8 +2607,50 @@
2428 2607 </div>
2429 2608 <div class="actions">
2430 2609 </div>
2431 2610 </div>
2611 + <?php
2612 + }
2613 +
2614 + /**
2615 + * Method get_site_tz_info().
2616 + *
2617 + * @param object $website Website.
2618 + *
2619 + * @return string Timezone site info.
2620 + */
2621 + public static function get_site_tz_info( $website ) {
2622 + if ( is_object( $website ) && ! empty( $website->site_info ) ) {
2623 + $wp_info = ! empty( $website->site_info ) ? json_decode( $website->site_info, true ) : array();
2624 + if ( ! is_array( $wp_info ) ) {
2625 + $wp_info = array();
2626 + }
2627 + $use_tzformat = ! empty( $wp_info['format_datetime'] ) && is_array( $wp_info['format_datetime'] ) ? $wp_info['format_datetime'] : array();
2628 + $offs = ! empty( $use_tzformat['gmt_offset'] ) ? intval( $use_tzformat['gmt_offset'] ) : 0;
2629 + return esc_html__( '- Timezone:', 'mainwp' ) . ' UTC' . ( $offs >= 0 ? '+' . $offs : $offs );
2630 + }
2631 + return '';
2632 + }
2633 +
2634 + /**
2635 + * Method render_changes_history_modal()
2636 + */
2637 + public static function render_changes_history_modal() {
2638 + ?>
2639 + <div class="ui modal" id="mainwp-plugin-theme-history-changes-modal">
2640 + <i class="close icon"></i>
2641 + <div class="ui header">
2642 + <div class="main-text"><?php esc_html_e( 'History', 'mainwp' ); ?></div>
2643 + <div class="sub header" style="display:none;"></div>
2644 + </div>
2645 + <div class="scrolling content"></div>
2646 + <div class="actions">
2647 + <div class="ui two columns stackable grid">
2648 + <div class="left aligned column col-left"></div>
2649 + <div class="right aligned column col-right"></div>
2650 + </div>
2651 + </div>
2652 + </div>
2432 2653 <?php
2433 2654 }
2434 2655
2435 2656 /**
@@ -2438,14 +2659,16 @@
2438 2659 * Renders Page Settings Modal.
2439 2660 */
2440 2661 public static function render_screen_options_modal() { // phpcs:ignore -- NOSONAR - complex method.
2441 2662
2442 - $snAutomaticDailyUpdate = (int) get_option( 'mainwp_automaticDailyUpdate' );
2443 - $snPluginAutomaticDailyUpdate = (int) get_option( 'mainwp_pluginAutomaticDailyUpdate' );
2444 - $snThemeAutomaticDailyUpdate = (int) get_option( 'mainwp_themeAutomaticDailyUpdate' );
2445 - $mainwp_show_language_updates = (int) get_option( 'mainwp_show_language_updates', 1 );
2446 - $disableUpdateConfirmations = (int) get_option( 'mainwp_disable_update_confirmations', 0 );
2447 - $delay_autoupdate = (int) get_option( 'mainwp_delay_autoupdate', 1 );
2663 + $snAutomaticDailyUpdate = (int) get_option( 'mainwp_automaticDailyUpdate' );
2664 + $snPluginAutomaticDailyUpdate = (int) get_option( 'mainwp_pluginAutomaticDailyUpdate' );
2665 + $snThemeAutomaticDailyUpdate = (int) get_option( 'mainwp_themeAutomaticDailyUpdate' );
2666 + $snTransAutomaticUpdate = (int) get_option( 'mainwp_transAutomaticDailyUpdate' );
2667 +
2668 + $mainwp_show_language_updates = (int) get_option( 'mainwp_show_language_updates', 1 );
2669 + $disableUpdateConfirmations = (int) get_option( 'mainwp_disable_update_confirmations', 0 );
2670 + $delay_autoupdate = (int) get_option( 'mainwp_delay_autoupdate', 1 );
2448 2671 ?>
2449 2672 <div class="ui modal" id="mainwp-manage-updates-screen-options-modal">
2450 2673 <i class="close icon"></i>
2451 2674 <div class="header"><?php esc_html_e( 'Page Settings', 'mainwp' ); ?></div>
@@ -2450,13 +2673,13 @@
2450 2673 <i class="close icon"></i>
2451 2674 <div class="header"><?php esc_html_e( 'Page Settings', 'mainwp' ); ?></div>
2452 2675 <div class="scrolling content ui form">
2453 2676 <form method="POST" action="" id="manage-updates-screen-options-form" name="manage-updates-screen-options-form">
2454 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
2677 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
2455 2678 <input type="hidden" name="wp_nonce" value="<?php echo esc_attr( wp_create_nonce( 'UpdatesScrOptions' ) ); ?>" />
2456 2679 <div class="ui grid field">
2457 2680 <label class="six wide column middle aligned"><?php esc_html_e( 'Plugin advanced automatic updates', 'mainwp' ); ?></label>
2458 - <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic plugins updates.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
2681 + <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic plugin updates.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
2459 2682 <select name="mainwp_pluginAutomaticDailyUpdate" id="mainwp_pluginAutomaticDailyUpdate" class="ui dropdown">
2460 2683 <option value="1" <?php echo 1 === $snPluginAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option>
2461 2684 <option value="0" <?php echo ( false !== $snPluginAutomaticDailyUpdate && empty( $snPluginAutomaticDailyUpdate ) ) || 2 === $snPluginAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Disabled', 'mainwp' ); ?></option>
2462 2685 </select>
@@ -2463,9 +2686,9 @@
2463 2686 </div>
2464 2687 </div>
2465 2688 <div class="ui grid field">
2466 2689 <label class="six wide column middle aligned"><?php esc_html_e( 'Theme advanced automatic updates', 'mainwp' ); ?></label>
2467 - <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic themes updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
2690 + <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic theme updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
2468 2691 <select name="mainwp_themeAutomaticDailyUpdate" id="mainwp_themeAutomaticDailyUpdate" class="ui dropdown">
2469 2692 <option value="1" <?php echo 1 === $snThemeAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option>
2470 2693 <option value="0" <?php echo ( false !== $snThemeAutomaticDailyUpdate && 0 === $snThemeAutomaticDailyUpdate ) || 2 === $snThemeAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Disabled', 'mainwp' ); ?></option>
2471 2694 </select>
@@ -2471,8 +2694,17 @@
2471 2694 </select>
2472 2695 </div>
2473 2696 </div>
2474 2697 <div class="ui grid field">
2698 + <label class="six wide column middle aligned"><?php esc_html_e( 'Translation advanced automatic updates', 'mainwp' ); ?></label>
2699 + <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic translation updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
2700 + <select name="mainwp_transAutomaticDailyUpdate" id="mainwp_transAutomaticDailyUpdate" class="ui dropdown">
2701 + <option value="1" <?php echo 1 === $snTransAutomaticUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option>
2702 + <option value="0" <?php echo ( false !== $snTransAutomaticUpdate && 0 === $snTransAutomaticUpdate ) || 2 === $snTransAutomaticUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Disabled', 'mainwp' ); ?></option>
2703 + </select>
2704 + </div>
2705 + </div>
2706 + <div class="ui grid field">
2475 2707 <label class="six wide column middle aligned"><?php esc_html_e( 'WP Core advanced automatic updates', 'mainwp' ); ?></label>
2476 2708 <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic WordPress core updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
2477 2709 <select name="mainwp_automaticDailyUpdate" id="mainwp_automaticDailyUpdate" class="ui dropdown">
2478 2710 <option value="1" <?php echo 1 === $snAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option>
@@ -2525,32 +2757,32 @@
2525 2757 </div>
2526 2758 </div>
2527 2759 </form>
2528 2760 </div>
2529 - <?php
2761 + <?php
2530 2762 }
2531 2763
2532 2764
2533 - /**
2534 - * Method mainwp_help_content()
2535 - *
2536 - * Creates the MainWP Help Documentation List for the help component in the sidebar.
2537 - */
2765 + /**
2766 + * Method mainwp_help_content()
2767 + *
2768 + * Creates the MainWP Help Documentation List for the help component in the sidebar.
2769 + */
2538 2770 public static function mainwp_help_content() {
2539 2771 if ( isset( $_GET['page'] ) && 'UpdatesManage' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
2540 2772 ?>
2541 2773 <p><?php esc_html_e( 'If you need help with managing updates, please review following help documents', 'mainwp' ); ?></p>
2542 2774 <div class="ui list">
2543 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#update-plugins" target="_blank">Update Plugins</a></div>
2544 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#plugins-auto-updates" target="_blank">Plugins Auto Updates</a></div>
2545 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#ignore-plugin-updates" target="_blank">Ignore Plugin Updates</a></div>
2546 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#update-themes" target="_blank">Update Themes</a></div>
2547 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#themes-auto-updates" target="_blank">Themes Auto Updates</a></div>
2548 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#ignore-theme-updates" target="_blank">Ignore Theme Updates</a></div>
2549 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#update-wordpress-core" target="_blank">Update WordPress Core</a></div>
2550 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#auto-update-wordpress-core" target="_blank">Auto Update WordPress Core</a></div>
2551 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#ignore-wordpress-core-update" target="_blank">Ignore WordPress Core Update</a></div>
2552 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-updates/#safe-updates---updates-rollback" target="_blank">Safe Updates/Updates Rollback</a></div>
2775 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#plugin-updates" target="_blank">Update Plugins</a></div>
2776 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#plugin-auto-updates" target="_blank">Plugins Auto Updates</a></div>
2777 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-plugin-updates" target="_blank">Ignore Plugin Updates</a></div>
2778 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-plugin-updates" target="_blank">Update Themes</a></div>
2779 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#theme-auto-updates" target="_blank">Themes Auto Updates</a></div>
2780 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-theme-updates" target="_blank">Ignore Theme Updates</a></div>
2781 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#wordpress-core-updates" target="_blank">Update WordPress Core</a></div>
2782 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#auto-update-wordpress-core" target="_blank">Auto Update WordPress Core</a></div>
2783 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-wordpress-core-updates" target="_blank">Ignore WordPress Core Update</a></div>
2784 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#safe-updates-%2F-rollback" target="_blank">Safe Updates/Updates Rollback</a></div>
2553 2785 <?php
2554 2786 /**
2555 2787 * Action: mainwp_updates_help_item
2556 2788 *
@@ -2564,8 +2796,8 @@
2564 2796 */
2565 2797 do_action( 'mainwp_updates_help_item' );
2566 2798 ?>
2567 2799 </div>
2568 - <?php
2800 + <?php
2569 2801 }
2570 2802 }
2571 2803 }