PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | widgets/widget-mainwp-client-overview-sites.php +86 -79 5.2 → 6.2.1 View file →
@@ -8,8 +8,13 @@
8 8 */
9 9
10 10 namespace MainWP\Dashboard;
11 11
12 +// Exit if accessed directly.
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit;
15 +}
16 +
12 17 /**
13 18 * Class MainWP_Client_Overview_Sites
14 19 *
15 20 * Displays the Client info.
@@ -102,23 +107,23 @@
102 107 $client_info = MainWP_DB_Client::instance()->get_wp_client_by( 'client_id', $client_id, ARRAY_A );
103 108
104 109 ?>
105 110 <div class="mainwp-widget-header">
106 - <h3 class="ui header handle-drag">
107 - <?php
108 - /**
109 - * Filter: mainwp_clients_overview_websites_widget_title
110 - *
111 - * Filters the Site info widget title text.
112 - *
113 - * @param object $client_info Object containing the child site info.
114 - *
115 - * @since 4.1
116 - */
117 - echo esc_html( apply_filters( 'mainwp_clients_overview_websites_widget_title', esc_html__( 'Sites', 'mainwp' ), $client_info ) );
118 - ?>
119 - <div class="sub header"><?php echo esc_html__( 'Websites that belong to the client.', 'mainwp' ); ?></div>
120 - </h3>
111 + <h2 class="ui header handle-drag">
112 + <?php
113 + /**
114 + * Filter: mainwp_clients_overview_websites_widget_title
115 + *
116 + * Filters the Site info widget title text.
117 + *
118 + * @param object $client_info Object containing the child site info.
119 + *
120 + * @since 4.1
121 + */
122 + echo esc_html( apply_filters( 'mainwp_clients_overview_websites_widget_title', esc_html__( 'Sites', 'mainwp' ), $client_info ) );
123 + ?>
124 + <div class="sub header"><?php echo esc_html__( 'Websites that belong to the client.', 'mainwp' ); ?></div>
125 + </h2>
121 126 </div>
122 127 <div class="mainwp-widget-client-card mainwp-scrolly-overflow">
123 128 <?php
124 129 /**
@@ -142,11 +147,8 @@
142 147 </thead>
143 148 <tbody id="mainwp-manage-sites-body-table">
144 149 <?php $this->display_rows_or_placeholder(); ?>
145 150 </tbody>
146 - <tfoot>
147 - <tr><?php $this->print_column_headers( false ); ?></tr>
148 - </tfoot>
149 151 </table>
150 152 <?php } ?>
151 153 <?php
152 154 /**
@@ -160,8 +162,13 @@
160 162 */
161 163 do_action( 'mainwp_clients_overview_websites_widget_bottom', $client_info );
162 164 ?>
163 165 </div>
166 + <div class="ui grid mainwp-widget-footer">
167 + <div class="column">
168 + <a href="admin.php?page=managesites&client=<?php echo intval( $client_id ); ?>" title="" class="ui mini basic button"><?php echo esc_html__( 'Manage Client Sites', 'mainwp' ); ?></a>
169 + </div>
170 + </div>
164 171
165 172 <?php
166 173 // @NO_SONAR_START@ - duplicated issue.
167 174
@@ -188,17 +195,17 @@
188 195 $pagelength_title = implode( ',', array_values( $pages_length ) );
189 196
190 197 $table_features = array(
191 198 'searching' => 'true',
192 - 'paging' => 'false',
193 - 'pagingType' => 'full_numbers',
194 - 'info' => 'true',
199 + 'paging' => 'true',
200 + 'info' => 'false',
195 201 'colReorder' => '{ columns:":not(.manage-status-column):not(.manage-site_actions-column)"} ',
196 202 'stateSave' => 'true',
197 - 'stateDuration' => '0',
203 + 'stateDuration' => '60 * 60 * 24 * 30',
198 204 'order' => '[]',
199 205 'scrollX' => 'true',
200 206 'responsive' => 'true',
207 + 'searchDelay' => 350,
201 208 );
202 209
203 210 ?>
204 211
@@ -212,10 +219,14 @@
212 219 $manage_sites_table = jQuery( '#mainwp-manage-sites-monitor-table' ).DataTable( {
213 220 "searching" : <?php echo esc_js( $table_features['searching'] ); ?>,
214 221 "responsive": responsive,
215 222 "paging" : <?php echo esc_js( $table_features['paging'] ); ?>,
216 - "pagingType" : "<?php echo esc_js( $table_features['pagingType'] ); ?>",
217 223 "info" : <?php echo esc_js( $table_features['info'] ); ?>,
224 + "layout": {
225 + "bottom": 'paging',
226 + "bottomStart": null,
227 + "bottomEnd": null
228 + },
218 229 "scrollX" : <?php echo esc_js( $table_features['scrollX'] ); ?>,
219 230 "colReorder" : <?php echo $table_features['colReorder']; // phpcs:ignore -- specical chars. ?>,
220 231 "stateSave" : <?php echo esc_js( $table_features['stateSave'] ); ?>,
221 232 "stateDuration" : <?php echo esc_js( $table_features['stateDuration'] ); ?>,
@@ -220,19 +231,9 @@
220 231 "stateSave" : <?php echo esc_js( $table_features['stateSave'] ); ?>,
221 232 "stateDuration" : <?php echo esc_js( $table_features['stateDuration'] ); ?>,
222 233 "order" : <?php echo $table_features['order']; // phpcs:ignore -- specical chars. ?>,
223 234 "lengthMenu" : [ [<?php echo esc_js( $pagelength_val ); ?>, -1 ], [<?php echo esc_js( $pagelength_title ); ?>, "All" ] ],
224 - "columnDefs": [
225 - {
226 - "targets": 'no-sort',
227 - "orderable": false
228 - },
229 - {
230 - "targets": 'manage-site-column',
231 - "type": 'natural-nohtml'
232 - },
233 - <?php do_action( 'mainwp_manage_sites_table_columns_defs' ); ?>
234 - ],
235 + "columnDefs": <?php echo wp_json_encode( $this->get_columns_defines() ); ?>,
235 236 "pageLength": <?php echo intval( $sites_per_page ); ?>,
236 237 "initComplete": function( settings, json ) {
237 238 },
238 239 "language": {
@@ -241,11 +242,19 @@
241 242 "drawCallback": function( settings ) {
242 243 if ( jQuery('#mainwp-manage-sites-body-table td.dt-empty').length > 0 && jQuery('#sites-table-count-empty').length ){
243 244 jQuery('#mainwp-manage-sites-body-table td.dt-empty').html(jQuery('#sites-table-count-empty').html());
244 245 }
245 - }
246 + },
247 + stateSaveParams: function (settings, data) {
248 + data._mwpv = mainwpParams.mainwpVersion || 'dev';
249 + },
250 + stateLoadParams: function (settings, data) {
251 + if ((mainwpParams.mainwpVersion || 'dev') !== data._mwpv) return false;
252 + },
253 + search: { regex: false, smart: false },
254 + orderMulti: false,
255 + searchDelay: <?php echo intval( $table_features['searchDelay'] ); ?>
246 256 } ).on( 'columns-reordered', function () {
247 - console.log('columns-reordered');
248 257 setTimeout(() => {
249 258 $( '#mainwp-manage-sites-monitor-table .ui.dropdown' ).dropdown();
250 259 $( '#mainwp-manage-sites-monitor-table .ui.checkbox' ).checkbox();
251 260 mainwp_datatable_fix_menu_overflow( '#mainwp-manage-sites-monitor-table' );
@@ -254,9 +263,9 @@
254 263 } catch(err) {
255 264 // to fix js error.
256 265 console.log(err);
257 266 }
258 - mainwp_datatable_fix_menu_overflow();
267 + mainwp_datatable_fix_menu_overflow( '#mainwp-manage-sites-monitor-table' );
259 268 });
260 269 </script>
261 270 <?php
262 271 // @NO_SONAR_END@ .
@@ -395,9 +404,8 @@
395 404 public function get_default_columns() {
396 405 return array(
397 406 'status' => '',
398 407 'site' => esc_html__( 'Site', 'mainwp' ),
399 - 'login' => '<i class="sign in alternate icon"></i>',
400 408 'update' => esc_html__( 'Updates', 'mainwp' ),
401 409 );
402 410 }
403 411
@@ -449,23 +457,23 @@
449 457 'targets' => 'no-sort',
450 458 'orderable' => false,
451 459 );
452 460 $defines[] = array(
461 + 'targets' => array( 'manage-status-column' ),
462 + 'className' => 'collapsing center aligned',
463 + );
464 + $defines[] = array(
453 465 'targets' => 'manage-site-column',
454 466 'className' => 'column-site-bulk mainwp-site-cell',
455 467 );
456 468 $defines[] = array(
457 - 'targets' => 'manage-url-column',
458 - 'className' => 'mainwp-url-cell',
469 + 'targets' => array( 'manage-update-column' ),
470 + 'className' => 'collapsing center aligned',
459 471 );
460 472 $defines[] = array(
461 - 'targets' => array( 'manage-login-column', 'manage-status_code-column', 'manage-site_actions-column', 'manage-client_name-column' ),
462 - 'className' => 'collapsing',
473 + 'targets' => array( 'manage-site_actions-column' ),
474 + 'className' => 'collapsing right aligned',
463 475 );
464 - $defines[] = array(
465 - 'targets' => array( 'manage-status-column' ),
466 - 'className' => 'collapsing',
467 - );
468 476 return $defines;
469 477 }
470 478
471 479 /**
@@ -569,36 +577,25 @@
569 577 $total_theme_upgrades += count( $theme_upgrades );
570 578 }
571 579
572 580 $total_updates = $total_wp_upgrades + $total_plugin_upgrades + $total_theme_upgrades;
573 -
574 - if ( 5 < $total_updates ) {
575 - $a_color = 'red';
576 - } elseif ( 0 < $total_updates && 5 >= $total_updates ) {
577 - $a_color = 'yellow';
578 - } else {
579 - $a_color = 'green';
580 - }
581 -
582 581 $hasSyncErrors = ( '' !== $website['sync_errors'] );
583 582
584 583 // @NO_SONAR_END@ .
585 584
586 - if ( $hasSyncErrors ) {
587 - $a_color = '';
588 - }
589 -
590 585 list( $columns ) = $this->get_column_info();
591 586
592 587 foreach ( $columns as $column_name => $column_display_name ) {
588 + ?>
593 589
594 - ?>
595 590 <?php if ( 'status' === $column_name ) { ?>
596 591 <td class="center aligned collapsing">
597 592 <?php if ( $hasSyncErrors ) : ?>
598 - <a class="mainwp_site_reconnect" href="#"><i class="circular inverted red unlink icon"></i></a>
593 + <a class="mainwp_site_reconnect" href="#"><i class="red large times icon"></i></a>
599 594 <?php else : ?>
600 - <a class="managesites_syncdata" href="#"><?php echo '1' === $website['suspended'] ? '<i class="pause circular yellow inverted circle icon"></i>' : '<i class="circular inverted green check icon"></i>'; ?></a>
595 + <a class="managesites_syncdata" href="#">
596 + <?php echo '1' === $website['suspended'] ? '<i class="yellow pause large icon"></i>' : '<i class="green large check icon"></i>'; ?>
597 + </a>
601 598 <?php endif; ?>
602 599 </td>
603 600 <?php
604 601 } elseif ( 'site' === $column_name ) {
@@ -606,28 +603,38 @@
606 603 if ( ! empty( $website['sync_errors'] ) ) {
607 604 $cls_site = 'site-sync-error';
608 605 }
609 606 ?>
610 - <td class="column-site-bulk mainwp-site-cell all <?php echo esc_html( $cls_site ); ?>"><a href="<?php echo 'admin.php?page=managesites&dashboard=' . intval( $website['id'] ); ?>" data-tooltip="<?php esc_attr_e( 'Open the site overview', 'mainwp' ); ?>" data-position="right center" data-inverted=""><?php echo esc_html( stripslashes( $website['name'] ) ); ?></a><i class="ui active inline loader tiny" style="display:none"></i><span id="site-status-<?php echo esc_attr( $website['id'] ); ?>" class="status hidden"></span></td>
611 - <?php } elseif ( 'login' === $column_name ) { ?>
612 - <td class="collapsing">
613 - <?php if ( ! mainwp_current_user_have_right( 'dashboard', 'access_wpadmin_on_child_sites' ) ) : ?>
614 - <i class="sign in icon"></i>
615 - <?php else : ?>
616 - <a href="<?php MainWP_Site_Open::get_open_site_url( $website['id'] ); ?>" data-tooltip="<?php esc_attr_e( 'Jump to the site WP Admin', 'mainwp' ); ?>" data-position="right center" data-inverted="" class="open_newwindow_wpadmin" target="_blank"><i class="sign in icon"></i></a>
617 - <?php endif; ?>
607 + <td class="column-site-bulk mainwp-site-cell all <?php echo esc_html( $cls_site ); ?>">
608 + <?php if ( ! \mainwp_current_user_can( 'dashboard', 'access_wpadmin_on_child_sites' ) ) : ?>
609 + <i class="sign in icon"></i>
610 + <?php else : ?>
611 + <a href="<?php MainWP_Site_Open::get_open_site_url( $website['id'] ); ?>" data-tooltip="<?php esc_attr_e( 'Jump to the site WP Admin', 'mainwp' ); ?>" data-position="right center" data-inverted="" class="open_newwindow_wpadmin" target="_blank"><i class="sign in icon"></i></a>
612 + <?php endif; ?>
613 + <a href="<?php echo 'admin.php?page=managesites&dashboard=' . intval( $website['id'] ); ?>" >
614 + <?php echo esc_html( stripslashes( $website['name'] ) ); ?>
615 + </a>
616 + <div>
617 + <span class="ui small text">
618 + <a href="<?php echo esc_url( $website['url'] ); ?>" class="mainwp-may-hide-referrer open_site_url ui grey text" target="_blank">
619 + <?php echo esc_html( MainWP_Utility::get_nice_url( $website['url'] ) ); ?>
620 + </a>
621 + </span>
622 + </div>
618 623 </td>
624 + <?php } elseif ( 'update' === $column_name ) { ?>
625 + <td>
626 + <a class="ui mini basic grey button" href="admin.php?page=managesites&updateid=<?php echo intval( $website['id'] ); ?>">
627 + <i class="sync alternate icon"></i> <?php echo intval( $total_updates ); ?>
628 + </a>
629 + </td>
619 630 <?php
620 - } elseif ( 'update' === $column_name ) {
621 - ?>
622 - <td class="collapsing center aligned"><span data-tooltip="<?php esc_attr_e( 'Number of available updates. Click to see details.', 'mainwp' ); ?>" data-position="left center" data-inverted=""><a class="ui mini compact button <?php echo esc_attr( $a_color ); ?>" href="admin.php?page=managesites&updateid=<?php echo intval( $website['id'] ); ?>"><?php echo intval( $total_updates ); ?></a></span></td>
623 - <?php
624 631 } elseif ( 'site_actions' === $column_name ) {
625 632 // @NO_SONAR_START@ - duplicated issue.
626 633 ?>
627 634 <td class="collapsing not-selectable">
628 - <div class="ui right pointing dropdown icon mini basic green button" style="z-index: 99;">
629 - <i class="ellipsis horizontal icon"></i>
635 + <div class="ui right pointing dropdown" style="z-index: 99;">
636 + <i class="ellipsis vertical icon"></i>
630 637 <div class="menu" siteid="<?php echo intval( $website['id'] ); ?>">
631 638 <?php if ( '' !== $website['sync_errors'] ) : ?>
632 639 <a class="mainwp_site_reconnect item" href="#"><?php esc_html_e( 'Reconnect', 'mainwp' ); ?></a>
633 640 <?php else : ?>
@@ -632,13 +639,13 @@
632 639 <a class="mainwp_site_reconnect item" href="#"><?php esc_html_e( 'Reconnect', 'mainwp' ); ?></a>
633 640 <?php else : ?>
634 641 <a class="managesites_syncdata item" href="#"><?php esc_html_e( 'Sync Data', 'mainwp' ); ?></a>
635 642 <?php endif; ?>
636 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'access_individual_dashboard' ) ) : ?>
643 + <?php if ( \mainwp_current_user_can( 'dashboard', 'access_individual_dashboard' ) ) : ?>
637 644 <a class="item" href="admin.php?page=managesites&dashboard=<?php echo intval( $website['id'] ); ?>"><?php esc_html_e( 'Overview', 'mainwp' ); ?></a>
638 645 <?php endif; ?>
639 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'edit_sites' ) ) : ?>
640 - <a class="item" href="admin.php?page=managesites&id=<?php echo intval( $website['id'] ); ?>"><?php esc_html_e( 'Edit Site', 'mainwp' ); ?></a>
646 + <?php if ( \mainwp_current_user_can( 'dashboard', 'edit_sites' ) ) : ?>
647 + <a class="item" href="admin.php?page=managesites&id=<?php echo intval( $website['id'] ); ?>"><?php esc_html_e( 'Settings', 'mainwp' ); ?></a>
641 648 <?php endif; ?>
642 649 </div>
643 650 </div>
644 651 </td>