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 | class/class-mainwp-client-list-table.php +227 -138 5.2 → 6.2.1 View file →
@@ -6,8 +6,13 @@
6 6 */
7 7
8 8 namespace MainWP\Dashboard;
9 9
10 +// Exit if accessed directly.
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
14 +
10 15 /**
11 16 * Class MainWP_Client_List_Table
12 17 *
13 18 * @package MainWP\Dashboard
@@ -66,9 +71,25 @@
66 71 *
67 72 * @since 4.1
68 73 */
69 74 $item = apply_filters( 'mainwp_clients_sitestable_item', $item, $item );
70 - return isset( $item[ $column_name ] ) && ! empty( $item[ $column_name ] ) ? $item[ $column_name ] : 'N/A';
75 +
76 + if ( isset( $item[ $column_name ] ) && ! empty( $item[ $column_name ] ) ) {
77 + switch ( $column_name ) {
78 + case 'client_phone':
79 + return '<a href="tel:' . esc_attr( $item[ $column_name ] ) . '" class="ui mini icon button" data-tooltip="' . esc_attr( $item[ $column_name ] ) . '" data-inverted="" data-position="left center"><i class="phone grey icon"></i></a>';
80 + case 'client_facebook':
81 + return '<a href="' . esc_attr( $item[ $column_name ] ) . '" target="_blank" class="ui mini icon button"><i class="facebook grey icon"></i></a>';
82 + case 'client_twitter':
83 + return '<a href="' . esc_attr( $item[ $column_name ] ) . '" target="_blank" class="ui mini icon button"><i class="twitter grey icon"></i></a>';
84 + case 'client_instagram':
85 + return '<a href="' . esc_attr( $item[ $column_name ] ) . '" target="_blank" class="ui mini icon button"><i class="instagram grey icon"></i></a>';
86 + case 'client_linkedin':
87 + return '<a href="' . esc_attr( $item[ $column_name ] ) . '" target="_blank" class="ui mini icon button"><i class="linkedin grey icon"></i></a>';
88 + default:
89 + return $item[ $column_name ];
90 + }
91 + }
71 92 }
72 93
73 94 /**
74 95 * Get sortable columns.
@@ -76,26 +97,22 @@
76 97 * @return array $sortable_columns Array of sortable column names.
77 98 */
78 99 public function get_sortable_columns() {
79 100 return array(
80 - 'name' => array( 'name', false ),
81 - 'client_email' => array( 'client_email', false ),
82 - 'client_phone' => array( 'client_phone', false ),
83 - 'client_facebook' => array( 'client_facebook', false ),
84 - 'client_twitter' => array( 'client_twitter', false ),
85 - 'client_instagram' => array( 'client_instagram', false ),
86 - 'client_linkedin' => array( 'client_linkedin', false ),
87 - 'suspended' => array( 'suspended', false ),
88 - 'tags' => array( 'tags', false ),
89 - 'websites' => array( 'websites', false ),
90 - 'contact_name' => array( 'contact_name', false ),
91 - 'address_1' => array( 'address_1', false ),
92 - 'address_2' => array( 'address_2', false ),
93 - 'city' => array( 'city', false ),
94 - 'zip' => array( 'zip', false ),
95 - 'state' => array( 'state', false ),
96 - 'created' => array( 'created', false ),
97 - 'country' => array( 'country', false ),
101 + 'client' => array( 'client', false ),
102 + 'name' => array( 'name', false ),
103 + 'client_email' => array( 'client_email', false ),
104 + 'suspended' => array( 'suspended', false ),
105 + 'tags' => array( 'tags', false ),
106 + 'websites' => array( 'websites', false ),
107 + 'contact_name' => array( 'contact_name', false ),
108 + 'address_1' => array( 'address_1', false ),
109 + 'address_2' => array( 'address_2', false ),
110 + 'city' => array( 'city', false ),
111 + 'zip' => array( 'zip', false ),
112 + 'state' => array( 'state', false ),
113 + 'created' => array( 'created', false ),
114 + 'country' => array( 'country', false ),
98 115 );
99 116 }
100 117
101 118 /**
@@ -105,19 +122,20 @@
105 122 */
106 123 public function get_default_columns() {
107 124 return array(
108 125 'cb' => '<input type="checkbox" />',
109 - 'name' => esc_html__( 'Client', 'mainwp' ),
110 126 'image' => esc_html__( 'Image', 'mainwp' ),
127 + 'client' => esc_html__( 'Client', 'mainwp' ),
128 + 'suspended' => esc_html__( 'Status', 'mainwp' ),
129 + 'name' => esc_html__( 'Name', 'mainwp' ),
111 130 'tags' => esc_html__( 'Tags', 'mainwp' ),
112 - 'contact_name' => esc_html__( 'Contact Name', 'mainwp' ),
131 + 'contact_name' => esc_html__( 'Primary Contact', 'mainwp' ),
113 132 'client_email' => esc_html__( 'Client Email', 'mainwp' ),
114 - 'suspended' => esc_html__( 'Status', 'mainwp' ),
115 - 'client_phone' => esc_html__( 'Phone', 'mainwp' ),
116 - 'client_facebook' => esc_html__( 'Facebook', 'mainwp' ),
117 - 'client_twitter' => esc_html__( 'X', 'mainwp' ),
118 - 'client_instagram' => esc_html__( 'Instagram', 'mainwp' ),
119 - 'client_linkedin' => esc_html__( 'LinkedIn', 'mainwp' ),
133 + 'client_phone' => '<i class="phone grey icon"></i>',
134 + 'client_facebook' => '<i class="facebook grey icon"></i>',
135 + 'client_twitter' => '<i class="twitter grey icon"></i>',
136 + 'client_instagram' => '<i class="instagram grey icon"></i>',
137 + 'client_linkedin' => '<i class="linkedin grey icon"></i>',
120 138 'websites' => esc_html__( 'Websites', 'mainwp' ),
121 139 'address_1' => esc_html__( 'Address 1', 'mainwp' ),
122 140 'address_2' => esc_html__( 'Address 2', 'mainwp' ),
123 141 'city' => esc_html__( 'City', 'mainwp' ),
@@ -212,10 +230,10 @@
212 230 $default_filter = empty( $selected_group ) ? true : false;
213 231 ?>
214 232 <div class="ui grid">
215 233 <div class="equal width row ui mini form">
216 - <div class="middle aligned column">
217 - <div id="mainwp-clients-bulk-actions-menu" class="ui selection dropdown">
234 + <div class="middle aligned column">
235 + <div id="mainwp-clients-bulk-actions-menu" class="ui selection dropdown disabled">
218 236 <div class="default text"><?php esc_html_e( 'Bulk actions', 'mainwp' ); ?></div>
219 237 <i class="dropdown icon"></i>
220 238 <div class="menu">
221 239 <?php
@@ -232,34 +250,41 @@
232 250 }
233 251 ?>
234 252 </div>
235 253 </div>
236 - <button class="ui tiny basic button" id="mainwp-do-clients-bulk-actions"><?php esc_html_e( 'Apply', 'mainwp' ); ?></button>
254 + <button class="ui mini basic button" id="mainwp-do-clients-bulk-actions" disabled="disabled"><?php esc_html_e( 'Apply', 'mainwp' ); ?></button>
237 255 </div>
238 256 <div class="right aligned middle aligned column">
239 - <?php esc_html_e( 'Filter clients: ', 'mainwp' ); ?>
240 - <div id="mainwp-filter-clients-group" class="ui selection multiple dropdown" style="vertical-align:bottom">
241 - <input type="hidden" value="<?php echo esc_html( $selected_group ); ?>">
242 - <i class="dropdown icon"></i>
243 - <div class="default text"><?php esc_html_e( 'All tags', 'mainwp' ); ?></div>
244 - <div class="menu">
245 - <?php
246 - $groups = MainWP_DB_Common::instance()->get_groups_for_manage_sites();
257 + <?php
258 + $groups = MainWP_DB_Common::instance()->get_groups_for_manage_sites();
247 259
248 - foreach ( $groups as $group ) {
249 - ?>
250 - <div class="item" data-value="<?php echo intval( $group->id ); ?>"><?php echo esc_html( stripslashes( $group->name ) ); ?></div>
251 - <?php
252 - }
253 - ?>
254 - <div class="item" data-value="nogroups"><?php esc_html_e( 'No Tags', 'mainwp' ); ?></div>
260 + if ( empty( $groups ) ) {
261 + ?>
262 + <a href="admin.php?page=ManageGroups" class="ui mini green basic button">
263 + <i class="tag icon"></i> <?php esc_html_e( 'Create Tags', 'mainwp' ); ?>
264 + </a>
265 + <?php
266 + } else {
267 + ?>
268 + <div id="mainwp-filter-clients-group" class="ui selection multiple dropdown" style="vertical-align:bottom">
269 + <input type="hidden" value="<?php echo esc_html( $selected_group ); ?>">
270 + <i class="dropdown icon"></i>
271 + <div class="default text"><?php esc_html_e( 'All tags', 'mainwp' ); ?></div>
272 + <div class="menu">
273 + <?php foreach ( $groups as $group ) : ?>
274 + <div class="item" data-value="<?php echo intval( $group->id ); ?>"><?php echo esc_html( stripslashes( $group->name ) ); ?></div>
275 + <?php endforeach; ?>
276 + <div class="item" data-value="nogroups"><?php esc_html_e( 'No Tags', 'mainwp' ); ?></div>
277 + </div>
255 278 </div>
256 - </div>
257 - <button onclick="mainwp_manage_clients_filter()" class="ui mini green button"><?php esc_html_e( 'Filter Clients', 'mainwp' ); ?></button>
258 - <a href="admin.php?page=ManageClients" class="ui mini button" <?php echo $default_filter ? 'disabled="disabled"' : ''; ?>><?php esc_html_e( 'Reset Filters', 'mainwp' ); ?></a>
279 + <button onclick="mainwp_manage_clients_filter()" class="ui mini basic green button"><i class="filter icon"></i> <?php esc_html_e( 'Filter', 'mainwp' ); ?></button>
280 + <a href="admin.php?page=ManageClients" class="ui mini button" <?php echo $default_filter ? 'disabled="disabled"' : ''; ?>><i class="times icon"></i> <?php esc_html_e( 'Reset', 'mainwp' ); ?></a>
281 + <?php
282 + }
283 + ?>
259 284 </div>
285 + </div>
260 286 </div>
261 - </div>
262 287 <script type="text/javascript">
263 288 jQuery( document ).ready( function () {
264 289 mainwp_manage_clients_filter = function() {
265 290 let group = jQuery( "#mainwp-filter-clients-group" ).dropdown( "get value" );
@@ -274,9 +299,8 @@
274 299 </script>
275 300 <?php
276 301 }
277 302
278 -
279 303 /**
280 304 * Prepair the items to be listed.
281 305 *
282 306 * @param bool $optimize true|false Whether or not to optimize.
@@ -353,16 +377,8 @@
353 377
354 378 $pagelength_val = implode( ',', array_keys( $pages_length ) );
355 379 $pagelength_title = implode( ',', array_values( $pages_length ) );
356 380
357 - ?>
358 - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-client-info-message' ) ) : ?>
359 - <div class="ui info message">
360 - <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-client-info-message"></i>
361 - <?php printf( esc_html__( 'Manage your clients. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/manage-clients/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); // NOSONAR - noopener - open safe. ?>
362 - </div>
363 - <?php endif; ?>
364 - <?php
365 381 MainWP_Client_Handler::show_notice_existed_contact_emails();
366 382 ?>
367 383 <table id="mainwp-manage-clients-table" style="width:100%" class="ui single line selectable unstackable table mainwp-with-preview-table mainwp-manage-wpsites-table">
368 384 <thead>
@@ -372,19 +388,14 @@
372 388 </thead>
373 389 <tbody id="mainwp-manage-sites-body-table">
374 390 <?php $this->display_rows_or_placeholder(); ?>
375 391 </tbody>
376 - <tfoot>
377 - <tr>
378 - <?php $this->print_column_headers( $optimize, false ); ?>
379 - </tr>
380 - </tfoot>
381 - </table>
382 - <div id="mainwp-loading-sites" style="display: none;">
383 - <div class="ui active inverted dimmer">
384 - <div class="ui indeterminate large text loader"><?php esc_html_e( 'Loading ...', 'mainwp' ); ?></div>
385 - </div>
386 - </div>
392 + </table>
393 + <div id="mainwp-loading-sites" style="display: none;">
394 + <div class="ui active page dimmer">
395 + <div class="ui double text loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div>
396 + </div>
397 + </div>
387 398 <?php MainWP_UI::render_modal_edit_notes( 'client' ); ?>
388 399 <?php
389 400
390 401 $table_features = array(
@@ -393,15 +404,16 @@
393 404 'pagingType' => 'full_numbers',
394 405 'info' => 'true',
395 406 'colReorder' => '{columns:":not(.check-column):not(.manage-client_actions-column)"}',
396 407 'stateSave' => 'true',
397 - 'stateDuration' => '0',
408 + 'stateDuration' => '60 * 60 * 24 * 30',
398 409 'order' => '[]',
399 410 'scrollX' => 'true',
400 411 'responsive' => 'true',
412 + 'searchDelay' => 350,
401 413 );
402 414
403 - /**
415 + /**z
404 416 * Filter: mainwp_clients_table_features
405 417 *
406 418 * Filter the Clients table features.
407 419 *
@@ -463,20 +475,29 @@
463 475 ],
464 476 "lengthMenu" : [ [<?php echo esc_js( $pagelength_val ); ?>, -1 ], [<?php echo esc_js( $pagelength_title ); ?>, "All" ] ],
465 477 "pageLength": <?php echo intval( $sites_per_page ); ?>,
466 478 "drawCallback": function( settings ) {
479 + jQuery( '#mainwp-manage-sites-body-table .ui.checkbox' ).checkbox();
467 480 },
468 481 select: {
469 482 items: 'row',
470 483 style: 'multi+shift',
471 - selector: 'tr>td:not(.not-selectable)'
472 - }
484 + selector: 'tr>td.check-column'
485 + },
486 + stateSaveParams: function (settings, data) {
487 + data._mwpv = mainwpParams.mainwpVersion || 'dev';
488 + },
489 + stateLoadParams: function (settings, data) {
490 + if ((mainwpParams.mainwpVersion || 'dev') !== data._mwpv) return false;
491 + },
492 + search: { regex: false, smart: false },
493 + orderMulti: false,
494 + searchDelay: <?php echo intval( $table_features['searchDelay'] ); ?>
473 495 } ).on( 'columns-reordered', function () {
474 - console.log('columns-reorderede');
475 496 setTimeout(() => {
476 497 $( '#mainwp-manage-clients-table .ui.dropdown' ).dropdown();
477 498 $( '#mainwp-manage-clients-table .ui.checkbox' ).checkbox();
478 - mainwp_datatable_fix_menu_overflow();
499 + mainwp_datatable_fix_menu_overflow('#mainwp-manage-clients-tabl');
479 500 }, 1000 );
480 501 } ).on('select', function (e, dt, type, indexes) {
481 502 if( 'row' == type ){
482 503 dt.rows(indexes)
@@ -492,9 +513,13 @@
492 513 });
493 514 } catch(err) {
494 515 // to fix js error.
495 516 }
496 - mainwp_datatable_fix_menu_overflow();
517 + mainwp_datatable_fix_menu_overflow('#mainwp-manage-clients-table');
518 +
519 + // Initialize header checkboxes
520 + jQuery( '#mainwp-manage-clients-table thead .ui.checkbox' ).checkbox();
521 +
497 522 _init_manage_sites_screen = function() {
498 523 jQuery( '#mainwp-manage-sites-screen-options-modal input[type=checkbox][id^="mainwp_show_column_"]' ).each( function() {
499 524 let col_id = jQuery( this ).attr( 'id' );
500 525 col_id = col_id.replace( "mainwp_show_column_", "" );
@@ -516,9 +541,9 @@
516 541 *
517 542 * @param bool $optimize true|false Whether or not to optimize.
518 543 * @param bool $top true|false.
519 544 */
520 - public function print_column_headers( $optimize, $top = true ) {
545 + public function print_column_headers( $optimize, $top = true ) { // phpcs:ignore -- NOSONAR - complex.
521 546 // for compatible.
522 547 $optimize = $optimize ? true : false;
523 548
524 549 list( $columns, $sortable ) = $this->get_column_info();
@@ -523,9 +548,9 @@
523 548
524 549 list( $columns, $sortable ) = $this->get_column_info();
525 550
526 551 if ( ! empty( $columns['cb'] ) ) {
527 - $columns['cb'] = '<div class="ui checkbox"><input id="' . ( $top ? 'cb-select-all-top' : 'cb-select-all-bottom' ) . '" type="checkbox" aria-label="Select all clients." /></div>';
552 + $columns['cb'] = '<div class="ui checkbox"><input id="' . ( $top ? 'cb-select-all-top' : 'cb-select-all-bottom' ) . '" type="checkbox" aria-label="' . esc_attr__( 'Select all clients.', 'mainwp' ) . '" /><label></label></div>';
528 553 }
529 554
530 555 $def_columns = $this->get_default_columns();
531 556 $def_columns['client_actions'] = '';
@@ -543,8 +568,64 @@
543 568 $class[] = 'check-column';
544 569 $class[] = 'collapsing';
545 570 }
546 571
572 + if ( 'suspended' === $column_client_key ) {
573 + $class[] = 'collapsing center aligned';
574 + }
575 +
576 + if ( 'image' === $column_client_key ) {
577 + $class[] = 'collapsing center aligned';
578 + }
579 +
580 + if ( 'name' === $column_client_key ) {
581 + $class[] = 'collapsing';
582 + }
583 +
584 + if ( 'websites' === $column_client_key ) {
585 + $class[] = 'collapsing';
586 + }
587 +
588 + if ( 'created' === $column_client_key ) {
589 + $class[] = 'collapsing center aligned';
590 + }
591 +
592 + if ( 'notes' === $column_client_key ) {
593 + $class[] = 'collapsing center aligned';
594 + }
595 +
596 + if ( 'tags' === $column_client_key ) {
597 + $class[] = 'collapsing';
598 + }
599 +
600 + if ( 'client_facebook' === $column_client_key ) {
601 + $class[] = 'collapsing center aligned';
602 + }
603 +
604 + if ( 'client_instagram' === $column_client_key ) {
605 + $class[] = 'collapsing center aligned';
606 + }
607 +
608 + if ( 'client_twitter' === $column_client_key ) {
609 + $class[] = 'collapsing center aligned';
610 + }
611 +
612 + if ( 'client_linkedin' === $column_client_key ) {
613 + $class[] = 'collapsing center aligned';
614 + }
615 +
616 + if ( 'client_phone' === $column_client_key ) {
617 + $class[] = 'collapsing center aligned';
618 + }
619 +
620 + if ( 'client_actions' === $column_client_key ) {
621 + $class[] = 'collapsing';
622 + }
623 +
624 + if ( 'contact_name' === $column_client_key ) {
625 + $class[] = 'collapsing';
626 + }
627 +
547 628 if ( ! isset( $sortable[ $column_client_key ] ) ) {
548 629 $class[] = 'no-sort';
549 630 }
550 631
@@ -636,14 +717,10 @@
636 717 list( $columns ) = $this->get_column_info();
637 718
638 719 foreach ( $columns as $column_name => $column_display_name ) {
639 720
640 - $classes = "collapsing $column_name column-$column_name";
721 + $classes = "$column_name column-$column_name";
641 722
642 - if ( 'client_actions' === $column_name ) {
643 - $classes .= ' center aligned ';
644 - }
645 -
646 723 $attributes = "class='$classes'";
647 724 ?>
648 725 <?php if ( 'cb' === $column_name ) { ?>
649 726 <td class="check-column">
@@ -648,51 +725,12 @@
648 725 <?php if ( 'cb' === $column_name ) { ?>
649 726 <td class="check-column">
650 727 <div class="ui checkbox">
651 728 <input type="checkbox" value="<?php echo intval( $item['client_id'] ); ?>" name="" aria-label="<?php esc_attr_e( 'Select the site.', 'mainwp' ); ?>"/>
729 + <label></label>
652 730 </div>
653 731 </td>
654 732 <?php
655 - } elseif ( 'client_actions' === $column_name ) {
656 - $selected_sites = isset( $item['selected_sites'] ) ? trim( $item['selected_sites'] ) : '';
657 - ?>
658 - <td class="collapsing manage-clients-actions not-selectable">
659 - <div class="ui right pointing dropdown icon mini basic green button" style="z-index:999;">
660 - <i class="ellipsis horizontal icon"></i>
661 - <div class="menu" clientid=<?php echo intval( $item['client_id'] ); ?>>
662 - <a class="item client_getedit" href="admin.php?page=ClientAddNew&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php esc_html_e( 'Edit', 'mainwp' ); ?></a>
663 - <a class="item" href="admin.php?page=managesites&client=<?php echo intval( $item['client_id'] ); ?>"><?php esc_html_e( 'View Sites', 'mainwp' ); ?></a>
664 - <?php if ( is_plugin_active( 'mainwp-pro-reports-extension/mainwp-pro-reports-extension.php' ) ) { ?>
665 - <a class="item" href="admin.php?page=Extensions-Mainwp-Pro-Reports-Extension&tab=report&action=newreport&selected_sites=<?php echo esc_html( $selected_sites ); ?>"><?php esc_html_e( 'Create Report', 'mainwp' ); ?></a>
666 - <?php } ?>
667 - <a class="item client_deleteitem" href="#"><?php esc_html_e( 'Delete', 'mainwp' ); ?></a>
668 - </div>
669 - </div>
670 - </td>
671 - <?php
672 - } elseif ( 'image' === $column_name ) {
673 - echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput
674 - ?>
675 - <?php $client_display_image = MainWP_Client_Handler::get_client_contact_image( $item ); ?>
676 - <a class="item" href="admin.php?page=ManageClients&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php echo $client_display_image; //phpcs:ignore --- ok.?></a>
677 - <?php
678 - echo '</td>';
679 - } elseif ( 'name' === $column_name ) {
680 - echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput
681 - ?>
682 - <a class="item" href="admin.php?page=ManageClients&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php echo esc_html( $item['name'] ); ?></a>
683 - <?php
684 - echo '</td>';
685 - } elseif ( 'client_email' === $column_name ) {
686 - echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput
687 - ?>
688 - <a class="item" href="admin.php?page=ClientAddNew&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php echo esc_html( $item['client_email'] ); ?></a>
689 - <?php
690 - echo '</td>';
691 - } elseif ( 'tags' === $column_name ) {
692 - ?>
693 - <td class="collapsing"><?php echo MainWP_System_Utility::get_site_tags( $item, true ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
694 - <?php
695 733 } elseif ( 'suspended' === $column_name ) {
696 734 $client_status = '';
697 735 if ( 0 === intval( $item['suspended'] ) ) {
698 736 $client_status = '<span class="ui green mini fluid center aligned label">' . esc_html__( 'Active', 'mainwp' ) . '</span>';
@@ -703,9 +741,37 @@
703 741 } elseif ( 3 === intval( $item['suspended'] ) ) {
704 742 $client_status = '<span class="ui red mini fluid center aligned label">' . esc_html__( 'Lost', 'mainwp' ) . '</span>';
705 743 }
706 744 ?>
707 - <td class="collapsing"><?php echo $client_status; //phpcs:ignore -- ok. ?></td>
745 + <td><?php echo $client_status; //phpcs:ignore -- ok. ?></td>
746 + <?php } elseif ( 'image' === $column_name ) { ?>
747 + <?php echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput ?>
748 + <?php $client_display_image = MainWP_Client_Handler::get_client_contact_image( $item ); ?>
749 + <a class="item" href="admin.php?page=ManageClients&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php echo $client_display_image; //phpcs:ignore -- NOSONAR - ok.?></a>
750 + <?php echo '</td>'; ?>
751 + <?php } elseif ( 'client' === $column_name ) { ?>
752 + <?php echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput ?>
753 + <a href="admin.php?page=ManageClients&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php echo esc_html( $item['name'] ); ?></a>
754 + <div>
755 + <span class="ui small text">
756 + <a class="ui grey text" href="admin.php?page=ManageClients&client_id=<?php echo intval( $item['client_id'] ); ?>">
757 + <?php echo esc_html( $item['client_email'] ); ?>
758 + </a>
759 + </span>
760 + </div>
761 + <?php echo '</td>'; ?>
762 + <?php } elseif ( 'created' === $column_name ) { ?>
763 + <td data-order="<?php echo intval( $item['created'] ); ?>"><?php echo 0 !== (int)( $item['created'] ) ? '<span data-tooltip="' . MainWP_Utility::format_date( $item['created'] ) . '" data-inverted="" data-position="left center">' . MainWP_Utility::time_elapsed_string( $item['created'] ) . '</span>' : 'N/A'; //phpcs:ignore -- output ok. ?></td>
764 + <?php } elseif ( 'name' === $column_name ) { ?>
765 + <?php echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput ?>
766 + <a href="admin.php?page=ManageClients&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php echo esc_html( $item['name'] ); ?></a>
767 + <?php echo '</td>'; ?>
768 + <?php } elseif ( 'client_email' === $column_name ) { ?>
769 + <?php echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput ?>
770 + <a href="admin.php?page=ClientAddNew&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php echo esc_html( $item['client_email'] ); ?></a>
771 + <?php echo '</td>'; ?>
772 + <?php } elseif ( 'tags' === $column_name ) { ?>
773 + <td class="collapsing"><?php echo MainWP_System_Utility::get_site_tags( $item, true ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
708 774 <?php
709 775 } elseif ( 'websites' === $column_name ) {
710 776 $selected_sites = isset( $item['selected_sites'] ) ? trim( $item['selected_sites'] ) : '';
711 777 $selected_ids = ( '' !== $selected_sites ) ? explode( ',', $selected_sites ) : array();
@@ -710,31 +776,54 @@
710 776 $selected_sites = isset( $item['selected_sites'] ) ? trim( $item['selected_sites'] ) : '';
711 777 $selected_ids = ( '' !== $selected_sites ) ? explode( ',', $selected_sites ) : array();
712 778
713 779 $count = count( $selected_ids );
714 - echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput
715 780 ?>
716 - <a class="item" href="admin.php?page=managesites&client=<?php echo intval( $item['client_id'] ); ?>"><?php echo intval( $count ); ?></a>
781 + <?php echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput ?>
782 + <a class="ui mini grey button" href="admin.php?page=managesites&client=<?php echo intval( $item['client_id'] ); ?>"><i class="wordpress icon"></i><?php echo intval( $count ); ?></a>
783 + <?php echo '</td>'; ?>
717 784 <?php
718 - echo '</td>';
719 785 } elseif ( 'notes' === $column_name ) {
720 -
721 786 $note = html_entity_decode( $item['note'] );
722 787 $esc_note = MainWP_Utility::esc_content( $note );
723 788 $strip_note = wp_strip_all_tags( $esc_note );
724 789 echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput
725 790 if ( empty( $item['note'] ) ) :
791 + $cl_id1 = $item['client_id'];
726 792 ?>
727 - <a href="javascript:void(0)" class="mainwp-edit-client-note" id="mainwp-notes-<?php echo intval( $item['client_id'] ); ?>" data-tooltip="<?php esc_attr_e( 'Edit client notes.', 'mainwp' ); ?>" data-position="left center" data-inverted=""><i class="sticky note outline icon"></i></a>
728 - <?php else : ?>
729 - <a href="javascript:void(0)" class="mainwp-edit-client-note" id="mainwp-notes-<?php echo intval( $item['client_id'] ); ?>" data-tooltip="<?php echo substr( wp_unslash( $strip_note ), 0, 100 ); // phpcs:ignore WordPress.Security.EscapeOutput ?>" data-position="left center" data-inverted=""><i class="sticky green note icon"></i></a>
730 - <?php endif; ?>
731 - <span style="display: none" id="mainwp-notes-<?php echo intval( $item['client_id'] ); ?>-note"><?php echo wp_unslash( $esc_note ); // phpcs:ignore WordPress.Security.EscapeOutput ?></span>
732 - <?php
733 - echo '</td>';
734 - } elseif ( 'created' === $column_name ) {
735 - ?>
736 - <td class="collapsing" sort-value="<?php echo intval( $item['created'] ); ?>"><?php echo esc_html( 0 !== intval( $item['created'] ) ? MainWP_Utility::format_date( $item['created'] ) : 'N/A' ); ?></td>
793 + <a href="javascript:void(0)" class="mainwp-edit-client-note ui mini icon button" id="mainwp-notes-<?php echo intval( $cl_id1 ); ?>" data-tooltip="<?php esc_attr_e( 'Edit client notes.', 'mainwp' ); ?>" data-position="left center" data-inverted=""><i class="sticky note outline icon"></i></a>
794 + <?php else :
795 + $cl_id2 = $item['client_id']; ?>
796 + <a href="javascript:void(0)" class="mainwp-edit-client-note ui mini icon button" id="mainwp-notes-<?php echo intval( $cl_id2 ); ?>" data-tooltip="<?php echo substr( wp_unslash( $strip_note ), 0, 100 ); // phpcs:ignore WordPress.Security.EscapeOutput ?>" data-position="left center" data-inverted=""><i class="sticky green note icon"></i></a>
797 + <?php endif; ?>
798 + <span style="display: none" id="mainwp-notes-<?php echo intval( $item['client_id'] ); ?>-note"><?php echo wp_unslash( $esc_note ); // phpcs:ignore WordPress.Security.EscapeOutput ?></span>
799 + <?php echo '</td>'; ?>
800 + <?php } elseif ( 'client_actions' === $column_name ) { ?>
801 + <?php $selected_sites = isset( $item['selected_sites'] ) ? trim( $item['selected_sites'] ) : ''; ?>
802 + <td class="collapsing manage-clients-actions not-selectable">
803 + <div class="ui right pointing dropdown" style="z-index:999;">
804 + <i class="ellipsis vertical icon"></i>
805 + <div class="menu" clientid=<?php echo intval( $item['client_id'] ); ?>>
806 + <a class="item client_getedit" href="admin.php?page=ClientAddNew&client_id=<?php echo intval( $item['client_id'] ); ?>"><?php esc_html_e( 'Edit', 'mainwp' ); ?></a>
807 + <a class="item" href="admin.php?page=managesites&client=<?php echo intval( $item['client_id'] ); ?>"><?php esc_html_e( 'View Sites', 'mainwp' ); ?></a>
808 + <?php
809 + if ( is_plugin_active( 'mainwp-pro-reports-extension/mainwp-pro-reports-extension.php' ) ) {
810 + $report_url = add_query_arg(
811 + array(
812 + 'page' => 'Extensions-Mainwp-Pro-Reports-Extension',
813 + 'tab' => 'report',
814 + 'action' => 'newreport',
815 + 'selected_sites' => $selected_sites,
816 + ),
817 + 'admin.php'
818 + );
819 + ?>
820 + <a class="ui basic mini right floated button" href="<?php echo esc_url( $report_url ); ?>"><?php echo esc_html__( 'Create Report', 'mainwp' ); ?></a>
821 + <?php } ?>
822 + <a class="item client_deleteitem" href="#"><?php esc_html_e( 'Delete', 'mainwp' ); ?></a>
823 + </div>
824 + </div>
825 + </td>
737 826 <?php
738 827 } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
739 828 echo "<td $attributes>"; // phpcs:ignore WordPress.Security.EscapeOutput
740 829 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); // phpcs:ignore WordPress.Security.EscapeOutput