| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * MainWP Themes Page |
| 4 | 4 | * |
| 5 | - * This page is used to Manage Themes on Child Sites | |
| 5 | + * This page is used to Manage Themes on Child Sites. | |
| 6 | 6 | * |
| 7 | 7 | * @package MainWP/Themes |
| 8 | 8 | */ |
| 9 | 9 | |
| @@ -8,8 +8,13 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | namespace MainWP\Dashboard; |
| 11 | 11 | |
| 12 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | + exit; | |
| 14 | +} | |
| 15 | + | |
| 16 | + | |
| 12 | 17 | /** |
| 13 | 18 | * Class MainWP_Themes_Page |
| 14 | 19 | * |
| 15 | 20 | * @uses MainWP_Install_Bulk |
| @@ -88,9 +93,9 @@ | ||
| 88 | 93 | |
| 89 | 94 | add_submenu_page( |
| 90 | 95 | 'mainwp_tab', |
| 91 | 96 | __( 'Themes', 'mainwp' ), |
| 92 | - '<div class="mainwp-hidden">' . esc_html__( 'Install', 'mainwp' ) . '</div>', | |
| 97 | + '<div class="mainwp-hidden">' . esc_html__( 'Install Themes', 'mainwp' ) . '</div>', | |
| 93 | 98 | 'read', |
| 94 | 99 | 'ThemesInstall', |
| 95 | 100 | array( |
| 96 | 101 | static::get_class_name(), |
| @@ -118,11 +123,24 @@ | ||
| 118 | 123 | static::get_class_name(), |
| 119 | 124 | 'render_ignore', |
| 120 | 125 | ) |
| 121 | 126 | ); |
| 127 | + | |
| 122 | 128 | add_submenu_page( |
| 123 | 129 | 'mainwp_tab', |
| 124 | 130 | __( 'Themes', 'mainwp' ), |
| 131 | + '<div class="mainwp-hidden">' . esc_html__( 'Abandoned Themes', 'mainwp' ) . '</div>', | |
| 132 | + 'read', | |
| 133 | + 'ThemesAbandoned', | |
| 134 | + array( | |
| 135 | + static::get_class_name(), | |
| 136 | + 'render_abandoned_themes', | |
| 137 | + ) | |
| 138 | + ); | |
| 139 | + | |
| 140 | + add_submenu_page( | |
| 141 | + 'mainwp_tab', | |
| 142 | + __( 'Themes', 'mainwp' ), | |
| 125 | 143 | '<div class="mainwp-hidden">' . esc_html__( 'Ignored Abandoned', 'mainwp' ) . '</div>', |
| 126 | 144 | 'read', |
| 127 | 145 | 'ThemesIgnoredAbandoned', |
| 128 | 146 | array( |
| @@ -166,9 +184,9 @@ | ||
| 166 | 184 | <div class="mainwp_boxoutin"></div> |
| 167 | 185 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=ThemesManage' ) ); ?>" class="mainwp-submenu"> |
| 168 | 186 | <?php esc_html_e( 'Manage Themes', 'mainwp' ); ?> |
| 169 | 187 | </a> |
| 170 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'install_themes' ) ) { ?> | |
| 188 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'install_themes' ) ) { ?> | |
| 171 | 189 | <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ThemesInstall' ) ) { ?> |
| 172 | 190 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=ThemesInstall' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Install Themes', 'mainwp' ); ?></a> |
| 173 | 191 | <?php } ?> |
| 174 | 192 | <?php } ?> |
| @@ -232,9 +250,9 @@ | ||
| 232 | 250 | 'right' => '', |
| 233 | 251 | 'leftsub_order_level2' => 1, |
| 234 | 252 | ), |
| 235 | 253 | array( |
| 236 | - 'title' => esc_html__( 'Install', 'mainwp' ), | |
| 254 | + 'title' => esc_html__( 'Install Themes', 'mainwp' ), | |
| 237 | 255 | 'parent_key' => 'ThemesManage', |
| 238 | 256 | 'href' => 'admin.php?page=ThemesInstall', |
| 239 | 257 | 'slug' => 'ThemesInstall', |
| 240 | 258 | 'right' => 'install_themes', |
| @@ -258,10 +276,10 @@ | ||
| 258 | 276 | ), |
| 259 | 277 | array( |
| 260 | 278 | 'title' => esc_html__( 'Abandoned Themes', 'mainwp' ), |
| 261 | 279 | 'parent_key' => 'ThemesManage', |
| 262 | - 'href' => 'admin.php?page=UpdatesManage&tab=abandoned-themes', | |
| 263 | - 'slug' => 'ThemesManage', | |
| 280 | + 'href' => 'admin.php?page=ThemesAbandoned', | |
| 281 | + 'slug' => 'ThemesAbandoned', | |
| 264 | 282 | 'right' => '', |
| 265 | 283 | 'leftsub_order_level2' => 4.1, |
| 266 | 284 | ), |
| 267 | 285 | array( |
| @@ -307,9 +325,9 @@ | ||
| 307 | 325 | 'href' => 'admin.php?page=ThemesManage', |
| 308 | 326 | 'active' => ( 'Manage' === $shownPage ) ? true : false, |
| 309 | 327 | ); |
| 310 | 328 | |
| 311 | - if ( mainwp_current_user_have_right( 'dashboard', 'install_themes' ) ) { | |
| 329 | + if ( \mainwp_current_user_can( 'dashboard', 'install_themes' ) ) { | |
| 312 | 330 | $renderItems[] = array( |
| 313 | 331 | 'title' => esc_html__( 'Install', 'mainwp' ), |
| 314 | 332 | 'href' => 'admin.php?page=ThemesInstall', |
| 315 | 333 | 'active' => ( 'Install' === $shownPage ) ? true : false, |
| @@ -331,8 +349,16 @@ | ||
| 331 | 349 | 'active' => ( 'Ignore' === $shownPage ) ? true : false, |
| 332 | 350 | ); |
| 333 | 351 | } |
| 334 | 352 | |
| 353 | + if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ThemesAbandoned' ) ) { | |
| 354 | + $renderItems[] = array( | |
| 355 | + 'title' => esc_html__( 'Abandoned Themes', 'mainwp' ), | |
| 356 | + 'href' => 'admin.php?page=ThemesAbandoned', | |
| 357 | + 'active' => ( 'Abandoned' === $shownPage ) ? true : false, | |
| 358 | + ); | |
| 359 | + } | |
| 360 | + | |
| 335 | 361 | if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ThemesIgnoredAbandoned' ) ) { |
| 336 | 362 | $renderItems[] = array( |
| 337 | 363 | 'title' => esc_html__( 'Ignored Abandoned', 'mainwp' ), |
| 338 | 364 | 'href' => 'admin.php?page=ThemesIgnoredAbandoned', |
| @@ -424,9 +450,9 @@ | ||
| 424 | 450 | ?> |
| 425 | 451 | </div> |
| 426 | 452 | <div class="right aligned column"> |
| 427 | 453 | <?php MainWP_Plugins::render_select_manage_view( 'theme' ); ?> |
| 428 | - | |
| 454 | + | |
| 429 | 455 | <?php |
| 430 | 456 | /** |
| 431 | 457 | * Action: mainwp_themes_actions_bar_right |
| 432 | 458 | * |
| @@ -439,20 +465,23 @@ | ||
| 439 | 465 | </div> |
| 440 | 466 | </div> |
| 441 | 467 | </div> |
| 442 | 468 | </div> |
| 443 | - <div class="ui segment" id="mainwp_themes_wrap_table"> | |
| 469 | + <div class="ui padded segment" id="mainwp_themes_wrap_table"> | |
| 444 | 470 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-manage-themes-info-message' ) ) : ?> |
| 445 | 471 | <div class="ui info message"> |
| 446 | 472 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-manage-themes-info-message"></i> |
| 473 | + <div class="header"><?php esc_html_e( 'How to Manage Themes', 'mainwp' ); ?></div> | |
| 447 | 474 | <div><?php echo esc_html__( 'Manage installed themes on your child sites. Here you can activate, deactivate, and delete installed themes.', 'mainwp' ); ?></div> |
| 448 | - <p><?php echo esc_html__( 'To Activate or Delete a specific theme, you must search only for Inactive themes on your child sites. If you search for Active or both Active and Inactive, the Activate and Delete actions will be disabled.', 'mainwp' ); ?></p> | |
| 449 | - <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-themes-with-mainwp/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></p> | |
| 475 | + <div class="ui bulleted list"> | |
| 476 | + <div class="item"><?php echo esc_html__( 'To Activate or Delete a specific theme, you must search only for Inactive themes on your child sites. If you search for Active or both Active and Inactive, the Activate and Delete actions will be disabled.', 'mainwp' ); ?></div> | |
| 477 | + </div> | |
| 478 | + <div><?php /* translators: 1: Opening link tag, 2: Closing link tag with icon */ printf( esc_html__( 'For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/themes/managing-themes-with-mainwp" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></div> | |
| 450 | 479 | </div> |
| 451 | 480 | <?php endif; ?> |
| 452 | 481 | <div id="mainwp-message-zone" class="ui message" style="display:none"></div> |
| 453 | - <div id="mainwp-loading-themes-row" class="ui active inverted dimmer" style="display:none"> | |
| 454 | - <div class="ui large text loader"><?php esc_html_e( 'Loading Themes...', 'mainwp' ); ?></div> | |
| 482 | + <div id="mainwp-loading-themes-row" class="ui active page dimmer" style="display:none"> | |
| 483 | + <div class="ui text double loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div> | |
| 455 | 484 | </div> |
| 456 | 485 | <div id="mainwp-themes-main-content" <?php echo ( null !== $cachedSearch ) ? 'style="display: block;"' : ''; ?> > |
| 457 | 486 | <div id="mainwp-themes-content"> |
| 458 | 487 | <?php if ( is_array( $cachedResult ) && isset( $cachedResult['result'] ) ) : ?> |
| @@ -457,12 +486,9 @@ | ||
| 457 | 486 | <div id="mainwp-themes-content"> |
| 458 | 487 | <?php if ( is_array( $cachedResult ) && isset( $cachedResult['result'] ) ) : ?> |
| 459 | 488 | <?php echo $cachedResult['result']; // phpcs:ignore WordPress.Security.EscapeOutput ?> |
| 460 | 489 | <?php else : ?> |
| 461 | - <div class="ui hidden divider"></div> | |
| 462 | - <div class="ui hidden divider"></div> | |
| 463 | - <div class="ui hidden divider"></div> | |
| 464 | - <?php MainWP_UI::render_empty_element_placeholder( __( 'Use the search options to find the theme you want to manage', 'mainwp' ) ); ?> | |
| 490 | + <?php MainWP_UI::render_empty_page_placeholder( __( 'No themes loaded yet.', 'mainwp' ), __( 'Select one or more Child Sites and click the Show Themes button to view installed plugins.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' ); ?> | |
| 465 | 491 | <?php endif; ?> |
| 466 | 492 | </div> |
| 467 | 493 | </div> |
| 468 | 494 | </div> |
| @@ -527,12 +553,8 @@ | ||
| 527 | 553 | * @since 4.1 |
| 528 | 554 | */ |
| 529 | 555 | do_action( 'mainwp_manage_themes_before_search_options' ); |
| 530 | 556 | ?> |
| 531 | - <div class="ui info message"> | |
| 532 | - <i class="close icon mainwp-notice-dismiss" notice-id="themes-manage-info"></i> | |
| 533 | - <?php esc_html_e( 'A theme needs to be Inactive for it to be Activated or Deleted.', 'mainwp' ); ?> | |
| 534 | - </div> | |
| 535 | 557 | <div class="ui mini form"> |
| 536 | 558 | <div class="field"> |
| 537 | 559 | <select class="ui fluid dropdown" id="mainwp_themes_search_by_status"> |
| 538 | 560 | <option value=""><?php esc_html_e( 'Select status', 'mainwp' ); ?></option> |
| @@ -593,8 +615,15 @@ | ||
| 593 | 615 | ?> |
| 594 | 616 | </div> |
| 595 | 617 | <div style="clear:both"></div> |
| 596 | 618 | </div> |
| 619 | + <script type="text/javascript"> | |
| 620 | + jQuery( document ).ready( function ($) { | |
| 621 | + if($('#mainwp-themes-content .mainwp-manage-themes-reload-data').length){ | |
| 622 | + mainwp_fetch_themes(); | |
| 623 | + } | |
| 624 | + } ); | |
| 625 | + </script> | |
| 597 | 626 | <?php |
| 598 | 627 | static::render_footer( 'Manage' ); |
| 599 | 628 | } |
| 600 | 629 | |
| @@ -622,9 +651,9 @@ | ||
| 622 | 651 | </div> |
| 623 | 652 | </div> |
| 624 | 653 | <div class="ui hidden fitted divider"></div> |
| 625 | 654 | <div class="field"> |
| 626 | - <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=""> | |
| 655 | + <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=""> | |
| 627 | 656 | <input type="checkbox" <?php echo $disabledNegative ? 'disabled' : ''; ?> <?php echo $checkedNegative ? 'checked="true"' : ''; ?> value="1" id="display_sites_not_meeting_criteria" /> |
| 628 | 657 | <label for="display_sites_not_meeting_criteria"><?php esc_html_e( 'Exclude theme', 'mainwp' ); ?></label> |
| 629 | 658 | </div> |
| 630 | 659 | </div> |
| @@ -670,8 +699,9 @@ | ||
| 670 | 699 | * @param array $groups Selected groups of child sites. |
| 671 | 700 | * @param array $sites Selected child sites. |
| 672 | 701 | * @param mixed $not_criteria Show not criteria result. |
| 673 | 702 | * @param mixed $clients Selected Clients. |
| 703 | + * @param bool $not_fetchdata True|False fetch data or not. | |
| 674 | 704 | * |
| 675 | 705 | * @return mixed $result Errors|HTML. |
| 676 | 706 | * |
| 677 | 707 | * @uses \MainWP\Dashboard\MainWP_Cache::init_cache() |
| @@ -687,9 +717,9 @@ | ||
| 687 | 717 | * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit() |
| 688 | 718 | * @uses \MainWP\Dashboard\MainWP_Utility::map_site() |
| 689 | 719 | * @uses \MainWP\Dashboard\MainWP_Utility::get_nice_url() |
| 690 | 720 | */ |
| 691 | - public static function render_table( $keyword, $status, $groups, $sites, $not_criteria, $clients = '' ) { // phpcs:ignore -- NOSONAR - complex function. | |
| 721 | + public static function render_table( $keyword, $status, $groups, $sites, $not_criteria, $clients = '', $not_fetchdata = false ) { // phpcs:ignore -- NOSONAR - complex function. | |
| 692 | 722 | MainWP_Cache::init_cache( 'Themes' ); |
| 693 | 723 | |
| 694 | 724 | $output = new \stdClass(); |
| 695 | 725 | $output->errors = array(); |
| @@ -701,64 +731,125 @@ | ||
| 701 | 731 | |
| 702 | 732 | $data_fields = MainWP_System_Utility::get_default_map_site_fields(); |
| 703 | 733 | $data_fields[] = 'themes'; |
| 704 | 734 | $data_fields[] = 'rollback_updates_data'; |
| 735 | + $data_fields[] = 'site_info'; | |
| 705 | 736 | |
| 706 | - if ( 1 === (int) get_option( 'mainwp_optimize', 1 ) || MainWP_Demo_Handle::is_demo_mode() ) { | |
| 737 | + if ( ! $not_fetchdata ) { | |
| 738 | + if ( 1 === (int) get_option( 'mainwp_optimize', 1 ) || MainWP_Demo_Handle::is_demo_mode() ) { | |
| 707 | 739 | |
| 708 | - $keyword = trim( $keyword ); | |
| 709 | - $multi_kws = explode( ',', $keyword ); | |
| 710 | - $multi_kws = array_filter( array_map( 'trim', $multi_kws ) ); | |
| 740 | + $keyword = trim( $keyword ); | |
| 741 | + $multi_kws = explode( ',', $keyword ); | |
| 742 | + $multi_kws = array_filter( array_map( 'trim', $multi_kws ) ); | |
| 711 | 743 | |
| 712 | - if ( '' !== $sites ) { | |
| 713 | - foreach ( $sites as $v ) { | |
| 714 | - if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 715 | - $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data' ) ); | |
| 716 | - $allThemes = json_decode( $website->themes, true ); | |
| 717 | - $_count = count( $allThemes ); | |
| 718 | - $_count_installed = 0; | |
| 719 | - for ( $i = 0; $i < $_count; $i++ ) { | |
| 720 | - $theme = $allThemes[ $i ]; | |
| 721 | - $active_inactive = 'active' === $status || 'inactive' === $status; | |
| 722 | - if ( $active_inactive && ( ( 1 === (int) $theme['active'] && 'active' !== $status ) || ( 1 !== $theme['active'] && 'inactive' !== $status ) ) ) { | |
| 723 | - continue; | |
| 724 | - } | |
| 744 | + if ( '' !== $sites ) { | |
| 745 | + foreach ( $sites as $v ) { | |
| 746 | + if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 747 | + $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data', 'site_info' ) ); | |
| 748 | + $allThemes = json_decode( $website->themes, true ); | |
| 749 | + $_count = count( $allThemes ); | |
| 750 | + $_count_installed = 0; | |
| 751 | + for ( $i = 0; $i < $_count; $i++ ) { | |
| 752 | + $theme = $allThemes[ $i ]; | |
| 753 | + $active_inactive = 'active' === $status || 'inactive' === $status; | |
| 754 | + if ( $active_inactive && ( ( 1 === (int) $theme['active'] && 'active' !== $status ) || ( 1 !== $theme['active'] && 'inactive' !== $status ) ) ) { | |
| 755 | + continue; | |
| 756 | + } | |
| 725 | 757 | |
| 726 | - if ( ! empty( $keyword ) ) { | |
| 727 | - if ( $not_criteria ) { | |
| 728 | - if ( MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 758 | + if ( ! empty( $keyword ) ) { | |
| 759 | + if ( $not_criteria ) { | |
| 760 | + if ( MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 761 | + continue; | |
| 762 | + } | |
| 763 | + } elseif ( ! MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 729 | 764 | continue; |
| 730 | 765 | } |
| 731 | - } elseif ( ! MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 766 | + } | |
| 767 | + | |
| 768 | + $theme['websiteid'] = $website->id; | |
| 769 | + $theme['websiteurl'] = $website->url; | |
| 770 | + $theme['websitename'] = $website->name; | |
| 771 | + $theme['site_info'] = $website->site_info; | |
| 772 | + $output->themes[] = $theme; | |
| 773 | + ++$_count_installed; | |
| 774 | + } | |
| 775 | + if ( 0 === $_count_installed && 'not_installed' === $status ) { | |
| 776 | + for ( $i = 0; $i < $_count; $i++ ) { | |
| 777 | + $theme = $allThemes[ $i ]; | |
| 778 | + $theme['websiteid'] = $website->id; | |
| 779 | + $theme['websiteurl'] = $website->url; | |
| 780 | + $theme['websitename'] = $website->name; | |
| 781 | + $theme['site_info'] = $website->site_info; | |
| 782 | + $output->themes_installed[] = $theme; | |
| 783 | + } | |
| 784 | + } | |
| 785 | + $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'theme', $website->rollback_updates_data ); | |
| 786 | + } | |
| 787 | + } | |
| 788 | + } | |
| 789 | + | |
| 790 | + if ( '' !== $groups ) { | |
| 791 | + foreach ( $groups as $v ) { | |
| 792 | + if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 793 | + $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' ) ) ) ); | |
| 794 | + while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { | |
| 795 | + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { | |
| 732 | 796 | continue; |
| 733 | 797 | } |
| 734 | - } | |
| 798 | + $allThemes = json_decode( $website->themes, true ); | |
| 799 | + $_count = count( $allThemes ); | |
| 800 | + $_count_installed = 0; | |
| 801 | + for ( $i = 0; $i < $_count; $i++ ) { | |
| 802 | + $theme = $allThemes[ $i ]; | |
| 803 | + $act_inact = 'active' === $status || 'inactive' === $status; | |
| 804 | + if ( $act_inact && ( ( 1 === (int) $theme['active'] && 'active' !== $status ) || ( 1 !== $theme['active'] && 'inactive' !== $status ) ) ) { | |
| 805 | + continue; | |
| 806 | + } | |
| 735 | 807 | |
| 736 | - $theme['websiteid'] = $website->id; | |
| 737 | - $theme['websiteurl'] = $website->url; | |
| 738 | - $theme['websitename'] = $website->name; | |
| 739 | - $output->themes[] = $theme; | |
| 740 | - ++$_count_installed; | |
| 741 | - } | |
| 742 | - if ( 0 === $_count_installed && 'not_installed' === $status ) { | |
| 743 | - for ( $i = 0; $i < $_count; $i++ ) { | |
| 744 | - $theme = $allThemes[ $i ]; | |
| 745 | - $theme['websiteid'] = $website->id; | |
| 746 | - $theme['websiteurl'] = $website->url; | |
| 747 | - $theme['websitename'] = $website->name; | |
| 748 | - $output->themes_installed[] = $theme; | |
| 808 | + if ( ! empty( $keyword ) ) { | |
| 809 | + if ( $not_criteria ) { | |
| 810 | + if ( MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 811 | + continue; | |
| 812 | + } | |
| 813 | + } elseif ( ! MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 814 | + continue; | |
| 815 | + } | |
| 816 | + } | |
| 817 | + | |
| 818 | + $theme['websiteid'] = $website->id; | |
| 819 | + $theme['websiteurl'] = $website->url; | |
| 820 | + $theme['websitename'] = $website->name; | |
| 821 | + $theme['site_info'] = $website->site_info; | |
| 822 | + $output->themes[] = $theme; | |
| 823 | + ++$_count_installed; | |
| 824 | + } | |
| 825 | + if ( 0 === $_count_installed && 'not_installed' === $status ) { | |
| 826 | + for ( $i = 0; $i < $_count; $i++ ) { | |
| 827 | + $theme = $allThemes[ $i ]; | |
| 828 | + $theme['websiteid'] = $website->id; | |
| 829 | + $theme['websiteurl'] = $website->url; | |
| 830 | + $theme['websitename'] = $website->name; | |
| 831 | + $theme['site_info'] = $website->site_info; | |
| 832 | + $output->themes_installed[] = $theme; | |
| 833 | + } | |
| 834 | + } | |
| 835 | + $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'theme', $website->rollback_updates_data ); | |
| 749 | 836 | } |
| 837 | + MainWP_DB::free_result( $websites ); | |
| 750 | 838 | } |
| 751 | - $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'theme', $website->rollback_updates_data ); | |
| 752 | 839 | } |
| 753 | 840 | } |
| 754 | - } | |
| 755 | 841 | |
| 756 | - if ( '' !== $groups ) { | |
| 757 | - foreach ( $groups as $v ) { | |
| 758 | - if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 759 | - $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' ) ) ) ); | |
| 760 | - while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { | |
| 842 | + if ( '' !== $clients && is_array( $clients ) ) { | |
| 843 | + $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids( | |
| 844 | + $clients, | |
| 845 | + array( | |
| 846 | + 'select_data' => $data_fields, | |
| 847 | + 'extra_view' => array( 'rollback_updates_data' ), | |
| 848 | + ) | |
| 849 | + ); | |
| 850 | + if ( $websites ) { | |
| 851 | + foreach ( $websites as $website ) { | |
| 761 | 852 | if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { |
| 762 | 853 | continue; |
| 763 | 854 | } |
| 764 | 855 | $allThemes = json_decode( $website->themes, true ); |
| @@ -765,13 +856,12 @@ | ||
| 765 | 856 | $_count = count( $allThemes ); |
| 766 | 857 | $_count_installed = 0; |
| 767 | 858 | for ( $i = 0; $i < $_count; $i++ ) { |
| 768 | 859 | $theme = $allThemes[ $i ]; |
| 769 | - $act_inact = 'active' === $status || 'inactive' === $status; | |
| 770 | - if ( $act_inact && ( ( 1 === (int) $theme['active'] && 'active' !== $status ) || ( 1 !== $theme['active'] && 'inactive' !== $status ) ) ) { | |
| 860 | + $act_inacy = 'active' === $status || 'inactive' === $status; | |
| 861 | + if ( $act_inacy && ( ( 1 === (int) $theme['active'] && 'active' !== $status ) || ( 1 !== $theme['active'] && 'inactive' !== $status ) ) ) { | |
| 771 | 862 | continue; |
| 772 | 863 | } |
| 773 | - | |
| 774 | 864 | if ( ! empty( $keyword ) ) { |
| 775 | 865 | if ( $not_criteria ) { |
| 776 | 866 | if ( MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { |
| 777 | 867 | continue; |
| @@ -783,8 +873,9 @@ | ||
| 783 | 873 | |
| 784 | 874 | $theme['websiteid'] = $website->id; |
| 785 | 875 | $theme['websiteurl'] = $website->url; |
| 786 | 876 | $theme['websitename'] = $website->name; |
| 877 | + $theme['site_info'] = $website->site_info; | |
| 787 | 878 | $output->themes[] = $theme; |
| 788 | 879 | ++$_count_installed; |
| 789 | 880 | } |
| 790 | 881 | if ( 0 === $_count_installed && 'not_installed' === $status ) { |
| @@ -792,92 +883,62 @@ | ||
| 792 | 883 | $theme = $allThemes[ $i ]; |
| 793 | 884 | $theme['websiteid'] = $website->id; |
| 794 | 885 | $theme['websiteurl'] = $website->url; |
| 795 | 886 | $theme['websitename'] = $website->name; |
| 887 | + $theme['site_info'] = $website->site_info; | |
| 796 | 888 | $output->themes_installed[] = $theme; |
| 797 | 889 | } |
| 798 | 890 | } |
| 799 | 891 | $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'theme', $website->rollback_updates_data ); |
| 800 | 892 | } |
| 801 | - MainWP_DB::free_result( $websites ); | |
| 802 | 893 | } |
| 803 | 894 | } |
| 804 | - } | |
| 895 | + } else { | |
| 896 | + $dbwebsites = array(); | |
| 805 | 897 | |
| 806 | - if ( '' !== $clients && is_array( $clients ) ) { | |
| 807 | - $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids( | |
| 808 | - $clients, | |
| 809 | - array( | |
| 810 | - 'select_data' => $data_fields, | |
| 811 | - 'extra_view' => array( 'rollback_updates_data' ), | |
| 812 | - ) | |
| 813 | - ); | |
| 814 | - if ( $websites ) { | |
| 815 | - foreach ( $websites as $website ) { | |
| 816 | - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { | |
| 817 | - continue; | |
| 818 | - } | |
| 819 | - $allThemes = json_decode( $website->themes, true ); | |
| 820 | - $_count = count( $allThemes ); | |
| 821 | - $_count_installed = 0; | |
| 822 | - for ( $i = 0; $i < $_count; $i++ ) { | |
| 823 | - $theme = $allThemes[ $i ]; | |
| 824 | - $act_inacy = 'active' === $status || 'inactive' === $status; | |
| 825 | - if ( $act_inacy && ( ( 1 === (int) $theme['active'] && 'active' !== $status ) || ( 1 !== $theme['active'] && 'inactive' !== $status ) ) ) { | |
| 898 | + if ( '' !== $sites ) { | |
| 899 | + foreach ( $sites as $v ) { | |
| 900 | + if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 901 | + $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data' ) ); | |
| 902 | + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { | |
| 826 | 903 | continue; |
| 827 | 904 | } |
| 828 | - if ( ! empty( $keyword ) ) { | |
| 829 | - if ( $not_criteria ) { | |
| 830 | - if ( MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 831 | - continue; | |
| 832 | - } | |
| 833 | - } elseif ( ! MainWP_Utility::multi_find_keywords( $theme['title'], $multi_kws ) ) { | |
| 834 | - continue; | |
| 835 | - } | |
| 836 | - } | |
| 837 | - | |
| 838 | - $theme['websiteid'] = $website->id; | |
| 839 | - $theme['websiteurl'] = $website->url; | |
| 840 | - $theme['websitename'] = $website->name; | |
| 841 | - $output->themes[] = $theme; | |
| 842 | - ++$_count_installed; | |
| 905 | + $dbwebsites[ $website->id ] = MainWP_Utility::map_site( | |
| 906 | + $website, | |
| 907 | + $data_fields | |
| 908 | + ); | |
| 843 | 909 | } |
| 844 | - if ( 0 === $_count_installed && 'not_installed' === $status ) { | |
| 845 | - for ( $i = 0; $i < $_count; $i++ ) { | |
| 846 | - $theme = $allThemes[ $i ]; | |
| 847 | - $theme['websiteid'] = $website->id; | |
| 848 | - $theme['websiteurl'] = $website->url; | |
| 849 | - $theme['websitename'] = $website->name; | |
| 850 | - $output->themes_installed[] = $theme; | |
| 851 | - } | |
| 852 | - } | |
| 853 | - $output->roll_items[ $website->id ] = MainWP_Updates_Helper::get_roll_update_plugintheme_items( 'theme', $website->rollback_updates_data ); | |
| 854 | 910 | } |
| 855 | 911 | } |
| 856 | - } | |
| 857 | - } else { | |
| 858 | - $dbwebsites = array(); | |
| 859 | 912 | |
| 860 | - if ( '' !== $sites ) { | |
| 861 | - foreach ( $sites as $v ) { | |
| 862 | - if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 863 | - $website = MainWP_DB::instance()->get_website_by_id( $v, false, array( 'rollback_updates_data' ) ); | |
| 864 | - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { | |
| 865 | - continue; | |
| 913 | + if ( '' !== $groups ) { | |
| 914 | + foreach ( $groups as $v ) { | |
| 915 | + if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 916 | + $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' ) ) ) ); | |
| 917 | + while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { | |
| 918 | + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { | |
| 919 | + continue; | |
| 920 | + } | |
| 921 | + $dbwebsites[ $website->id ] = MainWP_Utility::map_site( | |
| 922 | + $website, | |
| 923 | + $data_fields | |
| 924 | + ); | |
| 925 | + } | |
| 926 | + MainWP_DB::free_result( $websites ); | |
| 866 | 927 | } |
| 867 | - $dbwebsites[ $website->id ] = MainWP_Utility::map_site( | |
| 868 | - $website, | |
| 869 | - $data_fields | |
| 870 | - ); | |
| 871 | 928 | } |
| 872 | 929 | } |
| 873 | - } | |
| 874 | 930 | |
| 875 | - if ( '' !== $groups ) { | |
| 876 | - foreach ( $groups as $v ) { | |
| 877 | - if ( MainWP_Utility::ctype_digit( $v ) ) { | |
| 878 | - $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' ) ) ) ); | |
| 879 | - while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { | |
| 931 | + if ( '' !== $clients && is_array( $clients ) ) { | |
| 932 | + $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids( | |
| 933 | + $clients, | |
| 934 | + array( | |
| 935 | + 'select_data' => $data_fields, | |
| 936 | + 'extra_view' => array( 'rollback_updates_data' ), | |
| 937 | + ) | |
| 938 | + ); | |
| 939 | + if ( $websites ) { | |
| 940 | + foreach ( $websites as $website ) { | |
| 880 | 941 | if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { |
| 881 | 942 | continue; |
| 882 | 943 | } |
| 883 | 944 | $dbwebsites[ $website->id ] = MainWP_Utility::map_site( |
| @@ -884,56 +945,34 @@ | ||
| 884 | 945 | $website, |
| 885 | 946 | $data_fields |
| 886 | 947 | ); |
| 887 | 948 | } |
| 888 | - MainWP_DB::free_result( $websites ); | |
| 889 | 949 | } |
| 890 | 950 | } |
| 891 | - } | |
| 892 | 951 | |
| 893 | - if ( '' !== $clients && is_array( $clients ) ) { | |
| 894 | - $websites = MainWP_DB_Client::instance()->get_websites_by_client_ids( | |
| 895 | - $clients, | |
| 896 | - array( | |
| 897 | - 'select_data' => $data_fields, | |
| 898 | - 'extra_view' => array( 'rollback_updates_data' ), | |
| 899 | - ) | |
| 952 | + $post_data = array( | |
| 953 | + 'keyword' => $keyword, | |
| 900 | 954 | ); |
| 901 | - if ( $websites ) { | |
| 902 | - foreach ( $websites as $website ) { | |
| 903 | - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) { | |
| 904 | - continue; | |
| 905 | - } | |
| 906 | - $dbwebsites[ $website->id ] = MainWP_Utility::map_site( | |
| 907 | - $website, | |
| 908 | - $data_fields | |
| 909 | - ); | |
| 910 | - } | |
| 955 | + | |
| 956 | + if ( 'active' === $status || 'inactive' === $status ) { | |
| 957 | + $post_data['status'] = $status; | |
| 958 | + $post_data['filter'] = true; | |
| 959 | + } else { | |
| 960 | + $post_data['status'] = ''; | |
| 961 | + $post_data['filter'] = false; | |
| 911 | 962 | } |
| 912 | - } | |
| 913 | 963 | |
| 914 | - $post_data = array( | |
| 915 | - 'keyword' => $keyword, | |
| 916 | - ); | |
| 964 | + if ( 'not_installed' === $status ) { | |
| 965 | + $post_data['not_installed'] = true; | |
| 966 | + } | |
| 917 | 967 | |
| 918 | - if ( 'active' === $status || 'inactive' === $status ) { | |
| 919 | - $post_data['status'] = $status; | |
| 920 | - $post_data['filter'] = true; | |
| 921 | - } else { | |
| 922 | - $post_data['status'] = ''; | |
| 923 | - $post_data['filter'] = false; | |
| 924 | - } | |
| 968 | + $post_data['not_criteria'] = $not_criteria ? true : false; | |
| 969 | + MainWP_Connect::fetch_urls_authed( $dbwebsites, 'get_all_themes', $post_data, array( MainWP_Themes_Handler::get_class_name(), 'themes_search_handler' ), $output ); | |
| 925 | 970 | |
| 926 | - if ( 'not_installed' === $status ) { | |
| 927 | - $post_data['not_installed'] = true; | |
| 928 | - } | |
| 929 | - | |
| 930 | - $post_data['not_criteria'] = $not_criteria ? true : false; | |
| 931 | - MainWP_Connect::fetch_urls_authed( $dbwebsites, 'get_all_themes', $post_data, array( MainWP_Themes_Handler::get_class_name(), 'themes_search_handler' ), $output ); | |
| 932 | - | |
| 933 | - if ( ! empty( $output->errors ) ) { | |
| 934 | - foreach ( $output->errors as $siteid => $error ) { | |
| 935 | - $error_results .= MainWP_Utility::get_nice_url( $dbwebsites[ $siteid ]->url ) . ' - ' . $error . '<br/>'; // phpcs:ignore WordPress.Security.EscapeOutput | |
| 971 | + if ( ! empty( $output->errors ) ) { | |
| 972 | + foreach ( $output->errors as $siteid => $error ) { | |
| 973 | + $error_results .= MainWP_Utility::get_nice_url( $dbwebsites[ $siteid ]->url ) . ' - ' . $error . '<br/>'; // phpcs:ignore WordPress.Security.EscapeOutput | |
| 974 | + } | |
| 936 | 975 | } |
| 937 | 976 | } |
| 938 | 977 | } |
| 939 | 978 | |
| @@ -964,9 +1003,9 @@ | ||
| 964 | 1003 | $roll_items_list = array(); |
| 965 | 1004 | if ( 'not_installed' === $status ) { |
| 966 | 1005 | if ( empty( $output->themes_installed ) ) { |
| 967 | 1006 | ?> |
| 968 | - <div class="ui message yellow"><?php esc_html_e( 'No websites found.', 'mainwp' ); ?></div> | |
| 1007 | + <div class="ui message yellow <?php echo $not_fetchdata ? 'mainwp-manage-themes-reload-data' : ''; ?>"><?php esc_html_e( 'No websites found.', 'mainwp' ); ?></div> | |
| 969 | 1008 | <?php |
| 970 | 1009 | } else { |
| 971 | 1010 | $themes_list = $output->themes_installed; |
| 972 | 1011 | $roll_items_list = ! empty( $output->roll_items ) ? $output->roll_items : array(); |
| @@ -973,9 +1012,9 @@ | ||
| 973 | 1012 | $view_mode = MAINWP_VIEW_PER_SITE; |
| 974 | 1013 | } |
| 975 | 1014 | } elseif ( empty( $output->themes ) ) { |
| 976 | 1015 | ?> |
| 977 | - <div class="ui message yellow"><?php esc_html_e( 'No themes found.', 'mainwp' ); ?></div> | |
| 1016 | + <div class="ui message yellow <?php echo $not_fetchdata ? 'mainwp-manage-themes-reload-data' : ''; ?>"><?php esc_html_e( 'No themes found.', 'mainwp' ); ?></div> | |
| 978 | 1017 | <?php |
| 979 | 1018 | } else { |
| 980 | 1019 | $themes_list = $output->themes; |
| 981 | 1020 | $roll_items_list = ! empty( $output->roll_items ) ? $output->roll_items : array(); |
| @@ -982,8 +1021,9 @@ | ||
| 982 | 1021 | } |
| 983 | 1022 | |
| 984 | 1023 | $sites = array(); |
| 985 | 1024 | $siteThemes = array(); |
| 1025 | + $themesName = array(); | |
| 986 | 1026 | $themesNameSites = array(); |
| 987 | 1027 | $themesRealVersion = array(); |
| 988 | 1028 | $themesSlug = array(); |
| 989 | 1029 | |
| @@ -1004,8 +1044,9 @@ | ||
| 1004 | 1044 | |
| 1005 | 1045 | $sites[ $theme['websiteid'] ] = array( |
| 1006 | 1046 | 'websiteurl' => $theme['websiteurl'], |
| 1007 | 1047 | 'websitename' => $theme['websitename'], |
| 1048 | + 'site_info' => $theme['site_info'], | |
| 1008 | 1049 | ); |
| 1009 | 1050 | $themesName[ $slug_ver ] = $theme['name']; |
| 1010 | 1051 | $themesSlug[ $slug_ver ] = $theme['slug']; |
| 1011 | 1052 | |
| @@ -1025,8 +1066,9 @@ | ||
| 1025 | 1066 | } else { |
| 1026 | 1067 | static::render_manage_per_site_table( $sites, $themesName, $siteThemes, $themesSlug, $themesNameSites, $themesRealVersion, $roll_items_list ); |
| 1027 | 1068 | } |
| 1028 | 1069 | MainWP_UI::render_modal_upload_icon(); |
| 1070 | + MainWP_Updates::render_changes_history_modal(); | |
| 1029 | 1071 | } |
| 1030 | 1072 | |
| 1031 | 1073 | $newOutput = ob_get_clean(); |
| 1032 | 1074 | $result = array( |
| @@ -1045,9 +1087,9 @@ | ||
| 1045 | 1087 | * |
| 1046 | 1088 | * @param array $sites List of sites. |
| 1047 | 1089 | * @param array $themesName List of themes. |
| 1048 | 1090 | * @param array $siteThemes List of themes for the site. |
| 1049 | - * @param string $themesSlug List of theme slugs. | |
| 1091 | + * @param array $themesSlug List of theme slugs. | |
| 1050 | 1092 | * @param array $themesNameSites Installed theme version. |
| 1051 | 1093 | * @param string $themesRealVersion Current theme version. |
| 1052 | 1094 | * @param array $roll_list roll items list. |
| 1053 | 1095 | */ |
| @@ -1091,13 +1133,13 @@ | ||
| 1091 | 1133 | } |
| 1092 | 1134 | } |
| 1093 | 1135 | $ignored_themes = json_decode( $website->ignored_themes, true ); |
| 1094 | 1136 | if ( is_array( $ignored_themes ) ) { |
| 1095 | - $theme_upgrades = array_diff_key( $theme_upgrades, $ignored_themes ); | |
| 1137 | + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $ignored_themes ); | |
| 1096 | 1138 | } |
| 1097 | 1139 | |
| 1098 | 1140 | if ( is_array( $decodedIgnoredThemes ) ) { |
| 1099 | - $theme_upgrades = array_diff_key( $theme_upgrades, $decodedIgnoredThemes ); | |
| 1141 | + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $decodedIgnoredThemes ); | |
| 1100 | 1142 | } |
| 1101 | 1143 | } |
| 1102 | 1144 | $updateWebsites[ $site_id ] = $theme_upgrades; |
| 1103 | 1145 | } |
| @@ -1111,25 +1153,43 @@ | ||
| 1111 | 1153 | */ |
| 1112 | 1154 | do_action( 'mainwp_before_themes_table' ); |
| 1113 | 1155 | ?> |
| 1114 | 1156 | |
| 1157 | + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-themes-bulk-actions-tip' ) ) : ?> | |
| 1158 | + <div class="ui message"> | |
| 1159 | + <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-themes-bulk-actions-tip"></i> | |
| 1160 | + <div><em data-emoji=":bulb:" class="small"></em> <?php esc_html_e( 'Tip: Use Bulk Actions to activate, or delete selected themes.', 'mainwp' ); ?></div> | |
| 1161 | + </div> | |
| 1162 | + <?php endif; ?> | |
| 1163 | + | |
| 1115 | 1164 | <div class="ui secondary segment main-master-checkbox"> |
| 1116 | 1165 | <div class="ui stackable grid"> |
| 1117 | - <div class="one wide center aligned middle aligned column"> | |
| 1166 | + <div class="one wide left aligned middle aligned column"> | |
| 1118 | 1167 | <span class="trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></span> |
| 1119 | 1168 | </div> |
| 1120 | 1169 | <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> |
| 1121 | - <div class="five wide middle aligned column"><?php esc_html_e( 'Theme', 'mainwp' ); ?></div> | |
| 1170 | + <div class="six wide middle aligned column"><?php esc_html_e( 'Theme', 'mainwp' ); ?></div> | |
| 1122 | 1171 | <div class="two wide center aligned middle aligned column"></div> |
| 1123 | 1172 | <div class="two wide center aligned middle aligned column"></div> |
| 1124 | 1173 | <div class="two wide center aligned middle aligned column"></div> |
| 1125 | - <div class="two wide center aligned middle aligned column"><?php esc_html_e( 'Themes', 'mainwp' ); ?></div> | |
| 1174 | + <div class="two wide right aligned middle aligned column"><?php esc_html_e( 'Themes', 'mainwp' ); ?></div> | |
| 1126 | 1175 | </div> |
| 1127 | 1176 | </div> |
| 1128 | 1177 | <div class="mainwp-manage-themes-wrapper main-child-checkbox"> |
| 1129 | 1178 | <?php foreach ( $sites as $site_id => $website ) : ?> |
| 1130 | 1179 | <?php |
| 1131 | - $site_name = $website['websitename']; | |
| 1180 | + $site_name = $website['websitename']; | |
| 1181 | + $site_url = $website['websiteurl']; | |
| 1182 | + | |
| 1183 | + $wp_info = ! empty( $website['site_info'] ) ? json_decode( $website['site_info'], true ) : array(); | |
| 1184 | + | |
| 1185 | + if ( ! is_array( $wp_info ) ) { | |
| 1186 | + $wp_info = array(); | |
| 1187 | + } | |
| 1188 | + $use_tzformat = ! empty( $wp_info['format_datetime'] ) && is_array( $wp_info['format_datetime'] ) ? $wp_info['format_datetime'] : array(); | |
| 1189 | + $offs = ! empty( $use_tzformat['gmt_offset'] ) ? intval( $use_tzformat['gmt_offset'] ) : 0; | |
| 1190 | + $offs_info = esc_html__( '- Timezone:', 'mainwp' ) . ' UTC' . ( $offs >= 0 ? '+' . $offs : $offs ); | |
| 1191 | + | |
| 1132 | 1192 | $slugVersions = isset( $siteThemes[ $site_id ] ) ? $siteThemes[ $site_id ] : array(); |
| 1133 | 1193 | $item_id = $site_id; |
| 1134 | 1194 | $count_themes = count( $slugVersions ); |
| 1135 | 1195 | ?> |
| @@ -1135,19 +1195,19 @@ | ||
| 1135 | 1195 | ?> |
| 1136 | 1196 | <div class="ui accordion mainwp-manage-theme-accordion mainwp-manage-theme-item main-child-checkbox" id="<?php echo esc_html( $item_id ); ?>"> |
| 1137 | 1197 | <div class="title master-checkbox"> |
| 1138 | 1198 | <div class="ui stackable grid"> |
| 1139 | - <div class="one wide center aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div> | |
| 1199 | + <div class="one wide left aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div> | |
| 1140 | 1200 | <div class="one wide center aligned middle aligned column"><div class="ui checkbox master"><input type="checkbox"><label></label></div></div> |
| 1141 | - <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> | |
| 1201 | + <div class="four wide middle aligned column"><a target="_blank" href="<?php MainWP_Site_Open::get_open_site_admin_link( $site_id, true ); ?>"><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> | |
| 1142 | 1202 | <div class="two wide center aligned middle aligned column"></div> |
| 1143 | 1203 | <div class="two wide center aligned middle aligned column"></div> |
| 1144 | 1204 | <div class="two wide center aligned middle aligned column"></div> |
| 1145 | 1205 | <div class="two wide center aligned middle aligned column"></div> |
| 1146 | - <div class="two wide center aligned middle aligned column"><div class="ui label"><i class="icon tint"></i> <?php echo intval( $count_themes ); ?></div></div> | |
| 1206 | + <div class="two wide right aligned middle aligned column"><div class="ui label"><?php echo intval( $count_themes ) . ' ' . esc_html( _n( 'Theme', 'Themes', intval( $count_themes ), 'mainwp' ) ); ?></div></div> | |
| 1147 | 1207 | </div> |
| 1148 | 1208 | </div> |
| 1149 | - <div class="content child-checkbox"> | |
| 1209 | + <div class="content child-checkbox"> | |
| 1150 | 1210 | <?php |
| 1151 | 1211 | foreach ( $slugVersions as $slug_ver => $theme ) : |
| 1152 | 1212 | |
| 1153 | 1213 | $theme_slug = $themesSlug[ $slug_ver ]; |
| @@ -1178,8 +1238,9 @@ | ||
| 1178 | 1238 | |
| 1179 | 1239 | $not_delete = false; |
| 1180 | 1240 | $parent_str = ''; |
| 1181 | 1241 | if ( isset( $siteThemes[ $site_id ][ $slug_ver ]['parent_active'] ) && 1 === (int) $siteThemes[ $site_id ][ $slug_ver ]['parent_active'] ) { |
| 1242 | + /* translators: %s: Child theme name */ | |
| 1182 | 1243 | $parent_str = '<span data-tooltip="' . sprintf( esc_html__( 'Parent theme of the active theme (%s) on the site can not be deleted.', 'mainwp' ), isset( $siteThemes[ $site_id ][ $slug_ver ]['child_theme'] ) ? $siteThemes[ $site_id ][ $slug_ver ]['child_theme'] : '' ) . '" data-position="right center" data-inverted="" data-variation="mini"><i class="lock icon"></i></span>'; |
| 1183 | 1244 | $not_delete = true; |
| 1184 | 1245 | } |
| 1185 | 1246 | |
| @@ -1191,11 +1252,11 @@ | ||
| 1191 | 1252 | if ( isset( $siteThemes[ $site_id ][ $slug_ver ] ) && ( empty( $siteThemes[ $site_id ][ $slug_ver ]['active'] ) || 1 === (int) $siteThemes[ $site_id ][ $slug_ver ]['active'] ) ) { |
| 1192 | 1253 | $actived = true; |
| 1193 | 1254 | |
| 1194 | 1255 | if ( isset( $siteThemes[ $site_id ][ $slug_ver ]['active'] ) && 1 === (int) $siteThemes[ $site_id ][ $slug_ver ]['active'] ) { |
| 1195 | - $theme_status = '<span class="ui small green basic label">Active</span>'; | |
| 1256 | + $theme_status = '<span class="ui tiny grey label"><i class="circle green icon"></i> ' . esc_html__( 'Active', 'mainwp' ) . '</span>'; | |
| 1196 | 1257 | } elseif ( isset( $siteThemes[ $site_id ][ $slug_ver ]['active'] ) && empty( $siteThemes[ $site_id ][ $slug_ver ]['active'] ) ) { |
| 1197 | - $theme_status = '<span class="ui small red basic label">Inactive</span>'; | |
| 1258 | + $theme_status = '<span class="ui tiny grey label"><i class="circle red icon"></i> ' . esc_html__( 'Inactive', 'mainwp' ) . '</span>'; | |
| 1198 | 1259 | $actived = false; |
| 1199 | 1260 | } else { |
| 1200 | 1261 | $theme_status = ''; |
| 1201 | 1262 | } |
| @@ -1202,64 +1263,67 @@ | ||
| 1202 | 1263 | |
| 1203 | 1264 | $item_id = $slug_ver . '_' . $site_id; |
| 1204 | 1265 | $item_id = strtolower( $item_id ); |
| 1205 | 1266 | $item_id = preg_replace( '/[[:space:]]+/', '_', $item_id ); |
| 1267 | + | |
| 1268 | + $el_id_ite_id_1 = $item_id; | |
| 1206 | 1269 | ?> |
| 1207 | - <div class="ui very compact stackable grid mainwp-manage-theme-item-website <?php echo esc_html( $active_status_class ); ?>" updated="0" site-id="<?php echo intval( $site_id ); ?>" theme-slug="<?php echo esc_attr( $theme_slug ); ?>" theme-name="<?php echo esc_html( wp_strip_all_tags( $themesName[ $slug_ver ] ) ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_html( $site_name ); ?>" id="<?php echo esc_html( $item_id ); ?>" not-delete="<?php echo $not_delete ? 1 : 0; ?>" > | |
| 1270 | + <div class="ui very compact stackable grid mainwp-manage-theme-item-website <?php echo esc_html( $active_status_class ); ?>" updated="0" site-id="<?php echo intval( $site_id ); ?>" theme-slug="<?php echo esc_attr( $theme_slug ); ?>" theme-name="<?php echo esc_html( wp_strip_all_tags( $themesName[ $slug_ver ] ) ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_html( $site_name ); ?>" site-url="<?php echo esc_html( $site_url ); ?>" tz-info="<?php echo esc_attr( $offs_info ); ?>" id="<?php echo esc_html( $el_id_ite_id_1 ); ?>" not-delete="<?php echo $not_delete ? 1 : 0; ?>" is-actived="<?php echo $actived ? 1 : 0; ?>" > | |
| 1208 | 1271 | <div class="one wide center aligned middle aligned column"></div> |
| 1209 | 1272 | <div class="one wide center aligned middle aligned column"> |
| 1210 | 1273 | |
| 1211 | 1274 | <?php if ( '' !== $parent_str ) : ?> |
| 1212 | 1275 | <?php echo $parent_str; //phpcs:ignore -- escaped. ?> |
| 1213 | - <?php elseif ( $actived ) : ?> | |
| 1214 | - <span data-tooltip="<?php echo esc_html__( 'Active theme on the site can not be deleted.', 'mainwp' ); ?>" data-position="right center" data-inverted="" data-variation="mini"><i class="lock icon"></i></span> | |
| 1215 | - <?php else : ?> | |
| 1216 | - <div class="ui checkbox"> | |
| 1217 | - <input type="checkbox" class="mainwp-selected-theme-site" /> | |
| 1218 | - <label></label> | |
| 1276 | + <?php endif; ?> | |
| 1277 | + <div class="ui checkbox"> | |
| 1278 | + <input type="checkbox" class="mainwp-selected-theme-site" /> | |
| 1279 | + <label></label> | |
| 1280 | + </div> | |
| 1219 | 1281 | </div> |
| 1220 | - <?php endif; ?> | |
| 1221 | - </div> | |
| 1222 | 1282 | <div class="one wide center aligned middle aligned column"><?php echo MainWP_System_Utility::get_theme_icon( $theme_slug ); // phpcs:ignore WordPress.Security.EscapeOutput ?></div> |
| 1223 | - <div class="three wide middle aligned column"><strong><?php echo esc_html( $theme_title ); ?></strong></div> | |
| 1224 | - <div class="one wide center aligned middle aligned column"><?php echo $theme_status; // phpcs:ignore WordPress.Security.EscapeOutput ?></div> | |
| 1225 | - <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> | |
| 1226 | - <div class="one wide center aligned middle aligned column"></div> | |
| 1283 | + <div class="two wide middle aligned column"><strong><?php echo esc_html( $theme_title ); ?></strong></div> | |
| 1284 | + <div class="two wide center aligned middle aligned column"><?php echo $theme_status; // phpcs:ignore WordPress.Security.EscapeOutput ?></div> | |
| 1285 | + <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> | |
| 1286 | + | |
| 1227 | 1287 | <div class="two wide center aligned middle aligned column current-version"> |
| 1228 | - <?php echo esc_html( $theme_version ); ?> | |
| 1229 | - <?php if ( ! empty( $new_version ) ) : ?> | |
| 1230 | - → | |
| 1231 | - <?php | |
| 1232 | - if ( ! empty( $roll_list[ $site_id ][ $theme_slug ][ $new_version ] ) ) { | |
| 1233 | - echo MainWP_Updates_Helper::get_roll_msg( $roll_list[ $site_id ][ $theme_slug ][ $new_version ], true, 'notice' ); //phpcs:ignore -- NOSONAR -- ok. | |
| 1234 | - } | |
| 1235 | - echo esc_html( $new_version ); | |
| 1236 | - ?> | |
| 1288 | + <span class="ui small text"> | |
| 1289 | + <?php echo esc_html( $theme_version ); ?> | |
| 1290 | + <?php if ( ! empty( $new_version ) ) : ?> | |
| 1291 | + → | |
| 1292 | + <?php | |
| 1293 | + if ( ! empty( $roll_list[ $site_id ][ $theme_slug ][ $new_version ] ) ) { | |
| 1294 | + echo MainWP_Updates_Helper::get_roll_msg( $roll_list[ $site_id ][ $theme_slug ][ $new_version ], true, 'notice' ); //phpcs:ignore -- NOSONAR -- ok. | |
| 1295 | + } | |
| 1296 | + echo esc_html( $new_version ); | |
| 1297 | + ?> | |
| 1237 | 1298 | <?php endif; ?> |
| 1299 | + </span> | |
| 1238 | 1300 | </div> |
| 1239 | 1301 | <div class="two wide right aligned middle aligned column update-column"> |
| 1240 | - <?php if ( ! empty( $upgradeInfo ) && MainWP_Updates::user_can_update_themes() ) : ?> | |
| 1241 | - <a href="javascript:void(0)" class="ui mini green basic <?php echo $is_demo ? 'disabled' : ''; ?> button" onClick="return manage_themes_upgrade_theme( '<?php echo esc_js( rawurlencode( $theme_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update Now', 'mainwp' ); ?></a> | |
| 1242 | - <?php endif; ?> | |
| 1302 | + <?php if ( ! empty( $upgradeInfo ) && MainWP_Updates::user_can_update_themes() ) : ?> | |
| 1303 | + <a href="javascript:void(0)" class="ui mini green basic button" onClick="return manage_themes_upgrade_theme( '<?php echo esc_js( rawurlencode( $theme_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update', 'mainwp' ); ?></a> | |
| 1304 | + <?php endif; ?> | |
| 1243 | 1305 | </div> |
| 1306 | + <div class="one wide center aligned middle aligned column"> | |
| 1307 | + <a href="#" history-view="manage-themes-per-sites" class="mainwp-show-history ui mini icon grey basic button" data-tooltip="<?php esc_attr_e( 'View history', 'mainwp' ); ?>" data-inverted="" data-possition="center left"><i class="history icon"></i></a> | |
| 1308 | + </div> | |
| 1244 | 1309 | <div class="two wide center aligned middle aligned column column-actions"> |
| 1245 | - <?php if ( $actived ) : ?> | |
| 1246 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_themes' ) ) { ?> | |
| 1247 | - <a href="javascript:void(0)" disabled class="ui mini fluid <?php echo $is_demo ? 'disabled' : ''; ?> button"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></a> | |
| 1248 | - <?php } ?> | |
| 1249 | - <?php else : ?> | |
| 1250 | - <div class="ui mini fluid buttons"> | |
| 1251 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_themes' ) ) { ?> | |
| 1252 | - <a href="javascript:void(0)" class="mainwp-manages-theme-activate ui green <?php echo $is_demo ? 'disabled' : ''; ?> button"><?php esc_html_e( 'Activate', 'mainwp' ); ?></a> | |
| 1253 | - <?php } ?> | |
| 1254 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_themes' ) && ! $not_delete ) { ?> | |
| 1255 | - <a href="javascript:void(0)" class="mainwp-manages-theme-delete ui <?php echo $is_demo ? 'disabled' : ''; ?> button"><?php esc_html_e( 'Delete', 'mainwp' ); ?></a> | |
| 1256 | - <?php } ?> | |
| 1257 | - </div> | |
| 1258 | - <?php endif; ?> | |
| 1310 | + <?php if ( $actived ) : ?> | |
| 1311 | + <span data-tooltip="<?php echo esc_html__( 'Active theme on the site can not be deleted.', 'mainwp' ); ?>" data-position="bottom left" data-inverted="" data-variation="mini"><i class="lock icon"></i></span> | |
| 1312 | + <?php else : ?> | |
| 1313 | + <div class="ui mini fluid buttons"> | |
| 1314 | + | |
| 1315 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_themes' ) ) { ?> | |
| 1316 | + <a href="javascript:void(0)" class="mainwp-manages-theme-activate ui green button"><?php esc_html_e( 'Activate', 'mainwp' ); ?></a> | |
| 1317 | + <?php } ?> | |
| 1318 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_themes' ) && ! $not_delete ) { ?> | |
| 1319 | + <a href="javascript:void(0)" class="mainwp-manages-theme-delete ui button"><?php esc_html_e( 'Delete', 'mainwp' ); ?></a> | |
| 1320 | + <?php } ?> | |
| 1321 | + </div> | |
| 1322 | + <?php endif; ?> | |
| 1259 | 1323 | </div> |
| 1260 | 1324 | </div> |
| 1261 | - <?php | |
| 1325 | + <?php | |
| 1262 | 1326 | } |
| 1263 | 1327 | endforeach; |
| 1264 | 1328 | ?> |
| 1265 | 1329 | </div> |
| @@ -1266,14 +1330,8 @@ | ||
| 1266 | 1330 | </div> |
| 1267 | 1331 | <?php endforeach; ?> |
| 1268 | 1332 | </div> |
| 1269 | 1333 | <script type="text/javascript"> |
| 1270 | - jQuery( '.mainwp-manage-theme-accordion' ).accordion( { | |
| 1271 | - "selector": { | |
| 1272 | - "trigger" : '.dropdown-trigger', | |
| 1273 | - } | |
| 1274 | - } ); | |
| 1275 | - | |
| 1276 | 1334 | jQuery( '.trigger-all-accordion' ).on( 'click', function() { // not use document here. |
| 1277 | 1335 | if ( jQuery( this ).hasClass( 'active' ) ) { |
| 1278 | 1336 | jQuery( this ).removeClass( 'active' ); |
| 1279 | 1337 | jQuery( '.mainwp-manage-themes-wrapper .ui.accordion div.title' ).each( function( i ) { |
| @@ -1292,8 +1350,14 @@ | ||
| 1292 | 1350 | return false; |
| 1293 | 1351 | } ); |
| 1294 | 1352 | |
| 1295 | 1353 | jQuery(function($) { |
| 1354 | + $( '.mainwp-manage-theme-accordion' ).accordion( { | |
| 1355 | + "selector": { | |
| 1356 | + "trigger":'.dropdown-trigger', | |
| 1357 | + } | |
| 1358 | + }); | |
| 1359 | + | |
| 1296 | 1360 | mainwp_master_checkbox_init($); |
| 1297 | 1361 | mainwp_get_icon_start(); |
| 1298 | 1362 | mainwp_show_hide_install_to_selected_sites( 'theme' ); |
| 1299 | 1363 | }); |
| @@ -1318,9 +1382,9 @@ | ||
| 1318 | 1382 | * |
| 1319 | 1383 | * @param array $sites List of sites. |
| 1320 | 1384 | * @param array $themesName List of themes. |
| 1321 | 1385 | * @param array $siteThemes List of themes for the site. |
| 1322 | - * @param string $themesSlug List of theme slugs. | |
| 1386 | + * @param array $themesSlug List of theme slugs. | |
| 1323 | 1387 | * @param array $themesNameSites Installed theme version. |
| 1324 | 1388 | * @param string $themesRealVersion Current theme version. |
| 1325 | 1389 | * @param array $roll_list roll items list. |
| 1326 | 1390 | */ |
| @@ -1365,13 +1429,13 @@ | ||
| 1365 | 1429 | } |
| 1366 | 1430 | } |
| 1367 | 1431 | $ignored_themes = json_decode( $website->ignored_themes, true ); |
| 1368 | 1432 | if ( is_array( $ignored_themes ) ) { |
| 1369 | - $theme_upgrades = array_diff_key( $theme_upgrades, $ignored_themes ); | |
| 1433 | + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $ignored_themes ); | |
| 1370 | 1434 | } |
| 1371 | 1435 | |
| 1372 | 1436 | if ( is_array( $decodedIgnoredThemes ) ) { |
| 1373 | - $theme_upgrades = array_diff_key( $theme_upgrades, $decodedIgnoredThemes ); | |
| 1437 | + $theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $decodedIgnoredThemes ); | |
| 1374 | 1438 | } |
| 1375 | 1439 | } |
| 1376 | 1440 | $updateWebsites[ $site_id ] = $theme_upgrades; |
| 1377 | 1441 | } |
| @@ -1385,11 +1449,18 @@ | ||
| 1385 | 1449 | */ |
| 1386 | 1450 | do_action( 'mainwp_before_themes_table' ); |
| 1387 | 1451 | ?> |
| 1388 | 1452 | |
| 1453 | + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-themes-bulk-actions-tip' ) ) : ?> | |
| 1454 | + <div class="ui message"> | |
| 1455 | + <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-themes-bulk-actions-tip"></i> | |
| 1456 | + <div><em data-emoji=":bulb:" class="small"></em> <?php esc_html_e( 'Tip: Use Bulk Actions to activate, or delete selected themes.', 'mainwp' ); ?></div> | |
| 1457 | + </div> | |
| 1458 | + <?php endif; ?> | |
| 1459 | + | |
| 1389 | 1460 | <div class="ui secondary segment main-master-checkbox"> |
| 1390 | 1461 | <div class="ui stackable grid"> |
| 1391 | - <div class="one wide center aligned middle aligned column"> | |
| 1462 | + <div class="one wide left aligned middle aligned column"> | |
| 1392 | 1463 | <span class="trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></span> |
| 1393 | 1464 | </div> |
| 1394 | 1465 | <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> |
| 1395 | 1466 | <div class="one wide center aligned middle aligned column"></div> |
| @@ -1394,11 +1465,11 @@ | ||
| 1394 | 1465 | <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> |
| 1395 | 1466 | <div class="one wide center aligned middle aligned column"></div> |
| 1396 | 1467 | <div class="five wide middle aligned column"><?php esc_html_e( 'Theme', 'mainwp' ); ?></div> |
| 1397 | 1468 | <div class="two wide center aligned middle aligned column"></div> |
| 1398 | - <div class="two wide center aligned middle aligned column"><?php esc_html_e( 'Latest Version', 'mainwp' ); ?></div> | |
| 1469 | + <div class="two wide right aligned middle aligned column"><?php esc_html_e( 'Latest Version', 'mainwp' ); ?></div> | |
| 1399 | 1470 | <div class="two wide center aligned middle aligned column"></div> |
| 1400 | - <div class="two wide center aligned middle aligned column"><?php esc_html_e( 'Websites', 'mainwp' ); ?></div> | |
| 1471 | + <div class="two wide right aligned middle aligned column"><?php esc_html_e( 'Websites', 'mainwp' ); ?></div> | |
| 1401 | 1472 | </div> |
| 1402 | 1473 | </div> |
| 1403 | 1474 | <div class="mainwp-manage-themes-wrapper main-child-checkbox"> |
| 1404 | 1475 | <?php foreach ( $themesNameSites as $theme_title => $themeSites ) : ?> |
| @@ -1415,16 +1486,16 @@ | ||
| 1415 | 1486 | ?> |
| 1416 | 1487 | <div class="ui accordion mainwp-manage-theme-accordion mainwp-manage-theme-item main-child-checkbox" id="<?php echo esc_html( $item_id ); ?>"> |
| 1417 | 1488 | <div class="title master-checkbox"> |
| 1418 | 1489 | <div class="ui stackable grid"> |
| 1419 | - <div class="one wide center aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div> | |
| 1490 | + <div class="one wide left aligned middle aligned column"><i class="dropdown icon dropdown-trigger"></i></div> | |
| 1420 | 1491 | <div class="one wide center aligned middle aligned column"><div class="ui checkbox master"><input type="checkbox"><label></label></div></div> |
| 1421 | 1492 | <div class="one wide center aligned middle aligned column"><?php echo MainWP_System_Utility::get_theme_icon( $theme_slug_first ); // phpcs:ignore WordPress.Security.EscapeOutput ?></div> |
| 1422 | 1493 | <div class="five wide middle aligned column"><strong><?php echo esc_html( $theme_title ); ?></strong></div> |
| 1423 | 1494 | <div class="two wide center aligned middle aligned column"></div> |
| 1424 | - <div class="two wide center aligned middle aligned column lastest-version-info"></div> | |
| 1495 | + <div class="two wide right aligned middle aligned column lastest-version-info"></div> | |
| 1425 | 1496 | <div class="two wide center aligned middle aligned column"></div> |
| 1426 | - <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> | |
| 1497 | + <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> | |
| 1427 | 1498 | </div> |
| 1428 | 1499 | </div> |
| 1429 | 1500 | <div class="content child-checkbox"> |
| 1430 | 1501 | <?php |
| @@ -1430,9 +1501,18 @@ | ||
| 1430 | 1501 | <?php |
| 1431 | 1502 | foreach ( $themeSites as $site_id => $slugVersions ) : |
| 1432 | 1503 | |
| 1433 | 1504 | $site_name = $sites[ $site_id ]['websitename']; |
| 1505 | + $site_url = $sites[ $site_id ]['websiteurl']; | |
| 1434 | 1506 | |
| 1507 | + $wp_info = ! empty( $sites[ $site_id ]['site_info'] ) ? json_decode( $sites[ $site_id ]['site_info'], true ) : array(); | |
| 1508 | + if ( ! is_array( $wp_info ) ) { | |
| 1509 | + $wp_info = array(); | |
| 1510 | + } | |
| 1511 | + $use_tzformat = ! empty( $wp_info['format_datetime'] ) && is_array( $wp_info['format_datetime'] ) ? $wp_info['format_datetime'] : array(); | |
| 1512 | + $offs = ! empty( $use_tzformat['gmt_offset'] ) ? intval( $use_tzformat['gmt_offset'] ) : 0; | |
| 1513 | + $offs_info = esc_html__( '- Timezone:', 'mainwp' ) . ' UTC' . ( $offs >= 0 ? '+' . $offs : $offs ); | |
| 1514 | + | |
| 1435 | 1515 | foreach ( $slugVersions as $slug_ver ) : |
| 1436 | 1516 | |
| 1437 | 1517 | $theme_slug = $themesSlug[ $slug_ver ]; |
| 1438 | 1518 | $trusted = in_array( $theme_slug, $trustedThemes ) ? true : false; |
| @@ -1461,8 +1541,9 @@ | ||
| 1461 | 1541 | |
| 1462 | 1542 | $not_delete = false; |
| 1463 | 1543 | $parent_str = ''; |
| 1464 | 1544 | if ( isset( $siteThemes[ $site_id ][ $slug_ver ]['parent_active'] ) && 1 === (int) $siteThemes[ $site_id ][ $slug_ver ]['parent_active'] ) { |
| 1545 | + /* translators: %s: Child theme name */ | |
| 1465 | 1546 | $parent_str = '<span data-tooltip="' . sprintf( esc_html__( 'Parent theme of the active theme (%s) on the site can not be deleted.', 'mainwp' ), isset( $siteThemes[ $site_id ][ $slug_ver ]['child_theme'] ) ? $siteThemes[ $site_id ][ $slug_ver ]['child_theme'] : '' ) . '" data-position="right center" data-inverted="" data-variation="mini"><i class="lock icon"></i></span>'; |
| 1466 | 1547 | $not_delete = true; |
| 1467 | 1548 | } |
| 1468 | 1549 | |
| @@ -1482,11 +1563,11 @@ | ||
| 1482 | 1563 | if ( isset( $siteThemes[ $site_id ][ $slug_ver ] ) && ( 0 === (int) $siteThemes[ $site_id ][ $slug_ver ]['active'] || 1 === (int) $siteThemes[ $site_id ][ $slug_ver ]['active'] ) ) { |
| 1483 | 1564 | $actived = true; |
| 1484 | 1565 | |
| 1485 | 1566 | if ( isset( $siteThemes[ $site_id ][ $slug_ver ]['active'] ) && 1 === (int) $siteThemes[ $site_id ][ $slug_ver ]['active'] ) { |
| 1486 | - $theme_status = '<span class="ui small green basic label">Active</span>'; | |
| 1567 | + $theme_status = '<span class="ui tiny grey label"><i class="circle green icon"></i> ' . esc_html__( 'Active', 'mainwp' ) . '</span>'; | |
| 1487 | 1568 | } elseif ( isset( $siteThemes[ $site_id ][ $slug_ver ]['active'] ) && 0 === (int) $siteThemes[ $site_id ][ $slug_ver ]['active'] ) { |
| 1488 | - $theme_status = '<span class="ui small red basic label">Inactive</span>'; | |
| 1569 | + $theme_status = '<span class="ui tiny grey label"><i class="circle red icon"></i> ' . esc_html__( 'Inactive', 'mainwp' ) . '</span>'; | |
| 1489 | 1570 | $actived = false; |
| 1490 | 1571 | } else { |
| 1491 | 1572 | $theme_status = ''; |
| 1492 | 1573 | } |
| @@ -1494,30 +1575,29 @@ | ||
| 1494 | 1575 | $item_id = $slug_ver . '_' . $site_id; |
| 1495 | 1576 | $item_id = strtolower( $item_id ); |
| 1496 | 1577 | $item_id = preg_replace( '/[[:space:]]+/', '_', $item_id ); |
| 1497 | 1578 | |
| 1579 | + $el_id_ite_id_2 = $item_id; | |
| 1498 | 1580 | ?> |
| 1499 | - <div class="ui very compact stackable grid mainwp-manage-theme-item-website <?php echo esc_html( $active_status_class ); ?>" updated="0" site-id="<?php echo intval( $site_id ); ?>" theme-slug="<?php echo esc_attr( $theme_slug ); ?>" theme-name="<?php echo esc_html( wp_strip_all_tags( $themesName[ $slug_ver ] ) ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_html( $site_name ); ?>" id="<?php echo esc_html( $item_id ); ?>" not-delete="<?php echo $not_delete ? 1 : 0; ?>" > | |
| 1500 | - <div class="one wide center aligned middle aligned column"></div> | |
| 1501 | - <div class="one wide center aligned middle aligned column"> | |
| 1502 | - | |
| 1503 | - <?php if ( '' !== $parent_str ) : ?> | |
| 1504 | - <?php echo $parent_str; //phpcs:ignore -- escaped. ?> | |
| 1505 | - <?php elseif ( $actived ) : ?> | |
| 1506 | - <span data-tooltip="<?php echo esc_html__( 'Active theme on the site can not be deleted.', 'mainwp' ); ?>" data-position="right center" data-inverted="" data-variation="mini"><i class="lock icon"></i></span> | |
| 1507 | - <?php else : ?> | |
| 1508 | - <div class="ui checkbox"> | |
| 1509 | - <input type="checkbox" class="mainwp-selected-theme-site" /> | |
| 1510 | - <label></label> | |
| 1581 | + <div class="ui very compact stackable grid mainwp-manage-theme-item-website <?php echo esc_html( $active_status_class ); ?>" updated="0" site-id="<?php echo intval( $site_id ); ?>" theme-slug="<?php echo esc_attr( $theme_slug ); ?>" theme-name="<?php echo esc_html( wp_strip_all_tags( $themesName[ $slug_ver ] ) ); ?>" site-id="<?php echo intval( $site_id ); ?>" site-name="<?php echo esc_html( $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_id_2 ); ?>" not-delete="<?php echo $not_delete ? 1 : 0; ?>" is-actived="<?php echo $actived ? 1 : 0; ?>" > | |
| 1582 | + <div class="one wide center aligned middle aligned column"></div> | |
| 1583 | + <div class="one wide left aligned middle aligned column"> | |
| 1584 | + <?php if ( '' !== $parent_str ) : ?> | |
| 1585 | + <?php echo $parent_str; //phpcs:ignore -- escaped. ?> | |
| 1586 | + <?php endif; ?> | |
| 1587 | + <div class="ui checkbox"> | |
| 1588 | + <input type="checkbox" class="mainwp-selected-theme-site" /> | |
| 1589 | + <label></label> | |
| 1590 | + </div> | |
| 1511 | 1591 | </div> |
| 1512 | - <?php endif; ?> | |
| 1513 | - </div> | |
| 1514 | - <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> | |
| 1592 | + <div class="two wide middle aligned column"><a target="_blank" href="<?php MainWP_Site_Open::get_open_site_admin_link( $site_id, true ); ?>"><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> | |
| 1515 | 1593 | <div class="one wide middle aligned column"></div> |
| 1516 | - <div class="one wide center aligned middle aligned column"><?php echo $theme_status; // phpcs:ignore WordPress.Security.EscapeOutput ?></div> | |
| 1517 | - <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> | |
| 1518 | - <div class="one wide center aligned middle aligned column"></div> | |
| 1519 | - <div class="two wide center aligned middle aligned column current-version"> | |
| 1594 | + <div class="two wide center aligned middle aligned column"><?php echo $theme_status; // phpcs:ignore WordPress.Security.EscapeOutput ?></div> | |
| 1595 | + <div class="two wide center aligned middle aligned column"> | |
| 1596 | + <?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> | |
| 1597 | + | |
| 1598 | + <div class="two wide right aligned middle aligned column current-version"> | |
| 1599 | + <span class="ui small text"> | |
| 1520 | 1600 | <?php echo esc_html( $theme_version ); ?> |
| 1521 | 1601 | <?php if ( ! empty( $new_version ) ) : ?> |
| 1522 | 1602 | → |
| 1523 | 1603 | <?php |
| @@ -1526,26 +1606,28 @@ | ||
| 1526 | 1606 | } |
| 1527 | 1607 | echo esc_html( $new_version ); |
| 1528 | 1608 | ?> |
| 1529 | 1609 | <?php endif; ?> |
| 1610 | + </span> | |
| 1530 | 1611 | </div> |
| 1531 | 1612 | <div class="two wide right aligned middle aligned column update-column"> |
| 1532 | 1613 | <?php if ( ! empty( $upgradeInfo ) && MainWP_Updates::user_can_update_themes() ) : ?> |
| 1533 | - <a href="javascript:void(0)" class="ui mini green basic <?php echo $is_demo ? 'disabled' : ''; ?> button" onClick="return manage_themes_upgrade_theme( '<?php echo esc_js( rawurlencode( $theme_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update Now', 'mainwp' ); ?></a> | |
| 1614 | + <a href="javascript:void(0)" class="ui mini green basic button" onClick="return manage_themes_upgrade_theme( '<?php echo esc_js( rawurlencode( $theme_slug ) ); ?>', <?php echo esc_attr( $site_id ); ?> )"><?php esc_html_e( 'Update', 'mainwp' ); ?></a> | |
| 1534 | 1615 | <?php endif; ?> |
| 1535 | 1616 | </div> |
| 1617 | + <div class="one wide center aligned middle aligned column"> | |
| 1618 | + <a href="#" history-view="manage-themes-per-items" class="mainwp-show-history ui mini icon grey basic button" data-tooltip="<?php esc_attr_e( 'View history', 'mainwp' ); ?>" data-inverted="" data-possition="center left"><i class="history icon"></i></a> | |
| 1619 | + </div> | |
| 1536 | 1620 | <div class="two wide center aligned middle aligned column column-actions"> |
| 1537 | 1621 | <?php if ( $actived ) : ?> |
| 1538 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_themes' ) ) { ?> | |
| 1539 | - <a href="javascript:void(0)" disabled class="ui mini fluid <?php echo $is_demo ? 'disabled' : ''; ?> button"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></a> | |
| 1540 | - <?php } ?> | |
| 1622 | + <span data-tooltip="<?php echo esc_html__( 'Active theme on the site can not be deactivated.', 'mainwp' ); ?>" data-position="bottom left" data-inverted="" data-variation="mini"><i class="lock icon"></i></span> | |
| 1541 | 1623 | <?php else : ?> |
| 1542 | 1624 | <div class="ui mini fluid buttons"> |
| 1543 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_deactivate_themes' ) ) { ?> | |
| 1544 | - <a href="javascript:void(0)" class="mainwp-manages-theme-activate ui green <?php echo $is_demo ? 'disabled' : ''; ?> button"><?php esc_html_e( 'Activate', 'mainwp' ); ?></a> | |
| 1625 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_themes' ) ) { ?> | |
| 1626 | + <a href="javascript:void(0)" class="mainwp-manages-theme-activate ui green button"><?php esc_html_e( 'Activate', 'mainwp' ); ?></a> | |
| 1545 | 1627 | <?php } ?> |
| 1546 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_themes' ) && ! $not_delete ) { ?> | |
| 1547 | - <a href="javascript:void(0)" class="mainwp-manages-theme-delete ui <?php echo $is_demo ? 'disabled' : ''; ?> button"><?php esc_html_e( 'Delete', 'mainwp' ); ?></a> | |
| 1628 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_themes' ) && ! $not_delete ) { ?> | |
| 1629 | + <a href="javascript:void(0)" class="mainwp-manages-theme-delete ui button"><?php esc_html_e( 'Delete', 'mainwp' ); ?></a> | |
| 1548 | 1630 | <?php } ?> |
| 1549 | 1631 | </div> |
| 1550 | 1632 | <?php endif; ?> |
| 1551 | 1633 | </div> |
| @@ -1564,14 +1646,8 @@ | ||
| 1564 | 1646 | </div> |
| 1565 | 1647 | |
| 1566 | 1648 | |
| 1567 | 1649 | <script type="text/javascript"> |
| 1568 | - jQuery( '.mainwp-manage-theme-accordion' ).accordion( { | |
| 1569 | - "selector": { | |
| 1570 | - "trigger" : '.dropdown-trigger', | |
| 1571 | - } | |
| 1572 | - } ); | |
| 1573 | - | |
| 1574 | 1650 | jQuery( '.trigger-all-accordion' ).on( 'click', function() { // not use document here. |
| 1575 | 1651 | if ( jQuery( this ).hasClass( 'active' ) ) { |
| 1576 | 1652 | jQuery( this ).removeClass( 'active' ); |
| 1577 | 1653 | jQuery( '.mainwp-manage-themes-wrapper .ui.accordion div.title' ).each( function( i ) { |
| @@ -1590,8 +1666,14 @@ | ||
| 1590 | 1666 | return false; |
| 1591 | 1667 | } ); |
| 1592 | 1668 | |
| 1593 | 1669 | jQuery(function($) { |
| 1670 | + jQuery( '.mainwp-manage-theme-accordion' ).accordion({ | |
| 1671 | + "selector": { | |
| 1672 | + "trigger" : '.dropdown-trigger', | |
| 1673 | + } | |
| 1674 | + }); | |
| 1675 | + | |
| 1594 | 1676 | $('.lastest-version-hidden').each(function(){ |
| 1595 | 1677 | $(this).closest('.mainwp-manage-theme-item').find('.lastest-version-info').html($(this).attr('lastest-version')); |
| 1596 | 1678 | }); |
| 1597 | 1679 | mainwp_master_checkbox_init($); |
| @@ -1621,34 +1703,34 @@ | ||
| 1621 | 1703 | */ |
| 1622 | 1704 | public static function render_bulk_actions( $status ) { // phpcs:ignore -- NOSONAR - complex. |
| 1623 | 1705 | ob_start(); |
| 1624 | 1706 | ?> |
| 1625 | - <select class="ui dropdown" id="mainwp-bulk-actions"> | |
| 1626 | - <option value="none"><?php esc_html_e( 'Bulk Actions', 'mainwp' ); ?></option> | |
| 1627 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 1628 | - <option data-value="ignore_updates" value="ignore_updates"><?php esc_html_e( 'Ignore updates', 'mainwp' ); ?></option> | |
| 1707 | + <select class="ui compact dropdown" id="mainwp-bulk-actions"> | |
| 1708 | + <option value="none"><?php esc_html_e( 'Bulk actions', 'mainwp' ); ?></option> | |
| 1709 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 1710 | + <option data-value="ignore_updates" value="ignore_updates"><?php esc_html_e( 'Ignore updates', 'mainwp' ); ?></option> | |
| 1711 | + <?php endif; ?> | |
| 1712 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_themes' ) ) : ?> | |
| 1713 | + <?php if ( 'inactive' === $status ) : ?> | |
| 1714 | + <option data-value="activate" value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?></option> | |
| 1715 | + <?php else : ?> | |
| 1716 | + <option data-value="activate" disabled value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?><br/><span class="ui small text"><?php esc_html_e( 'To deactivate, view Active themes.', 'mainwp' ); ?></span></option> | |
| 1629 | 1717 | <?php endif; ?> |
| 1630 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_themes' ) ) : ?> | |
| 1631 | - <?php if ( 'inactive' === $status ) : ?> | |
| 1632 | - <option data-value="activate" value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?></option> | |
| 1633 | - <?php else : ?> | |
| 1634 | - <option data-value="activate" disabled value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?></option> | |
| 1635 | - <?php endif; ?> | |
| 1636 | 1718 | <?php endif; ?> |
| 1637 | 1719 | <?php if ( 'inactive' === $status ) : ?> |
| 1638 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_themes' ) ) : ?> | |
| 1720 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_themes' ) ) : ?> | |
| 1639 | 1721 | <option data-value="delete" value="delete"><?php esc_html_e( 'Delete', 'mainwp' ); ?></option> |
| 1640 | 1722 | <?php endif; ?> |
| 1641 | 1723 | <?php else : ?> |
| 1642 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_themes' ) ) : ?> | |
| 1724 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_themes' ) ) : ?> | |
| 1643 | 1725 | <option data-value="delete" disabled value="delete"><?php esc_html_e( 'Delete', 'mainwp' ); ?></option> |
| 1644 | 1726 | <?php endif; ?> |
| 1645 | 1727 | <?php endif; ?> |
| 1646 | 1728 | <?php if ( 'all' === $status ) : ?> |
| 1647 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'activate_themes' ) ) : ?> | |
| 1648 | - <option data-value="activate" disabled value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?></option> | |
| 1729 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_themes' ) ) : ?> | |
| 1730 | + <option data-value="activate" disabled value="activate"><?php esc_html_e( 'Activate', 'mainwp' ); ?><br/><span class="ui small text"><?php esc_html_e( 'To activate, view Inactive themes.', 'mainwp' ); ?></span></option> | |
| 1649 | 1731 | <?php endif; ?> |
| 1650 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'delete_themes' ) ) : ?> | |
| 1732 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_themes' ) ) : ?> | |
| 1651 | 1733 | <option data-value="delete" disabled value="delete"><?php esc_html_e( 'Delete', 'mainwp' ); ?></option> |
| 1652 | 1734 | <?php endif; ?> |
| 1653 | 1735 | <?php endif; ?> |
| 1654 | 1736 | |
| @@ -1686,18 +1768,19 @@ | ||
| 1686 | 1768 | 'installURI' => null, |
| 1687 | 1769 | 'adminUrl' => wp_parse_url( self_admin_url(), PHP_URL_PATH ), |
| 1688 | 1770 | ), |
| 1689 | 1771 | 'l10n' => array( |
| 1690 | - 'addNew' => esc_html__( 'Add new theme' ), | |
| 1691 | - 'search' => esc_html__( 'Search themes' ), | |
| 1692 | - 'searchPlaceholder' => esc_html__( 'Search themes...' ), | |
| 1693 | - 'upload' => esc_html__( 'Upload theme' ), | |
| 1694 | - 'back' => esc_html__( 'Back' ), | |
| 1695 | - 'error' => esc_html__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), | |
| 1696 | - 'themesFound' => esc_html__( 'Number of themes found: %d' ), | |
| 1697 | - 'noThemesFound' => esc_html__( 'No themes found. Try a different search.' ), | |
| 1698 | - 'collapseSidebar' => esc_html__( 'Collapse sidebar' ), | |
| 1699 | - 'expandSidebar' => esc_html__( 'Expand sidebar' ), | |
| 1772 | + 'addNew' => esc_html__( 'Add new theme', 'mainwp' ), | |
| 1773 | + 'search' => esc_html__( 'Search themes', 'mainwp' ), | |
| 1774 | + 'searchPlaceholder' => esc_html__( 'Search themes...', 'mainwp' ), | |
| 1775 | + 'upload' => esc_html__( 'Upload theme', 'mainwp' ), | |
| 1776 | + 'back' => esc_html__( 'Back', 'mainwp' ), | |
| 1777 | + 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.', 'mainwp' ), | |
| 1778 | + /* translators: %d: number of themes */ | |
| 1779 | + 'themesFound' => esc_html__( 'Number of themes found: %d', 'mainwp' ), | |
| 1780 | + 'noThemesFound' => esc_html__( 'No themes found. Try a different search.', 'mainwp' ), | |
| 1781 | + 'collapseSidebar' => esc_html__( 'Collapse sidebar', 'mainwp' ), | |
| 1782 | + 'expandSidebar' => esc_html__( 'Expand sidebar', 'mainwp' ), | |
| 1700 | 1783 | ), |
| 1701 | 1784 | 'installedThemes' => array(), |
| 1702 | 1785 | ) |
| 1703 | 1786 | ); |
| @@ -1713,22 +1796,37 @@ | ||
| 1713 | 1796 | * |
| 1714 | 1797 | * @uses \MainWP\Dashboard\MainWP_Install_Bulk::render_upload() |
| 1715 | 1798 | */ |
| 1716 | 1799 | public static function render_themes_table() { |
| 1717 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'install_themes' ) ) { | |
| 1718 | - mainwp_do_not_have_permissions( esc_html__( 'install themes', 'mainwp' ) ); | |
| 1800 | + if ( ! \mainwp_current_user_can( 'dashboard', 'install_themes' ) ) { | |
| 1801 | + \mainwp_do_not_have_permissions( esc_html__( 'install themes', 'mainwp' ) ); | |
| 1719 | 1802 | return; |
| 1720 | 1803 | } |
| 1721 | - $favorites_enabled = is_plugin_active( 'mainwp-favorites-extension/mainwp-favorites-extension.php' ); | |
| 1722 | 1804 | ?> |
| 1723 | 1805 | <div class="ui alt segment" id="mainwp-install-themes"> |
| 1724 | 1806 | <div class="mainwp-main-content"> |
| 1725 | 1807 | <div class="mainwp-actions-bar"> |
| 1726 | - <div class="ui stackable grid"> | |
| 1727 | - <div class="ui two column row"> | |
| 1728 | - <div class="column"> | |
| 1729 | - <div class="ui fluid search focus"> | |
| 1730 | - <div class="ui icon fluid input hide-if-upload" id="mainwp-search-themes-input-container" skeyword="<?php echo isset( $_GET['s'] ) ? esc_html( sanitize_text_field( wp_unslash( $_GET['s'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>"></div> | |
| 1808 | + <div class="ui stackable two column grid"> | |
| 1809 | + <div class="column"> | |
| 1810 | + <div class="ui mini buttons"> | |
| 1811 | + <a href="#" class="ui basic green button browse-themes mainwp-bulk-install-tabs-header-btn" ><?php esc_html_e( 'Install from WordPress.org', 'mainwp' ); ?></a> | |
| 1812 | + <a href="#" class="ui basic button upload mainwp-bulk-install-tabs-header-btn" ><?php esc_html_e( 'Upload .zip file', 'mainwp' ); ?></a> | |
| 1813 | + <?php do_action( 'mainwp_install_plugin_theme_tabs_header_top', 'theme' ); ?> | |
| 1814 | + </div> | |
| 1815 | + <?php | |
| 1816 | + /** | |
| 1817 | + * Install Themes actions bar (right) | |
| 1818 | + * | |
| 1819 | + * Fires at the right side of the actions bar on the Install Themes screen. | |
| 1820 | + * | |
| 1821 | + * @since 4.0 | |
| 1822 | + */ | |
| 1823 | + do_action( 'mainwp_install_themes_actions_bar_right' ); | |
| 1824 | + ?> | |
| 1825 | + </div> | |
| 1826 | + <div class="right aligned column"> | |
| 1827 | + <div class="ui search focus"> | |
| 1828 | + <div class="ui icon mini input mainwp-bulk-install-showhide-content" id="mainwp-search-themes-input-container" skeyword="<?php echo isset( $_GET['s'] ) ? esc_html( sanitize_text_field( wp_unslash( $_GET['s'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>"></div> | |
| 1731 | 1829 | <div class="results"></div> |
| 1732 | 1830 | </div> |
| 1733 | 1831 | <?php |
| 1734 | 1832 | /** |
| @@ -1740,46 +1838,36 @@ | ||
| 1740 | 1838 | */ |
| 1741 | 1839 | do_action( 'mainwp_install_themes_actions_bar_left' ); |
| 1742 | 1840 | ?> |
| 1743 | 1841 | </div> |
| 1744 | - <div class="right aligned column"> | |
| 1745 | - <div class="ui buttons"> | |
| 1746 | - <a href="#" class="ui button browse-themes" ><?php esc_html_e( 'Install from WordPress.org', 'mainwp' ); ?></a> | |
| 1747 | - <div class="or"></div> | |
| 1748 | - <a href="#" class="ui button upload" ><?php esc_html_e( 'Upload .zip file', 'mainwp' ); ?></a> | |
| 1749 | - </div> | |
| 1750 | - <?php | |
| 1751 | - /** | |
| 1752 | - * Install Themes actions bar (right) | |
| 1753 | - * | |
| 1754 | - * Fires at the right side of the actions bar on the Install Themes screen. | |
| 1755 | - * | |
| 1756 | - * @since 4.0 | |
| 1757 | - */ | |
| 1758 | - do_action( 'mainwp_install_themes_actions_bar_right' ); | |
| 1759 | - ?> | |
| 1760 | - </div> | |
| 1761 | - </div> | |
| 1842 | + | |
| 1843 | + | |
| 1762 | 1844 | </div> |
| 1763 | 1845 | </div> |
| 1764 | - <div class="ui segment"> | |
| 1846 | + <div class="ui padded segment"> | |
| 1765 | 1847 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-install-themes-info-message' ) ) : ?> |
| 1766 | 1848 | <div class="ui info message"> |
| 1767 | 1849 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-install-themes-info-message"></i> |
| 1768 | - <?php printf( esc_html__( 'Install themes on your child sites. You can install themes 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-themes/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 1850 | + <?php /* translators: 1: Opening link tag, 2: Closing link tag with icon */ printf( esc_html__( 'Install themes on your child sites. You can install themes 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/themes/managing-themes-with-mainwp#install-themes" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 1769 | 1851 | </div> |
| 1770 | 1852 | <?php endif; ?> |
| 1771 | 1853 | <div id="mainwp-message-zone" class="ui message" style="display:none;"></div> |
| 1772 | - <div class="mainwp-upload-theme"> | |
| 1854 | + <div class="mainwp-upload-theme mainwp-bulk-install-showhide-content"> | |
| 1773 | 1855 | <?php MainWP_Install_Bulk::render_upload( 'theme' ); ?> |
| 1774 | 1856 | </div> |
| 1775 | - <div id="themes-loading" class="ui large text loader"><?php esc_html_e( 'Loading Themes...', 'mainwp' ); ?></div> | |
| 1776 | - <form id="theme-filter" method="post"> | |
| 1777 | - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?> | |
| 1778 | - <div class="mainwp-browse-themes content-filterable hide-if-upload"></div> | |
| 1857 | + <div id="themes-loading" class="ui double text loader" style="margin-top: 250px;"> | |
| 1858 | + <?php esc_html_e( 'Loading...', 'mainwp' ); ?> | |
| 1859 | + </div> | |
| 1860 | + <form id="theme-filter" method="post" class="mainwp-bulk-install-showhide-content"> | |
| 1861 | + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> | |
| 1862 | + <div class="mainwp-browse-themes content-filterable"></div> | |
| 1779 | 1863 | <div class="theme-install-overlay wp-full-overlay expanded"></div> |
| 1780 | 1864 | </form> |
| 1781 | 1865 | |
| 1866 | + <?php | |
| 1867 | + // @since 5.4. | |
| 1868 | + do_action( 'mainwp_bulk_install_tabs_content', 'theme' ); | |
| 1869 | + ?> | |
| 1782 | 1870 | <?php MainWP_UI::render_modal_install_plugin_theme( 'theme' ); ?> |
| 1783 | 1871 | </div> |
| 1784 | 1872 | </div> |
| 1785 | 1873 | <div class="mainwp-side-content mainwp-no-padding"> |
| @@ -1814,11 +1902,14 @@ | ||
| 1814 | 1902 | <div class="title active"><i class="dropdown icon"></i> <?php esc_html_e( 'Installation Options', 'mainwp' ); ?></div> |
| 1815 | 1903 | <div class="content active"> |
| 1816 | 1904 | <div class="ui form"> |
| 1817 | 1905 | <div class="field"> |
| 1818 | - <div class="ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled and the theme already installed on the sites, the already installed version will be overwritten.', 'mainwp' ); ?>" data-position="left center" data-inverted=""> | |
| 1906 | + <label><?php esc_html_e( 'Overwrite existing version', 'mainwp' ); ?></label> | |
| 1907 | + <div class="ui toggle checkbox"> | |
| 1819 | 1908 | <input type="checkbox" value="2" checked="checked" id="chk_overwrite" /> |
| 1820 | - <label for="chk_overwrite"><?php esc_html_e( 'Overwrite existing version', 'mainwp' ); ?></label> | |
| 1909 | + <label for="chk_overwrite"></label> | |
| 1910 | + <br /> | |
| 1911 | + <span class="ui small grey text"><?php esc_html_e( 'If enabled and the theme already installed on the sites, the already installed version will be overwritten.', 'mainwp' ); ?></span> | |
| 1821 | 1912 | </div> |
| 1822 | 1913 | </div> |
| 1823 | 1914 | </div> |
| 1824 | 1915 | </div> |
| @@ -1836,19 +1927,18 @@ | ||
| 1836 | 1927 | * @since 4.1 |
| 1837 | 1928 | */ |
| 1838 | 1929 | $allow_install = apply_filters( 'file_mod_allowed', true, 'mainwp_install_theme' ); |
| 1839 | 1930 | if ( $allow_install ) { |
| 1840 | - $is_demo = MainWP_Demo_Handle::is_demo_mode(); | |
| 1841 | - if ( $is_demo ) { | |
| 1842 | - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<input type="button" disabled="disabled" class="ui green big fluid button disabled" value="' . esc_attr__( 'Complete Installation', 'mainwp' ) . '" />' ); | |
| 1843 | - } else { | |
| 1844 | - ?> | |
| 1845 | - <input type="button" value="<?php esc_attr_e( 'Complete Installation', 'mainwp' ); ?>" class="ui green big fluid button" bulk-action="install" id="mainwp_theme_bulk_install_btn" name="bulk-install"> | |
| 1846 | - <?php | |
| 1847 | - } | |
| 1931 | + ?> | |
| 1932 | + <input type="button" value="<?php esc_attr_e( 'Complete Installation', 'mainwp' ); ?>" class="ui green big fluid button" bulk-action="install" id="mainwp_theme_bulk_install_btn" name="bulk-install"> | |
| 1933 | + <?php | |
| 1848 | 1934 | } |
| 1849 | 1935 | ?> |
| 1850 | 1936 | <?php do_action( 'mainwp_manage_themes_after_submit_button' ); ?> |
| 1937 | + <?php | |
| 1938 | + // @since 5.4. | |
| 1939 | + do_action( 'mainwp_bulk_install_sidebar_submit_bottom', 'theme' ); | |
| 1940 | + ?> | |
| 1851 | 1941 | </div> |
| 1852 | 1942 | <?php do_action( 'mainwp_manage_themes_sidebar_bottom', 'install' ); ?> |
| 1853 | 1943 | </div> |
| 1854 | 1944 | <div class="ui clearing hidden divider"></div> |
| @@ -1868,38 +1958,22 @@ | ||
| 1868 | 1958 | </div> |
| 1869 | 1959 | <# } #> |
| 1870 | 1960 | <div class="content"> |
| 1871 | 1961 | <div class="header">{{ data.name }}</div> |
| 1872 | - <div class="meta"> | |
| 1873 | - <a><?php printf( esc_html__( 'By %s', 'mainwp' ), '{{ data.author }}' ); ?></a> | |
| 1874 | - </div> | |
| 1875 | 1962 | </div> |
| 1876 | - <div class="extra content"> | |
| 1877 | - <span class="right floated"><?php printf( esc_html__( 'Version: %s', 'mainwp' ), '{{ data.version }}' ); ?></span> | |
| 1878 | - <# if ( data.rating ) { #> | |
| 1879 | - <div class="star-rating rating-{{ Math.round( data.rating / 10 ) * 10 }}"> | |
| 1880 | - <span class="one"></span><span class="two"></span><span class="three"></span><span class="four"></span><span class="five"></span> | |
| 1881 | - <small class="ratings">{{ data.num_ratings }}</small> | |
| 1963 | + <div class="extra content mainwp-theme-lnks"> | |
| 1964 | + <div class="ui two column grid"> | |
| 1965 | + <div class="left aligned middle aligned column"> | |
| 1966 | + <a href="#" id="mainwp-{{data.slug}}-preview" class="ui mini button mainwp-theme-preview"><?php esc_html_e( 'Preview', 'mainwp' ); ?></a> | |
| 1882 | 1967 | </div> |
| 1883 | - <# } else { #> | |
| 1884 | - <div class="star-rating"> | |
| 1885 | - <small class="ratings"><?php esc_html_e( 'This theme has not been rated yet.', 'mainwp' ); ?></small> | |
| 1968 | + <div class="right aligned middle aligned column"> | |
| 1969 | + <div class="ui radio checkbox"> | |
| 1970 | + <input name="install-theme" type="radio" id="install-theme-{{data.slug}}" title="Install {{data.name}}" theme-name="{{data.name}}" theme-version="{{data.version}}"> | |
| 1971 | + <label for="install-theme-{{data.slug}}"><?php esc_html_e( 'Install Theme', 'mainwp' ); ?></label> | |
| 1972 | + </div> | |
| 1886 | 1973 | </div> |
| 1887 | - <# } #> | |
| 1888 | - </div> | |
| 1889 | - <div class="extra content mainwp-theme-lnks"> | |
| 1890 | - <a href="#" id="mainwp-{{data.slug}}-preview" class="ui mini button mainwp-theme-preview"><?php esc_html_e( 'Preview', 'mainwp' ); ?></a> | |
| 1891 | - <div class="ui radio checkbox right floated"> | |
| 1892 | - <input name="install-theme" type="radio" id="install-theme-{{data.slug}}" title="Install {{data.name}}" theme-name="{{data.name}}" theme-version="{{data.version}}"> | |
| 1893 | - <label for="install-theme-{{data.slug}}"><?php esc_html_e( 'Install Theme', 'mainwp' ); ?></label> | |
| 1894 | 1974 | </div> |
| 1895 | 1975 | </div> |
| 1896 | - <?php if ( $favorites_enabled ) { ?> | |
| 1897 | - <div class="extra content"> | |
| 1898 | - <span><?php esc_html_e( 'Add to Favorites', 'mainwp-favorites-extension' ); ?></span> | |
| 1899 | - <a class="ui huge star rating right floated <# if ( data.added_fav ) { #> favorite <# } #>" data-max-rating="1" id="add-favorite-theme-{{data.slug}}"></a> | |
| 1900 | - </div> | |
| 1901 | - <?php } ?> | |
| 1902 | 1976 | <?php do_action( 'mainwp_install_theme_card_template_bottom' ); ?> |
| 1903 | 1977 | </script> |
| 1904 | 1978 | |
| 1905 | 1979 | <script id="tmpl-theme-preview" type="text/template"> |
| @@ -1911,9 +1985,9 @@ | ||
| 1911 | 1985 | </div> |
| 1912 | 1986 | <div class="wp-full-overlay-sidebar-content"> |
| 1913 | 1987 | <div class="install-theme-info"> |
| 1914 | 1988 | <h3 class="theme-name">{{ data.name }}</h3> |
| 1915 | - <span class="theme-by"><?php printf( esc_html__( 'By %s', 'mainwp' ), '{{ data.author }}' ); ?></span> | |
| 1989 | + <span class="theme-by"><?php /* translators: %s: Theme author name */ printf( esc_html__( 'By %s', 'mainwp' ), '{{ data.author }}' ); ?></span> | |
| 1916 | 1990 | <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="{{ data.name }}" /> |
| 1917 | 1991 | <div class="theme-details"> |
| 1918 | 1992 | <# if ( data.rating ) { #> |
| 1919 | 1993 | <div class="star-rating rating-{{ Math.round( data.rating / 10 ) * 10 }}"> |
| @@ -1924,9 +1998,9 @@ | ||
| 1924 | 1998 | <div class="star-rating"> |
| 1925 | 1999 | <small class="ratings"><?php esc_html_e( 'This theme has not been rated yet.', 'mainwp' ); ?></small> |
| 1926 | 2000 | </div> |
| 1927 | 2001 | <# } #> |
| 1928 | - <div class="theme-version"><?php printf( esc_html__( 'Version: %s', 'mainwp' ), '{{ data.version }}' ); ?></div> | |
| 2002 | + <div class="theme-version"><?php /* translators: %s: Theme version number */ printf( esc_html__( 'Version: %s', 'mainwp' ), '{{ data.version }}' ); ?></div> | |
| 1929 | 2003 | <div class="theme-description">{{{ data.description }}}</div> |
| 1930 | 2004 | </div> |
| 1931 | 2005 | </div> |
| 1932 | 2006 | </div> |
| @@ -1945,8 +2019,10 @@ | ||
| 1945 | 2019 | jQuery( document ).ready( function() { |
| 1946 | 2020 | setTimeout( function () { |
| 1947 | 2021 | jQuery('#wp-filter-search-input').val( jQuery('#mainwp-search-themes-input-container').attr('skeyword') ); |
| 1948 | 2022 | }, 1000 ); |
| 2023 | + | |
| 2024 | + mainwp_init_button_site_selection_dependency( 'mainwp_theme_bulk_install_btn' ); | |
| 1949 | 2025 | }); |
| 1950 | 2026 | </script> |
| 1951 | 2027 | <?php |
| 1952 | 2028 | } |
| @@ -1964,10 +2040,10 @@ | ||
| 1964 | 2040 | } |
| 1965 | 2041 | |
| 1966 | 2042 | static::render_header( 'AutoUpdate' ); |
| 1967 | 2043 | |
| 1968 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'trust_untrust_updates' ) ) { | |
| 1969 | - mainwp_do_not_have_permissions( esc_html__( 'trust/untrust updates', 'mainwp' ) ); | |
| 2044 | + if ( ! \mainwp_current_user_can( 'dashboard', 'trust_untrust_updates' ) ) { | |
| 2045 | + \mainwp_do_not_have_permissions( esc_html__( 'trust/untrust updates', 'mainwp' ) ); | |
| 1970 | 2046 | return; |
| 1971 | 2047 | } else { |
| 1972 | 2048 | $snThemeAutomaticDailyUpdate = get_option( 'mainwp_themeAutomaticDailyUpdate' ); |
| 1973 | 2049 | |
| @@ -1978,16 +2054,22 @@ | ||
| 1978 | 2054 | |
| 1979 | 2055 | ?> |
| 1980 | 2056 | <div class="ui alt segment" id="mainwp-theme-auto-updates"> |
| 1981 | 2057 | <div class="mainwp-main-content"> |
| 1982 | - <div class="mainwp-actions-bar"> | |
| 2058 | + <div class="mainwp-actions-bar" <?php echo ! isset( $_SESSION['SNThemesAll'] ) ? 'style="display:none"' : ''; ?>> | |
| 1983 | 2059 | <div class="ui mini form stackable grid"> |
| 1984 | 2060 | <div class="ui two column row"> |
| 1985 | 2061 | <div class="left aligned column"> |
| 1986 | 2062 | <select id="mainwp-bulk-actions" name="bulk_action" class="ui mini selection dropdown"> |
| 1987 | 2063 | <option class="item" value=""><?php esc_html_e( 'Bulk Actions', 'mainwp' ); ?></option> |
| 1988 | - <option class="item" value="trust"><?php esc_html_e( 'Trust', 'mainwp' ); ?></option> | |
| 1989 | - <option class="item" value="untrust"><?php esc_html_e( 'Untrust', 'mainwp' ); ?></option> | |
| 2064 | + <option class="item" value="trust"> | |
| 2065 | + <?php esc_html_e( 'Mark as Trusted', 'mainwp' ); ?><br/> | |
| 2066 | + <span class="ui small grey text"><?php esc_html_e( 'Auto updated by your Dashboard', 'mainwp' ); ?></span> | |
| 2067 | + </option> | |
| 2068 | + <option class="item" value="untrust"> | |
| 2069 | + <?php esc_html_e( 'Mark as Untrusted', 'mainwp' ); ?><br/> | |
| 2070 | + <span class="ui small grey text"><?php esc_html_e( 'Require manual updates', 'mainwp' ); ?></span> | |
| 2071 | + </option> | |
| 1990 | 2072 | <?php |
| 1991 | 2073 | /** |
| 1992 | 2074 | * Action: mainwp_themes_auto_updates_bulk_action |
| 1993 | 2075 | * |
| @@ -2007,30 +2089,34 @@ | ||
| 2007 | 2089 | <?php if ( isset( $_GET['message'] ) && 'saved' === $_GET['message'] ) : // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?> |
| 2008 | 2090 | <div class="ui message green"><?php esc_html_e( 'Settings have been saved.', 'mainwp' ); ?></div> |
| 2009 | 2091 | <?php endif; ?> |
| 2010 | 2092 | <div id="mainwp-message-zone" class="ui message" style="display:none"></div> |
| 2011 | - <div id="mainwp-auto-updates-themes-content" class="ui segment"> | |
| 2012 | - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-disable-auto-updates-info-message' ) ) : ?> | |
| 2013 | - <div class="ui info message"> | |
| 2014 | - <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-disable-auto-updates-info-message"></i> | |
| 2015 | - <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> | |
| 2016 | - </div> | |
| 2017 | - <?php endif; ?> | |
| 2093 | + <div id="mainwp-auto-updates-themes-content" class="ui padded segment"> | |
| 2018 | 2094 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-themes-auto-updates-info-message' ) ) : ?> |
| 2019 | 2095 | <div class="ui info message"> |
| 2020 | 2096 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-themes-auto-updates-info-message"></i> |
| 2097 | + <div class="header"><?php esc_html_e( 'Automatically update only the themes you trust!', 'mainwp' ); ?></div> | |
| 2021 | 2098 | <div><?php esc_html_e( 'The MainWP Advanced Auto Updates feature is a tool for your Dashboard to automatically update themes that you trust to be updated without breaking your Child sites.', 'mainwp' ); ?></div> |
| 2022 | 2099 | <div><?php esc_html_e( 'Only mark themes 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> |
| 2023 | 2100 | <div><strong><?php esc_html_e( 'Advanced Auto Updates a delayed approximately 24 hours from the update release. Ignored themes can not be automatically updated.', 'mainwp' ); ?></strong></div> |
| 2024 | 2101 | </div> |
| 2025 | 2102 | <?php endif; ?> |
| 2026 | - <div class="ui inverted dimmer"> | |
| 2027 | - <div class="ui text loader"><?php esc_html_e( 'Loading themes', 'mainwp' ); ?></div> | |
| 2103 | + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-disable-auto-updates-info-message' ) ) : ?> | |
| 2104 | + <div class="ui message"> | |
| 2105 | + <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-disable-auto-updates-info-message"></i> | |
| 2106 | + <div><em data-emoji=":bulb:" class="small"></em> <?php /* translators: 1: Opening link tag, 2: Closing link tag */ 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. ?></div> | |
| 2028 | 2107 | </div> |
| 2108 | + <?php endif; ?> | |
| 2109 | + | |
| 2110 | + <div class="ui page dimmer"> | |
| 2111 | + <div class="ui text double loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div> | |
| 2112 | + </div> | |
| 2029 | 2113 | <div id="mainwp-auto-updates-themes-table-wrapper"> |
| 2030 | 2114 | <?php |
| 2031 | 2115 | if ( isset( $_SESSION['SNThemesAll'] ) ) { |
| 2032 | 2116 | static::render_all_themes_table( $_SESSION['SNThemesAll'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 2117 | + } else { | |
| 2118 | + MainWP_UI::render_empty_page_placeholder( __( 'No themes loaded yet.', 'mainwp' ), __( 'Click Show Themes button to view your installed themes and manage their trust settings.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' ); | |
| 2033 | 2119 | } |
| 2034 | 2120 | ?> |
| 2035 | 2121 | </div> |
| 2036 | 2122 | </div> |
| @@ -2258,14 +2344,15 @@ | ||
| 2258 | 2344 | <table class="ui unstackable table" id="mainwp-all-active-themes-table"> |
| 2259 | 2345 | <thead> |
| 2260 | 2346 | <tr> |
| 2261 | 2347 | <th scope="col" class="no-sort collapsing check-column"><span class="ui checkbox"><input id="cb-select-all-top" type="checkbox" /></span></th> |
| 2348 | + <th scope="col" class="no-sort collapsing center aligned"></th> | |
| 2262 | 2349 | <th scope="col" data-priority="1"><?php esc_html_e( 'Theme', 'mainwp' ); ?></th> |
| 2263 | - <th scope="col" ><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 2264 | - <th scope="col" data-priority="2" class="collapsing"><?php esc_html_e( 'Trust Status', 'mainwp' ); ?></th> | |
| 2265 | - <th scope="col" ><?php esc_html_e( 'Ignored Status', 'mainwp' ); ?></th> | |
| 2266 | - <th scope="col" class="collapsing"></th> | |
| 2267 | - <th scope="col" class="collapsing"><?php esc_html_e( 'Notes', 'mainwp' ); ?></th> | |
| 2350 | + <th scope="col" class="collapsing center aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 2351 | + <th scope="col" data-priority="2" class="collapsing center aligned"><?php esc_html_e( 'Trust Status', 'mainwp' ); ?></th> | |
| 2352 | + <th scope="col" class="collapsing center aligned"><?php esc_html_e( 'Ignored Status', 'mainwp' ); ?></th> | |
| 2353 | + <th scope="col" class="collapsing center aligned"></th> | |
| 2354 | + <th scope="col" class="collapsing center aligned"><?php esc_html_e( 'Notes', 'mainwp' ); ?></th> | |
| 2268 | 2355 | </tr> |
| 2269 | 2356 | </thead> |
| 2270 | 2357 | |
| 2271 | 2358 | <tbody> |
| @@ -2293,18 +2380,19 @@ | ||
| 2293 | 2380 | |
| 2294 | 2381 | ?> |
| 2295 | 2382 | <tr theme-slug="<?php echo esc_attr( rawurlencode( $slug ) ); ?>" theme-name="<?php echo esc_attr( $name ); ?>"> |
| 2296 | 2383 | <td class="check-column"><span class="ui checkbox"><input type="checkbox" name="theme[]" value="<?php echo esc_attr( rawurlencode( $slug ) ); ?>"></span></td> |
| 2297 | - <td><?php echo MainWP_System_Utility::get_theme_icon( $slug ) . ' ' . esc_html( $name ); //phpcs:ignore -- escaped. ?></td> | |
| 2298 | - <td><?php echo ( 1 === (int) $theme['active'] ) ? esc_html__( 'Active', 'mainwp' ) : esc_html__( 'Inactive', 'mainwp' ); //phpcs:ignore -- escaped. ?></td> | |
| 2299 | - <td><?php echo ( in_array( $slug, $trustedThemes ) ) ? '<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> | |
| 2300 | - <td><?php echo ( isset( $decodedIgnoredThemes[ $slug ] ) ) ? '<span class="ui mini label">' . esc_html__( 'Ignored', 'mainwp' ) . '</span>' : ''; ?></td> | |
| 2301 | - <td><?php echo ( isset( $decodedIgnoredThemes[ $slug ] ) ) ? '<span data-tooltip="Ignored themes will not be automatically updated." data-inverted=""><i class="info red circle icon"></i></span>' : ''; ?></td> | |
| 2384 | + <td><?php echo MainWP_System_Utility::get_theme_icon( $slug ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> | |
| 2385 | + <td><?php echo esc_html( $name ); //phpcs:ignore -- escaped. ?></td> | |
| 2386 | + <td class="collapsing center aligned"><?php echo ( 1 === (int) $theme['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> | |
| 2387 | + <td class="collapsing center aligned"><?php echo ( in_array( $slug, $trustedThemes ) ) ? '<span class="ui mini green label"><i class="lock icon"></i> ' . esc_html__( 'Trusted', 'mainwp' ) . '</span>' : '<span class="ui mini red label"><i class="lock open icon"></i> ' . esc_html__( 'Not Trusted', 'mainwp' ) . '</span>'; ?></td> | |
| 2388 | + <td class="collapsing center aligned"><?php echo ( isset( $decodedIgnoredThemes[ $slug ] ) ) ? '<span class="ui mini basic label">' . esc_html__( 'Ignored', 'mainwp' ) . '</span>' : ''; ?></td> | |
| 2389 | + <td class="collapsing center aligned"><?php echo ( isset( $decodedIgnoredThemes[ $slug ] ) ) ? '<span data-tooltip="Ignored themes will not be automatically updated." data-inverted=""><i class="info red circle icon"></i></span>' : ''; ?></td> | |
| 2302 | 2390 | <td class="collapsing center aligned"> |
| 2303 | 2391 | <?php if ( '' === $esc_note ) : ?> |
| 2304 | 2392 | <a href="javascript:void(0)" class="mainwp-edit-theme-note"><i class="sticky note outline icon"></i></a> |
| 2305 | 2393 | <?php else : ?> |
| 2306 | - <a href="javascript:void(0)" class="mainwp-edit-theme-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> | |
| 2394 | + <a href="javascript:void(0)" class="mainwp-edit-theme-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> | |
| 2307 | 2395 | <?php endif; ?> |
| 2308 | 2396 | <span style="display: none" class="esc-content-note"><?php echo $esc_note; //phpcs:ignore -- escaped. ?></span> |
| 2309 | 2397 | </td> |
| 2310 | 2398 | </tr> |
| @@ -2309,20 +2397,8 @@ | ||
| 2309 | 2397 | </td> |
| 2310 | 2398 | </tr> |
| 2311 | 2399 | <?php endforeach; ?> |
| 2312 | 2400 | </tbody> |
| 2313 | - | |
| 2314 | - <tfoot> | |
| 2315 | - <tr> | |
| 2316 | - <th scope="col" class="no-sort check-column"><span class="ui checkbox"><input id="cb-select-all-bottom" type="checkbox" /></span></th> | |
| 2317 | - <th scope="col" ><?php esc_html_e( 'Theme', 'mainwp' ); ?></th> | |
| 2318 | - <th scope="col" ><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 2319 | - <th scope="col" ><?php esc_html_e( 'Trust Status', 'mainwp' ); ?></th> | |
| 2320 | - <th scope="col" ><?php esc_html_e( 'Ignored Status', 'mainwp' ); ?></th> | |
| 2321 | - <th scope="col" class="collapsing"></th> | |
| 2322 | - <th scope="col" ><?php esc_html_e( 'Notes', 'mainwp' ); ?></th> | |
| 2323 | - </tr> | |
| 2324 | - </tfoot> | |
| 2325 | 2401 | </table> |
| 2326 | 2402 | <?php |
| 2327 | 2403 | /** |
| 2328 | 2404 | * Action: mainwp_themes_after_auto_updates_table |
| @@ -2410,13 +2486,13 @@ | ||
| 2410 | 2486 | } |
| 2411 | 2487 | |
| 2412 | 2488 | static::render_header( 'Ignore' ); |
| 2413 | 2489 | ?> |
| 2414 | - <div id="mainwp-ignored-plugins" class="ui segment"> | |
| 2490 | + <div id="mainwp-ignored-plugins" class="ui padded segment"> | |
| 2415 | 2491 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-ignored-themes-info-message' ) ) : ?> |
| 2416 | 2492 | <div class="ui info message"> |
| 2417 | 2493 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-ignored-themes-info-message"></i> |
| 2418 | - <?php printf( esc_html__( 'Manage themes 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-themes-updates/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 2494 | + <?php /* translators: 1: Opening link tag, 2: Closing link tag with icon */ printf( esc_html__( 'Manage themes 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-theme-updates" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 2419 | 2495 | </div> |
| 2420 | 2496 | <?php endif; ?> |
| 2421 | 2497 | <?php |
| 2422 | 2498 | /** |
| @@ -2421,14 +2497,15 @@ | ||
| 2421 | 2497 | <?php |
| 2422 | 2498 | /** |
| 2423 | 2499 | * Action: mainwp_themes_before_ignored_updates |
| 2424 | 2500 | * |
| 2425 | - * Fires on the top of the Ignored Themes Updates page. | |
| 2501 | + * Fires on the top of the Ignored Theme Updates page. | |
| 2426 | 2502 | * |
| 2427 | 2503 | * @since 4.1 |
| 2428 | 2504 | */ |
| 2429 | 2505 | do_action( 'mainwp_themes_before_ignored_updates', $ignoredThemes, $websites ); |
| 2430 | 2506 | ?> |
| 2507 | + <?php if ( ! empty( $ignoredThemes ) ) : ?> | |
| 2431 | 2508 | <h3 class="ui header"> |
| 2432 | 2509 | <?php esc_html_e( 'Globally Ignored Themes', 'mainwp' ); ?> |
| 2433 | 2510 | <div class="sub header"><?php esc_html_e( 'These are themes you have told your MainWP Dashboard to ignore updates on global level and not notify you about pending updates.', 'mainwp' ); ?></div> |
| 2434 | 2511 | </h3> |
| @@ -2433,23 +2510,30 @@ | ||
| 2433 | 2510 | <div class="sub header"><?php esc_html_e( 'These are themes you have told your MainWP Dashboard to ignore updates on global level and not notify you about pending updates.', 'mainwp' ); ?></div> |
| 2434 | 2511 | </h3> |
| 2435 | 2512 | <?php static::render_global_ignored( $ignoredThemes, $decodedIgnoredThemes ); ?> |
| 2436 | 2513 | <div class="ui hidden divider"></div> |
| 2514 | + <?php endif; ?> | |
| 2515 | + <?php if ( $cnt > 0 ) : ?> | |
| 2437 | 2516 | <h3 class="ui header"> |
| 2438 | - <?php esc_html_e( 'Per Site Ignored Themes', 'mainwp' ); ?> | |
| 2439 | - <div class="sub header"><?php esc_html_e( 'These are themes you have told your MainWP Dashboard to ignore updates per site level and not notify you about pending updates.', 'mainwp' ); ?></div> | |
| 2440 | - </h3> | |
| 2441 | - <?php static::render_sites_ignored( $cnt, $websites ); ?> | |
| 2442 | - <?php | |
| 2443 | - /** | |
| 2444 | - * Action: mainwp_themes_after_ignored_updates | |
| 2445 | - * | |
| 2446 | - * Fires on the bottom of the Ignored Themes Updates page. | |
| 2447 | - * | |
| 2448 | - * @since 4.1 | |
| 2449 | - */ | |
| 2450 | - do_action( 'mainwp_themes_after_ignored_updates', $ignoredThemes, $websites ); | |
| 2451 | - ?> | |
| 2517 | + <?php esc_html_e( 'Per Site Ignored Themes', 'mainwp' ); ?> | |
| 2518 | + <div class="sub header"><?php esc_html_e( 'These are themes you have told your MainWP Dashboard to ignore updates per site level and not notify you about pending updates.', 'mainwp' ); ?></div> | |
| 2519 | + </h3> | |
| 2520 | + <?php static::render_sites_ignored( $cnt, $websites ); ?> | |
| 2521 | + <?php endif; ?> | |
| 2522 | + <?php if ( empty( $ignoredThemes ) && 0 === $cnt ) : ?> | |
| 2523 | + <?php MainWP_UI::render_empty_page_placeholder( __( 'No Ignored Updates', 'mainwp' ), __( 'All theme updates are being tracked. When you choose to ignore updates for a specific theme, they will appear here.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' ); ?> | |
| 2524 | + <?php endif; ?> | |
| 2525 | + | |
| 2526 | + <?php | |
| 2527 | + /** | |
| 2528 | + * Action: mainwp_themes_after_ignored_updates | |
| 2529 | + * | |
| 2530 | + * Fires on the bottom of the Ignored Theme Updates page. | |
| 2531 | + * | |
| 2532 | + * @since 4.1 | |
| 2533 | + */ | |
| 2534 | + do_action( 'mainwp_themes_after_ignored_updates', $ignoredThemes, $websites ); | |
| 2535 | + ?> | |
| 2452 | 2536 | </div> |
| 2453 | 2537 | <?php |
| 2454 | 2538 | MainWP_Updates::render_plugin_details_modal(); |
| 2455 | 2539 | static::render_footer( 'Ignore' ); |
| @@ -2460,9 +2544,9 @@ | ||
| 2460 | 2544 | * |
| 2461 | 2545 | * @param mixed $ignoredThemes Encoded ignored themes. |
| 2462 | 2546 | * @param mixed $decodedIgnoredThemes Decoded ignored themes. |
| 2463 | 2547 | */ |
| 2464 | - public static function render_global_ignored( $ignoredThemes, $decodedIgnoredThemes ) { | |
| 2548 | + public static function render_global_ignored( $ignoredThemes, $decodedIgnoredThemes ) { //phpcs:ignore -- NOSONAR - complex. | |
| 2465 | 2549 | ?> |
| 2466 | 2550 | <table id="mainwp-globally-ignored-themes" class="ui compact selectable table unstackable"> |
| 2467 | 2551 | <thead> |
| 2468 | 2552 | <tr> |
| @@ -2467,31 +2551,49 @@ | ||
| 2467 | 2551 | <thead> |
| 2468 | 2552 | <tr> |
| 2469 | 2553 | <th scope="col" ><?php esc_html_e( 'Theme', 'mainwp' ); ?></th> |
| 2470 | 2554 | <th scope="col" ><?php esc_html_e( 'Theme slug', 'mainwp' ); ?></th> |
| 2555 | + <th scope="col" ><?php esc_html_e( 'Ignored version', 'mainwp' ); ?></th> | |
| 2471 | 2556 | <th scope="col" ></th> |
| 2472 | 2557 | </tr> |
| 2473 | 2558 | </thead> |
| 2474 | 2559 | <tbody id="globally-ignored-themes-list"> |
| 2475 | 2560 | <?php if ( $ignoredThemes ) : ?> |
| 2476 | - <?php foreach ( $decodedIgnoredThemes as $ignoredTheme => $ignoredThemeName ) : ?> | |
| 2477 | - <tr theme-slug="<?php echo esc_attr( rawurlencode( $ignoredTheme ) ); ?>"> | |
| 2478 | - <td><?php echo MainWP_System_Utility::get_theme_icon( $ignoredTheme ) . ' ' . esc_html( $ignoredThemeName ); //phpcs:ignore -- escaped. ?></td> | |
| 2479 | - <td><?php echo esc_html( $ignoredTheme ); ?></td> | |
| 2480 | - <td class="right aligned"> | |
| 2481 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2482 | - <a href="#" class="ui mini button" onClick="return updatesoverview_themes_unignore_globally( '<?php echo esc_js( rawurlencode( $ignoredTheme ) ); ?>' )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a> | |
| 2483 | - <?php endif; ?> | |
| 2484 | - </td> | |
| 2485 | - </tr> | |
| 2561 | + <?php | |
| 2562 | + foreach ( $decodedIgnoredThemes as $ignoredTheme => $ignoredThemeName ) : | |
| 2563 | + | |
| 2564 | + $ignore_name = 'N/A'; | |
| 2565 | + $ignored_vers = array( 'all_versions' ); | |
| 2566 | + if ( is_string( $ignoredThemeName ) ) { | |
| 2567 | + $ignore_name = $ignoredThemeName; | |
| 2568 | + } elseif ( is_array( $ignoredThemeName ) ) { | |
| 2569 | + $ignore_name = ! empty( $ignoredThemeName['Name'] ) ? $ignoredThemeName['Name'] : $ignore_name; | |
| 2570 | + $ig_vers = ! empty( $ignoredThemeName['ignored_versions'] ) ? $ignoredThemeName['ignored_versions'] : ''; | |
| 2571 | + if ( ! empty( $ig_vers ) && is_array( $ig_vers ) && ! in_array( 'all_versions', $ig_vers ) ) { | |
| 2572 | + $ignored_vers = $ig_vers; | |
| 2573 | + } | |
| 2574 | + } | |
| 2575 | + ?> | |
| 2576 | + <?php foreach ( $ignored_vers as $ignored_ver ) { ?> | |
| 2577 | + <tr theme-slug="<?php echo esc_attr( rawurlencode( $ignoredTheme ) ); ?>"> | |
| 2578 | + <td><?php echo MainWP_System_Utility::get_theme_icon( $ignoredTheme ) . ' ' . esc_html( $ignore_name ); //phpcs:ignore -- escaped. ?></td> | |
| 2579 | + <td><?php echo esc_html( $ignoredTheme ); ?></td> | |
| 2580 | + <td><?php echo 'all_versions' === $ignored_ver ? esc_html__( 'All', 'mainwp' ) : esc_html( $ignored_ver ); ?></td> | |
| 2581 | + <td class="right aligned"> | |
| 2582 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2583 | + <a href="#" class="ui mini button" onClick="return updatesoverview_themes_unignore_globally( '<?php echo esc_js( rawurlencode( $ignoredTheme ) ); ?>', '<?php echo esc_js( rawurlencode( $ignored_ver ) ); ?>' )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a> | |
| 2584 | + <?php endif; ?> | |
| 2585 | + </td> | |
| 2586 | + </tr> | |
| 2587 | + <?php } ?> | |
| 2486 | 2588 | <?php endforeach; ?> |
| 2487 | 2589 | <?php endif; ?> |
| 2488 | 2590 | </tbody> |
| 2489 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2591 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2490 | 2592 | <?php if ( $ignoredThemes ) : ?> |
| 2491 | 2593 | <tfoot class="full-width"> |
| 2492 | 2594 | <tr> |
| 2493 | - <th scope="col" colspan="3"> | |
| 2595 | + <th scope="col" colspan="4"> | |
| 2494 | 2596 | <a class="ui right floated small green labeled icon button" onClick="return updatesoverview_themes_unignore_globally_all();" id="mainwp-unignore-globally-all"> |
| 2495 | 2597 | <i class="check icon"></i> <?php esc_html_e( 'Unignore All', 'mainwp' ); ?> |
| 2496 | 2598 | </a> |
| 2497 | 2599 | </th> |
| @@ -2535,8 +2637,9 @@ | ||
| 2535 | 2637 | <tr> |
| 2536 | 2638 | <th scope="col" ><?php esc_html_e( 'Site', 'mainwp' ); ?></th> |
| 2537 | 2639 | <th scope="col" ><?php esc_html_e( 'Theme', 'mainwp' ); ?></th> |
| 2538 | 2640 | <th scope="col" ><?php esc_html_e( 'Theme slug', 'mainwp' ); ?></th> |
| 2641 | + <th scope="col" ><?php esc_html_e( 'Ignored version', 'mainwp' ); ?></th> | |
| 2539 | 2642 | <th scope="col" ></th> |
| 2540 | 2643 | </tr> |
| 2541 | 2644 | </thead> |
| 2542 | 2645 | <tbody id="ignored-themes-list"> |
| @@ -2554,25 +2657,40 @@ | ||
| 2554 | 2657 | } |
| 2555 | 2658 | $first = true; |
| 2556 | 2659 | |
| 2557 | 2660 | foreach ( $decodedIgnoredThemes as $ignoredTheme => $ignoredThemeName ) { |
| 2558 | - ?> | |
| 2559 | - <tr site-id="<?php echo esc_attr( $website->id ); ?>" theme-slug="<?php echo esc_attr( rawurlencode( $ignoredTheme ) ); ?>"> | |
| 2560 | - <?php if ( $first ) : ?> | |
| 2561 | - <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> | |
| 2562 | - <?php $first = false; ?> | |
| 2563 | - <?php else : ?> | |
| 2564 | - <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> | |
| 2565 | - <?php endif; ?> | |
| 2566 | - <td><?php echo MainWP_System_Utility::get_theme_icon( $ignoredTheme ) . ' ' . esc_html( $ignoredThemeName ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> | |
| 2567 | - <td><?php echo esc_html( $ignoredTheme ); ?></td> | |
| 2568 | - <td class="right aligned"> | |
| 2569 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2570 | - <a href="#" class="ui mini button" onClick="return updatesoverview_themes_unignore_detail( '<?php echo esc_js( rawurlencode( $ignoredTheme ) ); ?>', <?php echo intval( $website->id ); ?> )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a> | |
| 2571 | - <?php endif; ?> | |
| 2572 | - </td> | |
| 2573 | - </tr> | |
| 2574 | - <?php | |
| 2661 | + $ignore_name = 'N/A'; | |
| 2662 | + $ignored_vers = array( 'all_versions' ); | |
| 2663 | + if ( is_string( $ignoredThemeName ) ) { | |
| 2664 | + $ignore_name = $ignoredThemeName; | |
| 2665 | + } elseif ( is_array( $ignoredThemeName ) ) { | |
| 2666 | + $ignore_name = ! empty( $ignoredThemeName['Name'] ) ? $ignoredThemeName['Name'] : $ignore_name; | |
| 2667 | + $ig_vers = ! empty( $ignoredThemeName['ignored_versions'] ) ? $ignoredThemeName['ignored_versions'] : ''; | |
| 2668 | + if ( ! empty( $ig_vers ) && is_array( $ig_vers ) && ! in_array( 'all_versions', $ig_vers ) ) { | |
| 2669 | + $ignored_vers = $ig_vers; | |
| 2670 | + } | |
| 2671 | + } | |
| 2672 | + | |
| 2673 | + foreach ( $ignored_vers as $ignored_ver ) { | |
| 2674 | + ?> | |
| 2675 | + <tr site-id="<?php echo esc_attr( $website->id ); ?>" theme-slug="<?php echo esc_attr( rawurlencode( $ignoredTheme ) ); ?>"> | |
| 2676 | + <?php if ( $first ) : ?> | |
| 2677 | + <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> | |
| 2678 | + <?php $first = false; ?> | |
| 2679 | + <?php else : ?> | |
| 2680 | + <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> | |
| 2681 | + <?php endif; ?> | |
| 2682 | + <td><?php echo MainWP_System_Utility::get_theme_icon( $ignoredTheme ) . ' ' . esc_html( $ignore_name ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> | |
| 2683 | + <td><?php echo esc_html( $ignoredTheme ); ?></td> | |
| 2684 | + <td><?php echo 'all_versions' === $ignored_ver ? esc_html__( 'All', 'mainwp' ) : esc_html( $ignored_ver ); ?></td> | |
| 2685 | + <td class="right aligned"> | |
| 2686 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2687 | + <a href="#" class="ui mini button" onClick="return updatesoverview_themes_unignore_detail( '<?php echo esc_js( rawurlencode( $ignoredTheme ) ); ?>', <?php echo intval( $website->id ); ?>, '<?php echo esc_js( rawurlencode( $ignored_ver ) ); ?>' )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a> | |
| 2688 | + <?php endif; ?> | |
| 2689 | + </td> | |
| 2690 | + </tr> | |
| 2691 | + <?php | |
| 2692 | + } | |
| 2575 | 2693 | } |
| 2576 | 2694 | } |
| 2577 | 2695 | MainWP_DB::free_result( $websites ); |
| 2578 | 2696 | ?> |
| @@ -2577,13 +2695,13 @@ | ||
| 2577 | 2695 | MainWP_DB::free_result( $websites ); |
| 2578 | 2696 | ?> |
| 2579 | 2697 | <?php endif; ?> |
| 2580 | 2698 | </tbody> |
| 2581 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2699 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2582 | 2700 | <?php if ( 0 < $cnt ) : ?> |
| 2583 | 2701 | <tfoot class="full-width"> |
| 2584 | 2702 | <tr> |
| 2585 | - <th scope="col" colspan="4"> | |
| 2703 | + <th scope="col" colspan="5"> | |
| 2586 | 2704 | <a class="ui right floated small green labeled icon button" onClick="return updatesoverview_themes_unignore_detail_all();" id="mainwp-unignore-detail-all"> |
| 2587 | 2705 | <i class="check icon"></i> <?php esc_html_e( 'Unignore All', 'mainwp' ); ?> |
| 2588 | 2706 | </a> |
| 2589 | 2707 | </th> |
| @@ -2608,8 +2726,17 @@ | ||
| 2608 | 2726 | <?php |
| 2609 | 2727 | } |
| 2610 | 2728 | |
| 2611 | 2729 | /** |
| 2730 | + * Method render_abandoned_themes() | |
| 2731 | + * | |
| 2732 | + * Render abandoned themes list. | |
| 2733 | + */ | |
| 2734 | + public static function render_abandoned_themes() { | |
| 2735 | + MainWP_Updates::render( 'abandoned_themes' ); | |
| 2736 | + } | |
| 2737 | + | |
| 2738 | + /** | |
| 2612 | 2739 | * Render the Themes Ignored/Abandoned Tab. |
| 2613 | 2740 | * |
| 2614 | 2741 | * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() |
| 2615 | 2742 | * @uses \MainWP\Dashboard\MainWP_DB::query() |
| @@ -2634,13 +2761,13 @@ | ||
| 2634 | 2761 | } |
| 2635 | 2762 | |
| 2636 | 2763 | static::render_header( 'IgnoreAbandoned' ); |
| 2637 | 2764 | ?> |
| 2638 | - <div id="mainwp-ignored-abandoned-themes" class="ui segment"> | |
| 2765 | + <div id="mainwp-ignored-abandoned-themes" class="ui padded segment"> | |
| 2639 | 2766 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-ignored-abandoned-themes-info-message' ) ) : ?> |
| 2640 | 2767 | <div class="ui info message"> |
| 2641 | 2768 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-ignored-abandoned-themes-info-message"></i> |
| 2642 | - <?php printf( esc_html__( 'Manage abandoned themes 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-themes/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 2769 | + <?php /* translators: 1: Opening link tag, 2: Closing link tag with icon */ printf( esc_html__( 'Manage abandoned themes 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/themes/managing-themes-with-mainwp#abandoned-themes" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 2643 | 2770 | </div> |
| 2644 | 2771 | <?php endif; ?> |
| 2645 | 2772 | <?php |
| 2646 | 2773 | /** |
| @@ -2651,19 +2778,26 @@ | ||
| 2651 | 2778 | * @since 4.1 |
| 2652 | 2779 | */ |
| 2653 | 2780 | do_action( 'mainwp_themes_before_ignored_abandoned', $ignoredThemes, $websites ); |
| 2654 | 2781 | ?> |
| 2782 | + <?php if ( ! empty( $ignoredThemes ) ) : ?> | |
| 2655 | 2783 | <h3 class="ui header"> |
| 2656 | 2784 | <?php esc_html_e( 'Globally Ignored Abandoned Themes', 'mainwp' ); ?> |
| 2657 | 2785 | <div class="sub header"><?php esc_html_e( 'These are themes you have told your MainWP Dashboard to ignore on global level even though they have passed your Abandoned Themes Tolerance date', 'mainwp' ); ?></div> |
| 2658 | 2786 | </h3> |
| 2659 | 2787 | <?php static::render_global_ignored_abandoned( $ignoredThemes, $decodedIgnoredThemes ); ?> |
| 2660 | - <div class="ui hidden divider"></div> | |
| 2661 | - <h3 class="ui header"> | |
| 2662 | - <?php esc_html_e( 'Per Site Ignored Abandoned Themes', 'mainwp' ); ?> | |
| 2663 | - <div class="sub header"><?php esc_html_e( 'These are themes you have told your MainWP Dashboard to ignore per site level even though they have passed your Abandoned Theme Tolerance date', 'mainwp' ); ?></div> | |
| 2664 | - </h3> | |
| 2788 | + <div class="ui hidden divider"></div> | |
| 2789 | + <?php endif; ?> | |
| 2790 | + <?php if ( $cnt > 0 ) : ?> | |
| 2791 | + <h3 class="ui header"> | |
| 2792 | + <?php esc_html_e( 'Per Site Ignored Abandoned Themes', 'mainwp' ); ?> | |
| 2793 | + <div class="sub header"><?php esc_html_e( 'These are themes you have told your MainWP Dashboard to ignore per site level even though they have passed your Abandoned Theme Tolerance date', 'mainwp' ); ?></div> | |
| 2794 | + </h3> | |
| 2665 | 2795 | <?php static::render_sites_ignored_abandoned( $cnt, $websites ); ?> |
| 2796 | + <?php endif; ?> | |
| 2797 | + <?php if ( empty( $ignoredThemes ) && 0 === $cnt ) : ?> | |
| 2798 | + <?php MainWP_UI::render_empty_page_placeholder( __( 'No Ignored Updates', 'mainwp' ), __( 'All theme updates are being tracked. When you choose to ignore updates for a specific theme, they will appear here.', 'mainwp' ), '<em data-emoji=":compass:" class="big"></em>' ); ?> | |
| 2799 | + <?php endif; ?> | |
| 2666 | 2800 | <?php |
| 2667 | 2801 | /** |
| 2668 | 2802 | * Action: mainwp_themes_after_ignored_abandoned |
| 2669 | 2803 | * |
| @@ -2700,9 +2834,9 @@ | ||
| 2700 | 2834 | <tr theme-slug="<?php echo esc_attr( rawurlencode( $ignoredTheme ) ); ?>"> |
| 2701 | 2835 | <td><?php echo esc_html( $ignoredThemeName ); ?></td> |
| 2702 | 2836 | <td><?php echo esc_html( $ignoredTheme ); ?></td> |
| 2703 | 2837 | <td class="right aligned"> |
| 2704 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2838 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2705 | 2839 | <a href="#" class="ui mini button" onClick="return updatesoverview_themes_abandoned_unignore_globally( '<?php echo esc_js( rawurlencode( $ignoredTheme ) ); ?>' )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a> |
| 2706 | 2840 | <?php endif; ?> |
| 2707 | 2841 | </td> |
| 2708 | 2842 | </tr> |
| @@ -2708,9 +2842,9 @@ | ||
| 2708 | 2842 | </tr> |
| 2709 | 2843 | <?php endforeach; ?> |
| 2710 | 2844 | <?php endif; ?> |
| 2711 | 2845 | </tbody> |
| 2712 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2846 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2713 | 2847 | <?php if ( $ignoredThemes ) : ?> |
| 2714 | 2848 | <tfoot class="full-width"> |
| 2715 | 2849 | <tr> |
| 2716 | 2850 | <th scope="col" colspan="3"> |
| @@ -2788,9 +2922,9 @@ | ||
| 2788 | 2922 | <?php endif; ?> |
| 2789 | 2923 | <td><?php echo esc_html( $ignoredThemeName ); ?></td> |
| 2790 | 2924 | <td><?php echo esc_html( $ignoredTheme ); ?></td> |
| 2791 | 2925 | <td class="right aligned"> |
| 2792 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2926 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2793 | 2927 | <a href="#" class="ui mini button" onClick="return updatesoverview_themes_unignore_abandoned_detail( '<?php echo esc_js( rawurlencode( $ignoredTheme ) ); ?>', <?php echo intval( $website->id ); ?> )"><?php esc_html_e( 'Unignore', 'mainwp' ); ?></a> |
| 2794 | 2928 | <?php endif; ?> |
| 2795 | 2929 | </td> |
| 2796 | 2930 | </tr> |
| @@ -2800,9 +2934,9 @@ | ||
| 2800 | 2934 | MainWP_DB::free_result( $websites ); |
| 2801 | 2935 | ?> |
| 2802 | 2936 | <?php endif; ?> |
| 2803 | 2937 | </tbody> |
| 2804 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2938 | + <?php if ( \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ) ) : ?> | |
| 2805 | 2939 | <?php if ( 0 < $cnt ) : ?> |
| 2806 | 2940 | <tfoot class="full-width"> |
| 2807 | 2941 | <tr> |
| 2808 | 2942 | <th scope="col" colspan="4"> |
| @@ -2832,9 +2966,11 @@ | ||
| 2832 | 2966 | } |
| 2833 | 2967 | |
| 2834 | 2968 | |
| 2835 | 2969 | /** |
| 2836 | - * Hooks the section help content to the Help Sidebar element. | |
| 2970 | + * Method mainwp_help_content() | |
| 2971 | + * | |
| 2972 | + * Creates the MainWP Help Documentation List for the help component in the sidebar. | |
| 2837 | 2973 | */ |
| 2838 | 2974 | public static function mainwp_help_content() { |
| 2839 | 2975 | // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 2840 | 2976 | if ( isset( $_GET['page'] ) && ( 'ThemesManage' === $_GET['page'] || 'ThemesInstall' === $_GET['page'] || 'ThemesAutoUpdate' === $_GET['page'] || 'ThemesIgnore' === $_GET['page'] || 'ThemesIgnoredAbandoned' === $_GET['page'] ) ) { |
| @@ -2840,16 +2976,13 @@ | ||
| 2840 | 2976 | if ( isset( $_GET['page'] ) && ( 'ThemesManage' === $_GET['page'] || 'ThemesInstall' === $_GET['page'] || 'ThemesAutoUpdate' === $_GET['page'] || 'ThemesIgnore' === $_GET['page'] || 'ThemesIgnoredAbandoned' === $_GET['page'] ) ) { |
| 2841 | 2977 | ?> |
| 2842 | 2978 | <p><?php esc_html_e( 'If you need help with managing themes, please review following help documents', 'mainwp' ); ?></p> |
| 2843 | 2979 | <div class="ui relaxed bulleted list"> |
| 2844 | - <div class="item"><a href="https://kb.mainwp.com/docs/managing-themes-with-mainwp/" target="_blank">Managing Themes with MainWP</a> <i class="external alternate icon"></i></div> | |
| 2845 | - <div class="item"><a href="https://kb.mainwp.com/docs/install-themes/" target="_blank">Install Themes</a> <i class="external alternate icon"></i></div> | |
| 2846 | - <div class="item"><a href="https://kb.mainwp.com/docs/activate-themes/" target="_blank">Activate Themes</a> <i class="external alternate icon"></i></div> | |
| 2847 | - <div class="item"><a href="https://kb.mainwp.com/docs/delete-themes/" target="_blank">Delete Themes</a> <i class="external alternate icon"></i></div> | |
| 2848 | - <div class="item"><a href="https://kb.mainwp.com/docs/abandoned-themes/" target="_blank">Abandoned Themes</a> <i class="external alternate icon"></i></div> | |
| 2849 | - <div class="item"><a href="https://kb.mainwp.com/docs/update-themes/" target="_blank">Update Themes</a> <i class="external alternate icon"></i></div> | |
| 2850 | - <div class="item"><a href="https://kb.mainwp.com/docs/themes-auto-updates/" target="_blank">Themes Auto Updates</a> <i class="external alternate icon"></i></div> | |
| 2851 | - <div class="item"><a href="https://kb.mainwp.com/docs/ignore-theme-updates/" target="_blank">Ignore Theme Updates</a> <i class="external alternate icon"></i></div> | |
| 2980 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/themes/managing-themes-with-mainwp" target="_blank">Managing Themes with MainWP</a></div> | |
| 2981 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/themes/managing-themes-with-mainwp#install-themes" target="_blank">Install Themes</a></div> | |
| 2982 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/themes/managing-themes-with-mainwp#activate-themes" target="_blank">Activate Themes</a></div> | |
| 2983 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/themes/managing-themes-with-mainwp#delete-themes" target="_blank">Delete Themes</a></div> | |
| 2984 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/themes/managing-themes-with-mainwp#update-themes" target="_blank">Update Themes</a></div> | |
| 2852 | 2985 | <?php |
| 2853 | 2986 | /** |
| 2854 | 2987 | * Action: mainwp_themes_help_item |
| 2855 | 2988 | * |