PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.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 5.2.2 5.3 All 153 releases
mainwp / widgets / widget-mainwp-client-overview-note.php

widget-mainwp-client-overview-note.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.1, at widgets/widget-mainwp-client-overview-note.php

126 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MainWP Client Overview Note Widget
4 *
5 * Displays the Client Note.
6 *
7 * @package MainWP/MainWP_Client_Overview_Note
8 */
9
10 namespace MainWP\Dashboard;
11
12 /**
13 * Class MainWP_Client_Overview_Note
14 *
15 * Displays the Client Note.
16 */
17 class MainWP_Client_Overview_Note { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
18 /**
19 * Method get_class_name()
20 *
21 * @return string __CLASS__ Class name.
22 */
23 public static function get_class_name() {
24 return __CLASS__;
25 }
26
27 /**
28 * Method render()
29 *
30 * @return mixed render_site_info()
31 */
32 public static function render() {
33 $client_id = isset( $_GET['client_id'] ) ? intval( $_GET['client_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
34 if ( empty( $client_id ) ) {
35 return;
36 }
37 static::render_addition_info( $client_id );
38 }
39
40
41 /**
42 * Render client overview Info.
43 *
44 * @param object $client_id Client ID.
45 */
46 public static function render_addition_info( $client_id ) {
47
48 $client_info = MainWP_DB_Client::instance()->get_wp_client_by( 'client_id', $client_id, ARRAY_A );
49
50 $note = '';
51 $esc_note = '';
52
53 if ( $client_info ) {
54 $note = html_entity_decode( $client_info['note'] );
55 $esc_note = MainWP_Utility::esc_content( $note );
56 }
57
58 ?>
59 <div class="mainwp-widget-header">
60 <h3 class="ui header handle-drag">
61 <?php
62 /**
63 * Filter: mainwp_clients_overview_note_widget_title
64 *
65 * Filters the Site info widget title text.
66 *
67 * @param object $client_info Object containing the child site info.
68 *
69 * @since 4.1
70 */
71 echo esc_html( apply_filters( 'mainwp_clients_overview_note_widget_title', esc_html__( 'Notes', 'mainwp' ), $client_info ) );
72 ?>
73 <div class="sub header"><?php echo esc_html__( 'Client notes.', 'mainwp' ); ?></div>
74 </h3>
75 </div>
76 <div class="mainwp-widget-client-card mainwp-scrolly-overflow">
77 <?php
78 /**
79 * Actoin: mainwp_clients_overview_note_widget_top
80 *
81 * Fires at the top of the Site Info widget on the Individual site overview page.
82 *
83 * @param object $client_info Object containing the child site info.
84 *
85 * @since 4.0
86 */
87 do_action( 'mainwp_clients_overview_note_widget_top', $client_info );
88 ?>
89 <?php
90 if ( $client_info ) {
91 echo $esc_note; // phpcs:ignore WordPress.Security.EscapeOutput
92 }
93 ?>
94
95
96 <div style="display:none" id="mainwp-notes-<?php echo intval( $client_info['client_id'] ); ?>-note"><?php echo wp_unslash( $esc_note ); // phpcs:ignore WordPress.Security.EscapeOutput ?></div>
97
98 <?php
99
100 /**
101 * Action: mainwp_clients_overview_note_widget_bottom
102 *
103 * Fires at the bottom of the Site Info widget on the Individual site overview page.
104 *
105 * @param object $client_info Object containing the child site info.
106 *
107 * @since 4.0
108 */
109 do_action( 'mainwp_clients_overview_note_widget_bottom', $client_info );
110 ?>
111 </div>
112 <div class="ui two columns grid mainwp-widget-footer">
113 <div class="column">
114 <?php if ( empty( $note ) ) : ?>
115 <a href="javascript:void(0)" class="mainwp-edit-client-note ui button mini fluid green" id="mainwp-notes-<?php echo esc_attr( $client_info['client_id'] ); ?>" data-tooltip="<?php esc_attr_e( 'Add notes.', 'mainwp' ); ?>" data-position="right center" data-inverted=""><?php esc_attr_e( 'Add Notes', 'mainwp' ); ?></a>
116 <?php else : ?>
117 <a href="javascript:void(0)" class="mainwp-edit-client-note ui mini fluid button green" id="mainwp-notes-<?php echo esc_attr( $client_info['client_id'] ); ?>" data-tooltip="<?php esc_attr_e( 'Edit notes.', 'mainwp' ); ?>" data-position="right center" data-inverted=""><?php esc_attr_e( 'Edit Notes', 'mainwp' ); ?></a>
118 <?php endif; ?>
119 </div>
120 <div class="column"></div>
121 </div>
122 <?php
123 MainWP_UI::render_modal_edit_notes();
124 }
125 }
126