PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
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
mainwp / widgets / widget-mainwp-client-overview-contacts.php

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

163 lines 6.7 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 Contacts Widget
4 *
5 * Displays the Client Contacts.
6 *
7 * @package MainWP/MainWP_Client_Overview_Contacts
8 */
9
10 namespace MainWP\Dashboard;
11
12 // Exit if accessed directly.
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17
18 /**
19 * Class MainWP_Client_Overview_Contacts
20 *
21 * Displays the Client Contacts.
22 */
23 class MainWP_Client_Overview_Contacts { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
24
25
26 /**
27 * The contact variable.
28 *
29 * @var mixed Default null
30 */
31 public $contact = null;
32
33 /**
34 * Method get_class_name()
35 *
36 * @return string __CLASS__ Class name.
37 */
38 public static function get_class_name() {
39 return __CLASS__;
40 }
41
42 /**
43 * Method render()
44 *
45 * @return mixed render_site_info()
46 */
47 public function render() {
48 if ( empty( $this->contact ) ) {
49 return;
50 }
51 static::render_contact( $this->contact );
52 }
53
54
55 /**
56 * Render client Contacts Info.
57 *
58 * @param object $contact_info The Contact.
59 */
60 public static function render_contact( $contact_info ) { // phpcs:ignore -- NOSONAR - complex.
61
62 if ( empty( $contact_info ) ) {
63 return;
64 }
65
66 ?>
67 <div class="mainwp-widget-header">
68 <h2 class="ui header handle-drag">
69 <?php
70 /**
71 * Filter: mainwp_clients_overview_contact_widget_title
72 *
73 * Filters the Site info widget title text.
74 *
75 * @param object $contact_info Object containing the child site info.
76 *
77 * @since 4.1
78 */
79 echo esc_html( apply_filters( 'mainwp_clients_overview_contact_widget_title', __( 'Client Contact', 'mainwp' ), $contact_info ) );
80 ?>
81 <div class="sub header">
82 <?php echo esc_html( apply_filters( 'mainwp_clients_overview_contact_widget_sutbitle', __( 'Contact Information', 'mainwp' ), $contact_info ) ); ?>
83 </div>
84 </h2>
85 </div>
86 <div class="mainwp-widget-client-card mainwp-scrolly-overflow">
87 <?php
88 /**
89 * Actoin: mainwp_clients_overview_contact_widget_top
90 *
91 * Fires at the top of the Site Info widget on the Individual site overview page.
92 *
93 * @param object $contact_info Object containing the child site info.
94 *
95 * @since 4.0
96 */
97 do_action( 'mainwp_clients_overview_contact_widget_top', $contact_info );
98 ?>
99 <?php if ( $contact_info ) : ?>
100 <div class="ui grid">
101 <div class="sixteen wide center aligned column">
102 <div class="ui image">
103 <?php echo MainWP_Client_Handler::get_client_contact_image( $contact_info, 'contact', 'small' ); //phpcs:ignore -- ok. ?>
104 </div>
105 </div>
106 <div class="sixteen wide center aligned column">
107 <h2 class="ui center aligned header">
108 <div class="content">
109 <?php echo esc_html( $contact_info['contact_name'] ); ?>
110 <?php if ( isset( $contact_info['contact_role'] ) && ! empty( $contact_info['contact_role'] ) ) : ?>
111 <div class="sub header">
112 <?php echo esc_html( $contact_info['contact_role'] ); ?>
113 </div>
114 <?php endif; ?>
115 </div>
116 </h2>
117 </div>
118
119 <div class="sixteen wide center aligned column">
120 <?php if ( isset( $contact_info['contact_email'] ) && '' !== $contact_info['contact_email'] ) : ?>
121 <a href="mailto:<?php echo esc_attr( $contact_info['contact_email'] ); ?>" class="ui basic icon button" target="_blank" data-tooltip="<?php echo esc_attr( $contact_info['contact_email'] ); ?>" data-inverted="" data-position="top center">
122 <i class="envelope grey icon"></i>
123 </a>
124 <?php endif; ?>
125 <?php if ( isset( $contact_info['contact_phone'] ) && '' !== $contact_info['contact_phone'] ) : ?>
126 <a href="tel:<?php echo esc_attr( $contact_info['contact_phone'] ); ?>" class="ui basic icon button" target="_blank" data-tooltip="<?php echo esc_attr( $contact_info['contact_phone'] ); ?>" data-inverted="" data-position="top center">
127 <i class="phone grey icon"></i>
128 </a>
129 <?php endif; ?>
130
131
132 <?php if ( isset( $contact_info['facebook'] ) && '' !== $contact_info['facebook'] ) : ?>
133 <a href="<?php echo esc_url( $contact_info['facebook'] ); ?>" class="ui basic icon button" target="_blank"><i class="facebook grey icon"></i></a>
134 <?php endif; ?>
135 <?php if ( isset( $contact_info['twitter'] ) && '' !== $contact_info['twitter'] ) : ?>
136 <a href="<?php echo esc_url( $contact_info['twitter'] ); ?>" class="ui basic icon button" target="_blank"><i class="twitter grey icon"></i></a>
137 <?php endif; ?>
138 <?php if ( isset( $contact_info['instagram'] ) && '' !== $contact_info['instagram'] ) : ?>
139 <a href="<?php echo esc_url( $contact_info['instagram'] ); ?>" class="ui basic icon button" target="_blank"><i class="instagram grey icon"></i></a>
140 <?php endif; ?>
141 <?php if ( isset( $contact_info['linkedin'] ) && '' !== $contact_info['linkedin'] ) : ?>
142 <a href="<?php echo esc_url( $contact_info['linkedin'] ); ?>" class="ui basic icon button" target="_blank"><i class="linkedin grey icon"></i></a>
143 <?php endif; ?>
144 </div>
145 </div>
146 <?php endif; ?>
147 <?php
148 /**
149 * Action: mainwp_clients_overview_contact_widget_bottom
150 *
151 * Fires at the bottom of the Site Info widget on the Individual site overview page.
152 *
153 * @param object $contact_info Object containing the child site info.
154 *
155 * @since 4.0
156 */
157 do_action( 'mainwp_clients_overview_contact_widget_bottom', $contact_info );
158 ?>
159 </div>
160 <?php
161 }
162 }
163