PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2
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 / class / class-mainwp-ui.php

class-mainwp-ui.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 6.2, at class/class-mainwp-ui.php

3,623 lines 173.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MainWP UI.
4 *
5 * @package MainWP/Dashboard
6 */
7
8 namespace MainWP\Dashboard;
9
10 // Exit if accessed directly.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 /**
16 * Class MainWP_UI
17 *
18 * @package MainWP\Dashboard
19 */
20 class MainWP_UI { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
21
22 /**
23 * Method get_class_name()
24 *
25 * Get Class Name.
26 *
27 * @return object
28 */
29 public static function get_class_name() {
30 return __CLASS__;
31 }
32
33 /**
34 * Normalize a site URL before building an mShots request.
35 *
36 * @param string $url Child site URL.
37 *
38 * @return string Normalized site URL.
39 */
40 public static function get_normalized_mshots_target_url( $url ) {
41 if ( ! is_string( $url ) ) {
42 return '';
43 }
44
45 return esc_url_raw( trim( $url ) );
46 }
47
48 /**
49 * Build an mShots image URL for a site.
50 *
51 * @param string $url Child site URL.
52 * @param int $width Requested thumbnail width.
53 * @param bool $requeue Whether to force a requeue request.
54 *
55 * @return string mShots URL.
56 */
57 public static function get_mshots_image_url( $url, $width = 0, $requeue = false ) {
58 $site_url = static::get_normalized_mshots_target_url( $url );
59
60 if ( empty( $site_url ) ) {
61 return '';
62 }
63
64 $mshots_url = '//s0.wp.com/mshots/v1/' . rawurlencode( $site_url );
65 $query_args = array();
66 $width = intval( $width );
67
68 if ( 0 < $width ) {
69 $query_args['w'] = $width;
70 }
71
72 if ( $requeue ) {
73 $query_args['requeue'] = 'true';
74 }
75
76 if ( ! empty( $query_args ) ) {
77 $mshots_url .= '?' . http_build_query( $query_args, '', '&', PHP_QUERY_RFC3986 );
78 }
79
80 return $mshots_url;
81 }
82
83 /**
84 * Build the primary and requeue mShots URLs for a site.
85 *
86 * @param string $url Child site URL.
87 * @param int $width Requested thumbnail width.
88 *
89 * @return array mShots source URLs.
90 */
91 public static function get_mshots_image_sources( $url, $width = 0 ) {
92 return array(
93 'src' => static::get_mshots_image_url( $url, $width ),
94 'requeue_src' => static::get_mshots_image_url( $url, $width, true ),
95 );
96 }
97
98 /**
99 * Method select_sites_box()
100 *
101 * Select sites box.
102 *
103 * @deprecated 4.3 Use MainWP_UI_Select_Sites::select_sites_box().
104 *
105 * @param string $type Input type, radio.
106 * @param bool $show_group Whether or not to show group, Default: true.
107 * @param bool $show_select_all Whether to show select all.
108 * @param string $class_style Default = ''.
109 * @param string $style Default = ''.
110 * @param array $selected_websites Selected Child Sites.
111 * @param array $selected_groups Selected Groups.
112 * @param bool $enableOfflineSites (bool) True, if offline sites is enabled. False if not.
113 * @param integer $postId Post Meta ID.
114 *
115 * @uses \MainWP\Dashboard\MainWP_System_Utility::maybe_unserialyze()
116 */
117 public static function select_sites_box( $type = 'checkbox', $show_group = true, $show_select_all = true, $class_style = '', $style = '', &$selected_websites = array(), &$selected_groups = array(), $enableOfflineSites = false, $postId = 0 ) { // phpcs:ignore -- NOSONAR - compatible.
118
119 if ( $postId ) {
120
121 $sites_val = get_post_meta( $postId, '_selected_sites', true );
122 $selected_websites = MainWP_System_Utility::maybe_unserialyze( $sites_val );
123
124 if ( empty( $selected_websites ) ) {
125 $selected_websites = array();
126 }
127
128 $groups_val = get_post_meta( $postId, '_selected_groups', true );
129 $selected_groups = MainWP_System_Utility::maybe_unserialyze( $groups_val );
130
131 if ( empty( $selected_groups ) ) {
132 $selected_groups = array();
133 }
134 }
135
136 if ( empty( $selected_websites ) && isset( $_GET['selected_sites'] ) && ! empty( $_GET['selected_sites'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
137 $selected_sites = explode( '-', sanitize_text_field( wp_unslash( $_GET['selected_sites'] ) ) );// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
138 $selected_sites = array_map( 'intval', $selected_sites );
139 $selected_websites = array_filter( $selected_sites );
140 }
141
142 /**
143 * Action: mainwp_before_seclect_sites
144 *
145 * Fires before the Select Sites box.
146 *
147 * @since 4.1
148 */
149 do_action( 'mainwp_before_seclect_sites' );
150 ?>
151 <div id="mainwp-select-sites" class="mainwp_select_sites_wrapper">
152 <?php static::select_sites_box_body( $selected_websites, $selected_groups, $type, $show_group, $show_select_all, false, $enableOfflineSites, $postId ); ?>
153 </div>
154 <?php
155 /**
156 * Action: mainwp_after_seclect_sites
157 *
158 * Fires after the Select Sites box.
159 *
160 * @since 4.1
161 */
162 do_action( 'mainwp_after_seclect_sites' );
163 }
164
165 /**
166 * Method select_sites_box_body()
167 *
168 * Select sites box Body.
169 *
170 * @deprecated 4.3 Use MainWP_UI_Select_Sites::select_sites_box_body().
171 *
172 * @param array $selected_websites Child Site that are selected.
173 * @param array $selected_groups Group that are selected.
174 * @param string $type Selector type.
175 * @param bool $show_group Whether or not to show group, Default: true.
176 * @param bool $show_select_all Whether or not to show select all, Default: true.
177 * @param bool $updateQty Whether or not to update quantity, Default = false.
178 * @param bool $enableOfflineSites Whether or not to enable offline sites, Default: true.
179 * @param int $postId Post ID.
180 *
181 * @uses \MainWP\Dashboard\MainWP_DB::query()
182 * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
183 */
184 public static function select_sites_box_body( &$selected_websites = array(), &$selected_groups = array(), $type = 'checkbox', $show_group = true, $show_select_all = true, $updateQty = false, $enableOfflineSites = false, $postId = 0 ) { // phpcs:ignore -- NOSONAR - compatible.
185 unset( $updateQty );
186 if ( 'all' !== $selected_websites && ! is_array( $selected_websites ) ) {
187 $selected_websites = array();
188 }
189
190 if ( ! is_array( $selected_groups ) ) {
191 $selected_groups = array();
192 }
193
194 $selectedby = 'site';
195 if ( ! empty( $selected_groups ) ) {
196 $selectedby = 'group';
197 }
198
199 $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.name' ) );
200 $groups = MainWP_DB_Common::instance()->get_not_empty_groups( null, $enableOfflineSites );
201
202 // support staging extension.
203 $staging_enabled = is_plugin_active( 'mainwp-staging-extension/mainwp-staging-extension.php' ) || is_plugin_active( 'mainwp-timecapsule-extension/mainwp-timecapsule-extension.php' );
204
205 $edit_site_id = false;
206 if ( $postId ) {
207 $edit_site_id = get_post_meta( $postId, '_mainwp_edit_post_site_id', true );
208 $edit_site_id = intval( $edit_site_id );
209 }
210
211 if ( $edit_site_id ) {
212 $show_group = false;
213 }
214 // to fix layout with multi sites selector.
215 $tab_id = wp_rand();
216
217 static::render_select_sites_header( $tab_id, $staging_enabled, $selectedby, $show_group );
218 ?>
219 <div class="ui tab <?php echo 'site' === $selectedby ? 'active' : ''; ?>" data-tab="mainwp-select-sites-<?php echo esc_attr( $tab_id ); ?>" id="mainwp-select-sites">
220 <?php
221 static::render_select_sites( $websites, $type, $selected_websites, $enableOfflineSites, $edit_site_id, $show_select_all );
222 ?>
223 </div>
224 <?php if ( $staging_enabled ) { ?>
225 <div class="ui tab <?php echo 'staging' === $selectedby ? 'active' : ''; ?>" data-tab="mainwp-select-staging-sites-<?php echo esc_attr( $tab_id ); ?>">
226 <?php
227 static::render_select_sites_staging( $selected_websites, $edit_site_id, $type );
228 ?>
229 </div>
230 <?php
231 }
232 if ( $show_group ) {
233 ?>
234 <div class="ui tab <?php echo 'group' === $selectedby ? 'active' : ''; ?>" data-tab="mainwp-select-groups-<?php echo esc_attr( $tab_id ); ?>" id="mainwp-select-groups">
235 <?php
236 static::render_select_sites_group( $groups, $selected_groups, $type );
237 ?>
238 </div>
239 <?php
240 }
241 ?>
242 <?php
243 }
244
245 /**
246 * Method render_select_sites_header()
247 *
248 * Render selected sites header.
249 *
250 * @param int $tab_id Datatab ID.
251 * @param bool $staging_enabled True, if in the active plugins list. False, not in the list.
252 * @param array $selectedby Selected by.
253 * @param bool $show_group Whether or not to show group, Default: true.
254 * @param bool $show_client Whether or not to show client, Default: true.
255 *
256 * @devtodo Move to view folder.
257 */
258 public static function render_select_sites_header( $tab_id, $staging_enabled, $selectedby, $show_group = true, $show_client = false ) {
259
260 static $rendered_count = 0;
261
262 $rand_id_prefix = '';
263
264 if ( ! empty( $rendered_count ) ) {
265 $rand_id_prefix = '-' . MainWP_Utility::gen_rand_id();
266 }
267
268 ++$rendered_count;
269
270 ?>
271 <input type="hidden" name="select_by" value="<?php echo esc_attr( $selectedby ); ?>" id="select_by<?php echo esc_attr( $rand_id_prefix ); // empty prefix to ensure compatibility with extensions. ?>"/>
272 <input type="hidden" name="select_sites_tab" id="select_sites_tab<?php echo esc_attr( $rand_id_prefix ); // empty prefix to ensure compatibility with extensions. ?>" value="<?php echo esc_attr( $selectedby ); ?>"/>
273
274 <div class="mainwp-select-sites-header" id="mainwp-select-sites-header<?php echo esc_attr( $rand_id_prefix ); // empty prefix to ensure compatibility with extensions. ?>" >
275 <div class="ui secondary mini horizontal menu" id="mainwp-select-sites-menu">
276 <a class="item ui tab <?php echo ( 'site' === $selectedby ) ? 'active' : ''; ?>" data-tab="mainwp-select-sites-<?php echo esc_attr( $tab_id ); ?>" select-by="site"><?php esc_html_e( 'Sites', 'mainwp' ); ?></a>
277 <?php if ( $show_group ) : ?>
278 <a class="item ui tab <?php echo ( 'group' === $selectedby ) ? 'active' : ''; ?>" data-tab="mainwp-select-groups-<?php echo esc_attr( $tab_id ); ?>" select-by="group"><?php esc_html_e( 'Tags', 'mainwp' ); ?></a>
279 <?php endif; ?>
280 <?php if ( $show_client ) : ?>
281 <a class="item ui tab <?php echo ( 'client' === $selectedby ) ? 'active' : ''; ?>" data-tab="mainwp-select-clients-<?php echo esc_attr( $tab_id ); ?>" select-by="client"><?php esc_html_e( 'Clients', 'mainwp' ); ?></a>
282 <?php endif; ?>
283 <?php if ( $staging_enabled ) : ?>
284 <a class="item ui text tab" data-tab="mainwp-select-staging-sites-<?php echo esc_attr( $tab_id ); ?>" select-by="staging"><?php esc_html_e( 'Staging', 'mainwp' ); ?></a>
285 <?php endif; ?>
286 </div>
287 </div>
288
289
290 <?php
291 /**
292 * Action: mainwp_before_select_sites_filters
293 *
294 * Fires before the Select Sites box filters.
295 *
296 * @since 4.1
297 */
298 do_action( 'mainwp_before_select_sites_filters' );
299 ?>
300 <div id="mainwp-select-sites-filters">
301 <div class="ui mini fluid icon input">
302 <input type="text" id="mainwp-select-sites-filter" value="" placeholder="<?php esc_attr_e( 'Search...', 'mainwp' ); ?>" />
303 <i class="filter icon"></i>
304 </div>
305 </div>
306 <?php
307 /**
308 * Action: mainwp_after_select_sites_filters
309 *
310 * Fires after the Select Sites box filters.
311 *
312 * @since 4.1
313 */
314 do_action( 'mainwp_after_select_sites_filters' );
315 }
316
317 /**
318 * Method render_select_sites()
319 *
320 * @param object $websites Object containing child sites info.
321 * @param string $type Selector type.
322 * @param mixed $selected_websites Selected Child Sites.
323 * @param bool $enableOfflineSites (bool) True, if offline sites is enabled. False if not.
324 * @param mixed $edit_site_id Child Site ID to edit.
325 * @param bool $show_select_all Whether or not to show select all, Default: true.
326 * @param mixed $add_edit_client_id Show enable sites for client. Default: false, 0: add new client, 0 <: edit client.
327 * @param bool $show_select_all_disc Whether or not to show select all disconnect sites, Default: false.
328 *
329 * @return void Render Select Sites html.
330 *
331 * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
332 * @uses \MainWP\Dashboard\MainWP_DB::free_result()
333 */
334 public static function render_select_sites( $websites, $type, $selected_websites, $enableOfflineSites, $edit_site_id, $show_select_all, $add_edit_client_id = false, $show_select_all_disc = false ) { // phpcs:ignore -- NOSONAR - complex.
335 /**
336 * Action: mainwp_before_select_sites_list
337 *
338 * Fires before the Select Sites list.
339 *
340 * @param object $websites Object containing child sites info.
341 *
342 * @since 4.1
343 */
344 do_action( 'mainwp_before_select_sites_list', $websites );
345 $count_disc = 0;
346
347 static $rendered_count = 0;
348
349 $rand_id_prefix = '';
350
351 if ( ! empty( $rendered_count ) ) {
352 $rand_id_prefix = '-' . MainWP_Utility::gen_rand_id();
353 }
354
355 ++$rendered_count;
356
357 ?>
358 <div id="mainwp-select-sites-body<?php echo esc_attr( $rand_id_prefix ); ?>" class="mainwp-select-sites-items-body">
359 <div class="ui relaxed selection list mainwp-select-sites-list" id="mainwp-select-sites-list">
360 <?php if ( ! $websites ) : ?>
361 <div id="mainwp-select-sites-placeholder" class="ui segment">
362 <?php static::render_empty_element_placeholder( __( 'No sites yet', 'mainwp' ), __( 'Connect your first WordPress site to start managing it from MainWP.', 'mainwp' ), '<em data-emoji=":link:" class="medium"></em>' ); ?>
363 <div class="ui center aligned segment">
364 <a href="admin.php?page=managesites&do=new" class="ui mini green button"><?php esc_html_e( 'Connect a Site', 'mainwp' ); ?></a> <a href="https://docs.mainwp.com/getting-started/get-started-with-mainwp#add-a-site-to-your-dashboard" class="ui mini grey basic button" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Learn How', 'mainwp' ); ?></a>
365 </div>
366 </div>
367 <?php
368 else :
369 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
370 $enable_site = true;
371 if ( false === $add_edit_client_id ) {
372 $enable_site = true;
373 } elseif ( 0 === intval( $add_edit_client_id ) && false !== $add_edit_client_id ) {
374 if ( 0 < intval( $website->client_id ) ) {
375 $enable_site = false;
376 }
377 } elseif ( is_numeric( $add_edit_client_id ) && intval( $add_edit_client_id ) > 0 ) {
378 if ( 0 < intval( $website->client_id ) && intval( $website->client_id ) !== intval( $add_edit_client_id ) ) {
379 $enable_site = false;
380 }
381 }
382
383 $site_client_editing = ( $add_edit_client_id && $website->client_id && $add_edit_client_id === $website->client_id ) ? true : false;
384
385 $selected = false;
386 $disconnected = false;
387 if ( ( empty( $website->sync_errors ) || $enableOfflineSites ) && ( ! MainWP_System_Utility::is_suspended_site( $website ) || $site_client_editing ) && $enable_site ) {
388 $selected = ( 'all' === $selected_websites || in_array( $website->id, $selected_websites ) );
389 $disabled = '';
390 if ( $edit_site_id ) {
391 if ( (int) $website->id === $edit_site_id ) {
392 $selected = true;
393 } else {
394 $disabled = 'disabled="disabled"';
395 }
396 }
397
398 if ( '' !== $website->sync_errors ) {
399 $disconnected = true;
400 ++$count_disc;
401 }
402 $sel_id_prefix = MainWP_Utility::gen_rand_id( $website->id, true );
403 ?>
404 <div title="<?php echo esc_html( $website->url ); ?>" class="mainwp_selected_sites_item ui <?php echo esc_html( $type ); ?> item <?php echo $selected ? 'selected_sites_item_checked' : ''; ?> <?php echo esc_html( $disconnected ? 'warning' : '' ); ?>">
405 <input <?php echo esc_html( $disabled ); ?> type="<?php echo esc_html( $type ); ?>" name="<?php echo 'radio' === $type ? 'selected_sites' : 'selected_sites[]'; ?>" siteid="<?php echo intval( $website->id ); ?>" value="<?php echo intval( $website->id ); ?>" id="selected_sites_<?php echo esc_attr( $sel_id_prefix ); ?>" <?php echo $selected ? 'checked="true"' : ''; ?> />
406 <label for="selected_sites_<?php echo esc_attr( $sel_id_prefix ); ?>">
407 <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
408 </label>
409 </div>
410 <?php
411 } else {
412 $sel_id_prefix2 = MainWP_Utility::gen_rand_id( $website->id, true );
413 ?>
414 <div title="<?php echo esc_html( $website->url ); ?>" class="mainwp_selected_sites_item item ui <?php echo esc_html( $type ); ?> <?php echo $selected ? 'selected_sites_item_checked' : ''; ?>">
415 <input type="<?php echo esc_html( $type ); ?>" disabled="disabled" id="selected_sites_<?php echo esc_attr( $sel_id_prefix2 ); ?>"/>
416 <label for="selected_sites_<?php echo esc_attr( $sel_id_prefix2 ); ?>">
417 <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
418 </label>
419 </div>
420 <?php
421 }
422 }
423 MainWP_DB::free_result( $websites );
424 endif;
425 ?>
426 </div>
427 </div>
428 <?php
429 /**
430 * Action: mainwp_after_select_sites_list
431 *
432 * Fires after the Select Sites list.
433 *
434 * @param object $websites Object containing child sites info.
435 *
436 * @since 4.1
437 */
438 do_action( 'mainwp_after_select_sites_list', $websites );
439 ?>
440 <?php
441 }
442
443 /**
444 * Method render_select_sites_staging()
445 *
446 * Render selected staging sites.
447 *
448 * @param mixed $selected_websites Selected Child Sites.
449 * @param mixed $edit_site_id Child Site ID to edit.
450 * @param string $type Selector type.
451 *
452 * @return void Render selected staging sites html.
453 *
454 * @uses \MainWP\Dashboard\MainWP_DB::query()
455 * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
456 * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
457 * @uses \MainWP\Dashboard\MainWP_DB::free_result()
458 */
459 public static function render_select_sites_staging( $selected_websites, $edit_site_id, $type = 'checkbox' ) { //phpcs:ignore -- NOSONAR - complex.
460 $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, false, array( 'favi_icon' ), 'yes' ) );
461
462 static $rendered_count = 0;
463
464 $rand_id_prefix2 = '';
465
466 if ( ! empty( $rendered_count ) ) {
467 $rand_id_prefix2 = '-' . MainWP_Utility::gen_rand_id();
468 }
469
470 ++$rendered_count;
471 ?>
472 <div id="mainwp-select-sites-body<?php echo esc_attr( $rand_id_prefix2 ); ?>" class="mainwp-select-sites-items-body">
473 <div class="ui relaxed selection list" id="mainwp-select-staging-sites-list">
474 <?php if ( ! $websites ) : ?>
475 <h2 class="ui icon header">
476 <i class="folder open outline icon"></i>
477 <div class="content"><?php esc_html_e( 'No staging websites have been found!', 'mainwp' ); ?></div>
478 </h2>
479 <?php
480 else :
481 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
482 $selected = false;
483 if ( empty( $website->sync_errors ) && ! MainWP_System_Utility::is_suspended_site( $website ) ) {
484 $selected = ( 'all' === $selected_websites || in_array( $website->id, $selected_websites ) );
485 $disabled = '';
486 if ( $edit_site_id && $website->id !== $edit_site_id ) {
487 $disabled = 'disabled="disabled"';
488 }
489 $sel_id_prefix3 = MainWP_Utility::gen_rand_id( $website->id, true );
490 ?>
491 <div title="<?php echo esc_html( $website->url ); ?>" class="mainwp_selected_sites_item ui <?php echo esc_html( $type ); ?> item <?php echo $selected ? 'selected_sites_item_checked' : ''; ?>">
492 <input <?php echo esc_html( $disabled ); ?> type="<?php echo esc_html( $type ); ?>" name="<?php echo 'radio' === $type ? 'selected_sites' : 'selected_sites[]'; ?>" siteid="<?php echo intval( $website->id ); ?>" value="<?php echo intval( $website->id ); ?>" id="selected_sites_<?php echo esc_attr( $sel_id_prefix3 ); ?>" <?php echo $selected ? 'checked="true"' : ''; ?> />
493 <label for="selected_sites_<?php echo esc_attr( $sel_id_prefix3 ); ?>">
494 <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
495 </label>
496 </div>
497 <?php
498 } else {
499 ?>
500 <div title="<?php echo esc_html( $website->url ); ?>" class="mainwp_selected_sites_item item ui <?php echo esc_html( $type ); ?> <?php echo $selected ? 'selected_sites_item_checked' : ''; ?>">
501 <input type="<?php echo esc_html( $type ); ?>" disabled="disabled"/>
502 <label>
503 <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
504 </label>
505 </div>
506 <?php
507 }
508 }
509 MainWP_DB::free_result( $websites );
510 endif;
511 ?>
512 </div>
513 </div>
514 <?php
515 }
516
517 /**
518 * Method render_select_sites_group()
519 *
520 * Render selected sites group.
521 *
522 * @param array $groups Array of groups.
523 * @param mixed $selected_groups Selected groups.
524 * @param string $type Selector type.
525 *
526 * @return void Render selected sites group html.
527 */
528 public static function render_select_sites_group( $groups, $selected_groups, $type = 'checkbox' ) {
529 /**
530 * Action: mainwp_before_select_groups_list
531 *
532 * Fires before the Select Groups list.
533 *
534 * @param object $groups Object containing groups info.
535 *
536 * @since 4.1
537 */
538 do_action( 'mainwp_before_select_groups_list', $groups );
539
540 static $rendered_count = 0;
541
542 $rand_id_prefix3 = '';
543
544 if ( ! empty( $rendered_count ) ) {
545 $rand_id_prefix3 = '-' . MainWP_Utility::gen_rand_id();
546 }
547
548 ++$rendered_count;
549
550 ?>
551 <div id="mainwp-select-sites-body<?php echo esc_attr( $rand_id_prefix3 ); ?>" class="mainwp-select-sites-items-body">
552 <div class="ui relaxed selection list mainwp-select-groups-list" id="mainwp-select-groups-list<?php echo esc_attr( $rand_id_prefix3 ); // empty prefix to ensure compatibility with extensions. ?>">
553 <?php
554 if ( empty( $groups ) ) {
555 ?>
556 <h2 class="ui icon header">
557 <i class="folder open outline icon"></i>
558 <div class="content"><?php esc_html_e( 'No Tags created!', 'mainwp' ); ?></div>
559 <div class="ui divider hidden"></div>
560 <a href="admin.php?page=ManageGroups" class="ui green button basic"><?php esc_html_e( 'Create Tags', 'mainwp' ); ?></a>
561 </h2>
562 <?php
563 }
564 foreach ( $groups as $group ) {
565 $selected = in_array( $group->id, $selected_groups );
566 ?>
567 <div class="mainwp_selected_groups_item ui item <?php echo esc_html( $type ); ?> <?php echo $selected ? 'selected_groups_item_checked' : ''; ?>">
568 <input type="<?php echo esc_html( $type ); ?>" name="<?php echo 'radio' === $type ? 'selected_groups' : 'selected_groups[]'; ?>" value="<?php echo esc_attr( $group->id ); ?>" id="selected_groups_<?php echo esc_attr( $group->id ); ?>" <?php echo $selected ? 'checked="true"' : ''; ?> />
569 <label for="selected_groups_<?php echo esc_attr( $group->id ); ?>">
570 <?php echo esc_html( stripslashes( $group->name ) ); ?>
571 </label>
572 </div>
573 <?php
574 }
575 ?>
576 </div>
577 </div>
578 <?php
579 /**
580 * Action: mainwp_after_select_groups_list
581 *
582 * Fires after the Select Groups list.
583 *
584 * @param object $groups Object containing groups info.
585 *
586 * @since 4.1
587 */
588 do_action( 'mainwp_after_select_groups_list', $groups );
589 }
590
591 /**
592 * Method render_top_header()
593 *
594 * Render top header.
595 *
596 * @param array $params Page parameters.
597 *
598 * @uses \MainWP\Dashboard\MainWP_DB::query()
599 * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
600 * @uses \MainWP\Dashboard\MainWP_Menu::render_left_menu()
601 */
602 public static function render_top_header( $params = array() ) { // phpcs:ignore -- NOSONAR - complex.
603
604 $before_title = isset( $params['before_title'] ) ? $params['before_title'] . ' ' : '';
605 $title = isset( $params['title'] ) ? $params['title'] : '';
606
607 $which = isset( $params['which'] ) ? $params['which'] : '';
608
609 /**
610 * Filter: mainwp_header_title
611 *
612 * Filter the MainWP page title in the header element.
613 *
614 * @since 4.0
615 */
616 $title = apply_filters( 'mainwp_header_title', $title );
617
618 $show_menu = true;
619
620 if ( isset( $params['show_menu'] ) ) {
621 $show_menu = $params['show_menu'];
622 }
623
624 $title = $before_title . $title;
625
626 /**
627 * Filter: mainwp_header_left
628 *
629 * Filter the MainWP header element left side content.
630 *
631 * @since 4.0
632 */
633 $left = apply_filters( 'mainwp_header_left', $title, $params );
634
635 $right = static::render_header_actions();
636
637 /**
638 * Filter: mainwp_header_right
639 *
640 * Filter the MainWP header element right side content.
641 *
642 * @since 4.0
643 */
644 $right = apply_filters( 'mainwp_header_right', $right );
645
646 $sidebarPosition = get_user_option( 'mainwp_sidebarPosition' );
647 if ( false === $sidebarPosition ) {
648 $sidebarPosition = 1;
649 }
650
651 $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.name' ) );
652
653 $count_sites = MainWP_DB::instance()->get_websites_count();
654
655 // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
656 if ( empty( $count_sites ) && ! isset( $_GET['do'] ) ) {
657 static::render_modal_no_sites_note();
658 }
659
660 $siteViewMode = MainWP_Utility::get_siteview_mode();
661
662 $page = isset( $_GET['page'] ) ? wp_unslash( $_GET['page'] ) : '';
663
664 $tour_id = '';
665 if ( 'mainwp_tab' === $page ) {
666 $tour_id = '30496';
667 } elseif ( 'managesites' === $page ) {
668 if ( isset( $_GET['do'] ) && 'new' === $_GET['do'] ) {
669 $tour_id = '13210';
670 } elseif ( isset( $_GET['do'] ) && 'bulknew' === $_GET['do'] ) {
671 $tour_id = '60206';
672 } elseif ( ! isset( $_GET['dashboard'] ) && ! isset( $_GET['id'] ) && ! isset( $_GET['updateid'] ) && ! isset( $_GET['emailsettingsid'] ) && ! isset( $_GET['scanid'] ) ) {
673 if ( 'grid' === $siteViewMode ) {
674 $tour_id = '27217';
675 } else {
676 $tour_id = '29331';
677 }
678 }
679 } elseif ( 'MonitoringSites' === $page ) {
680 $tour_id = '29003';
681 } elseif ( 'ManageClients' === $page ) {
682 if ( isset( $_GET['client_id'] ) ) {
683 $tour_id = '28258';
684 } else {
685 $tour_id = '28240';
686 }
687 } elseif ( 'ClientAddNew' === $page ) {
688 if ( isset( $_GET['client_id'] ) ) {
689 $tour_id = '28962';
690 } else {
691 $tour_id = '28256';
692 }
693 } elseif ( 'ClientAddField' === $page ) {
694 $tour_id = '28257';
695 } elseif ( 'PluginsManage' === $page ) {
696 $tour_id = '28510';
697 } elseif ( 'ManageGroups' === $page ) {
698 $tour_id = '27275';
699 } elseif ( 'UpdatesManage' === $page ) {
700 $tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : '';
701 if ( 'plugins-updates' === $tab ) {
702 $tour_id = '28259';
703 } elseif ( 'themes-updates' === $tab ) {
704 $tour_id = '28447';
705 } elseif ( 'wordpress-updates' === $tab ) {
706 $tour_id = '29005';
707 } elseif ( 'translations-updates' === $tab ) {
708 $tour_id = '29007';
709 } elseif ( 'abandoned-plugins' === $tab ) {
710 $tour_id = '29008';
711 } elseif ( 'abandoned-themes' === $tab ) {
712 $tour_id = '29009';
713 } elseif ( 'plugin-db-updates' === $tab ) {
714 $tour_id = '33161';
715 } else {
716 $tour_id = '28259';
717 }
718 } elseif ( 'PluginsInstall' === $page ) {
719 $tour_id = '29011';
720 } elseif ( 'PluginsAutoUpdate' === $page ) {
721 $tour_id = '29015';
722 } elseif ( 'PluginsIgnore' === $page ) {
723 $tour_id = '29018';
724 } elseif ( 'PluginsIgnoredAbandoned' === $page ) {
725 $tour_id = '29329';
726 } elseif ( 'ThemesManage' === $page ) {
727 $tour_id = '28511';
728 } elseif ( 'ThemesInstall' === $page ) {
729 $tour_id = '29010';
730 } elseif ( 'ThemesAutoUpdate' === $page ) {
731 $tour_id = '29016';
732 } elseif ( 'ThemesIgnore' === $page ) {
733 $tour_id = '29019';
734 } elseif ( 'ThemesIgnoredAbandoned' === $page ) {
735 $tour_id = '29330';
736 } elseif ( 'UserBulkManage' === $page ) {
737 $tour_id = '28574';
738 } elseif ( 'UserBulkAdd' === $page ) {
739 $tour_id = '28575';
740 } elseif ( 'PasswordPolicy' === $page ) {
741 $tour_id = '80725';
742 } elseif ( 'BulkImportUsers' === $page ) {
743 $tour_id = '28736';
744 } elseif ( 'UpdateAdminPasswords' === $page ) {
745 $tour_id = '28737';
746 } elseif ( 'PostBulkManage' === $page ) {
747 $tour_id = '28796';
748 } elseif ( 'PostBulkAdd' === $page ) {
749 $tour_id = '28799';
750 } elseif ( 'PageBulkManage' === $page ) {
751 $tour_id = '29045';
752 } elseif ( 'PageBulkAdd' === $page ) {
753 $tour_id = '29048';
754 } elseif ( 'Extensions' === $page ) {
755 $tour_id = '28800';
756 } elseif ( 'Settings' === $page ) {
757 $tour_id = '28883';
758 } elseif ( 'SettingsAdvanced' === $page ) {
759 $tour_id = '28886';
760 } elseif ( 'SettingsEmail' === $page ) {
761 $tour_id = '29054';
762 } elseif ( 'MonitoringSettings' === $page ) {
763 $tour_id = '80726';
764 } elseif ( 'MainWPTools' === $page ) {
765 $tour_id = '29272';
766 } elseif ( 'RESTAPI' === $page ) {
767 $tour_id = '29273';
768 } elseif ( 'ApplicationPasswords' === $page ) {
769 $tour_id = '80727';
770 } elseif ( 'ServerInformation' === $page ) {
771 $tour_id = '28873';
772 } elseif ( 'ServerInformationCron' === $page ) {
773 $tour_id = '28874';
774 } elseif ( 'ErrorLog' === $page ) {
775 $tour_id = '28876';
776 } elseif ( 'ActionLogs' === $page ) {
777 $tour_id = '28877';
778 } elseif ( 'Extensions-Mainwp-Jetpack-Protect-Extension' === $page ) {
779 $tour_id = '31700';
780 } elseif ( 'Extensions-Mainwp-Jetpack-Scan-Extension' === $page ) {
781 $tour_id = '31694';
782 } elseif ( 'Extensions-Termageddon-For-Mainwp' === $page ) {
783 $tour_id = '32104';
784 } elseif ( 'Extensions-Advanced-Uptime-Monitor-Extension' === $page ) {
785 $tour_id = '32149';
786 } elseif ( 'Extensions-Mainwp-Custom-Dashboard-Extension' === $page ) {
787 $tour_id = '32150';
788 } elseif ( 'Extensions-Mainwp-Updraftplus-Extension' === $page ) {
789 $tour_id = '32151';
790 } elseif ( 'Extensions-Mainwp-Sucuri-Extension' === $page ) {
791 $tour_id = '32152';
792 } elseif ( 'Extensions-Mainwp-Clean-And-Lock-Extension' === $page ) {
793 $tour_id = '32153';
794 } elseif ( 'Extensions-Mainwp-Woocommerce-Shortcuts-Extension' === $page ) {
795 $tour_id = '32851';
796 } elseif ( 'Extensions-Mainwp-Buddy-Extension' === $page ) {
797 $tour_id = '33064';
798 } elseif ( 'Extensions-Mainwp-Backwpup-Extension' === $page ) {
799 $tour_id = '32923';
800 } elseif ( 'Extensions-Mainwp-Ssl-Monitor-Extension' === $page ) {
801 $tour_id = '33164';
802 } elseif ( 'Extensions-Mainwp-Cache-Control-Extension' === $page ) {
803 $tour_id = '33167';
804 } elseif ( 'Extensions-Mainwp-Maintenance-Extension' === $page ) {
805 $tour_id = '33301';
806 } elseif ( 'Extensions-Mainwp-Domain-Monitor-Extension' === $page ) {
807 $tour_id = '66031';
808 } elseif ( 'Extensions-Mainwp-Favorites-Extension' === $page ) {
809 $tour_id = '66035';
810 } elseif ( 'Extensions-Mainwp-Regression-Testing-Extension' === $page ) {
811 $tour_id = '66037';
812 }
813 // phpcs:enable
814 ?>
815 <div class="ui segment right sites sidebar" style="padding:0px" id="mainwp-sites-menu-sidebar">
816 <div class="ui segment" style="margin-bottom:0px">
817 <div class="ui header"><?php esc_html_e( 'Quick Site Shortcuts', 'mainwp' ); ?></div>
818 </div>
819 <div class="ui fitted divider"></div>
820 <div class="ui segment" style="margin-bottom:0px">
821 <div class="ui mini fluid icon input" <?php echo $websites ? '' : 'style="display: none;"'; ?> >
822 <input type="text" id="mainwp-sites-menu-filter" value="" placeholder="<?php esc_attr_e( 'Type to filter your sites', 'mainwp' ); ?>" />
823 <i class="filter icon"></i>
824 </div>
825 </div>
826 <div class="ui fluid vertical accordion menu" id="mainwp-sites-sidebar-menu" style="margin-top:0px;border-radius:0px;box-shadow:none;">
827 <?php while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { ?>
828 <div class="item mainwp-site-menu-item">
829 <div class="title">
830 <i class="dropdown icon"></i>
831 <label><?php echo esc_html( $website->name ); ?></label>
832 </div>
833 <div class="content">
834 <div class="ui hiden divider"></div>
835 <div class="ui fluid relaxed list">
836 <div class="item" >
837 <i class="grid layout icon"></i>
838 <a href="<?php echo 'admin.php?page=managesites&dashboard=' . intval( $website->id ); ?>"><?php esc_html_e( 'Operations', 'mainwp' ); ?></a>
839 </div>
840 <div class="item" >
841 <i class="redo icon"></i>
842 <a href="<?php echo 'admin.php?page=managesites&updateid=' . intval( $website->id ); ?>"><?php esc_html_e( 'Updates', 'mainwp' ); ?></a>
843 </div>
844 <div class="item">
845 <i class="edit icon"></i>
846 <a href="<?php echo 'admin.php?page=managesites&id=' . intval( $website->id ); ?>"><?php esc_html_e( 'Settings', 'mainwp' ); ?></a>
847 </div>
848 <div class="item">
849 <i class="sync alternate icon"></i>
850 <a href="#" siteid="<?php echo intval( $website->id ); ?>" onClick="updatesoverview_wp_sync( '<?php echo intval( $website->id ); ?>' )"><?php esc_html_e( 'Sync Site', 'mainwp' ); ?></a>
851 </div>
852 <div class="item">
853 <i class="shield icon"></i>
854 <a href="<?php echo 'admin.php?page=managesites&scanid=' . intval( $website->id ); ?>"><?php esc_html_e( 'Site Hardening', 'mainwp' ); ?></a>
855 </div>
856 <div class="item">
857 <i class="sign in icon"></i>
858 <a target="_blank" href="<?php MainWP_Site_Open::get_open_site_admin_link( $website->id, true ); //phpcs:ignore -- ok. ?>"><?php esc_html_e( 'Go to WP Admin', 'mainwp' ); ?></a>
859 </div>
860 <div class="item">
861 <i class="globe icon"></i>
862 <a target="_blank" href="<?php echo esc_url( $website->url ); ?>"><?php esc_html_e( 'Visit Site', 'mainwp' ); ?></a>
863 </div>
864
865 <?php
866 /**
867 * Action: mainwp_quick_sites_shortcut
868 *
869 * Adds a new shortcut item in the Quick Sites Shortcuts sidebar menu.
870 *
871 * @param array $website Array containing the child site data.
872 *
873 * Suggested HTML markup:
874 *
875 * <a class="item" href="your custom URL">
876 * <i class="your custom icon"></i>
877 * Your custom label text
878 * </a>
879 *
880 * @since 4.1
881 */
882 do_action( 'mainwp_quick_sites_shortcut', $website );
883 ?>
884 </div>
885 </div>
886 </div>
887 <?php } ?>
888 </div>
889 </div>
890 <div class="ui segment right wide help sidebar" id="mainwp-documentation-sidebar">
891 <div class="ui header"><?php esc_html_e( 'MainWP Guided Tours', 'mainwp' ); ?> <span class="ui blue mini label"><?php esc_html_e( 'BETA', 'mainwp' ); ?></span></div>
892 <div class="ui hidden divider"></div>
893 <div class="ui info message" style="display:block!important;">
894 <?php /* translators: 1: Opening anchor tag for privacy policy link, 2: Closing anchor tag. */ printf( esc_html__( 'This feature is implemented using Javascript provided by Usetiful and is subject to the %1$sUsetiful Privacy Policy%2$s.', 'mainwp' ), '<a href="https://www.usetiful.com/privacy-policy" target="_blank">', '</a>' ); ?>
895 </div>
896 <div class="ui hidden divider"></div>
897 <?php if ( 1 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ) : ?>
898 <p><?php esc_html_e( 'MainWP guided tours are designed to provide information about all essential features on each MainWP Dashboard page.', 'mainwp' ); ?></p>
899 <p><?php esc_html_e( 'Click the Start Page Tour button to start the guided tour for the current page.', 'mainwp' ); ?></p>
900 <div class="ui hidden divider"></div>
901 <button id="mainwp-start-page-tour-button" class="ui big green fluid basic button" tour-id="<?php echo esc_attr( $tour_id ); ?>"><?php esc_html_e( 'Start Page Tour', 'mainwp' ); ?></button>
902
903 <?php endif; ?>
904 <div class="ui header"><?php esc_html_e( 'MainWP Knowledge Base', 'mainwp' ); ?></div>
905 <div class="ui hidden divider"></div>
906 <?php
907 /**
908 * Action: mainwp_help_sidebar_content
909 *
910 * Fires Help sidebar content
911 *
912 * @since 4.0
913 */
914 do_action( 'mainwp_help_sidebar_content' );
915 ?>
916 <div class="ui hidden divider"></div>
917 <a href="https://docs.mainwp.com/" class="ui big green fluid button"><?php esc_html_e( 'Help Documentation', 'mainwp' ); // NOSONAR - noopener - open safe. ?></a>
918 <div class="ui hidden divider"></div>
919 <div id="mainwp-sticky-help-button" class="" style="position: absolute; bottom: 1em; left: 1em; right: 1em;">
920 <a href="https://community.mainwp.com/" target="_blank" class="ui fluid button"><?php esc_html_e( 'Still Need Help?', 'mainwp' ); ?></a>
921 </div>
922 </div>
923 <?php
924 /**
925 * Action: mainwp_before_mainwp_content_wrap
926 *
927 * Fires before the #mainwp-content-wrap element.
928 *
929 * @param array $websites Array containing the child site data.
930 *
931 * @since 4.1
932 */
933 do_action( 'mainwp_before_mainwp_content_wrap', $websites );
934 global $wp_version;
935 $fix_menu_overflow = 1;
936 if ( version_compare( $wp_version, '5.5.3', '>' ) ) {
937 $fix_menu_overflow = 2;
938 }
939
940 if ( 'page_clients_overview' !== $which ) {
941 ?>
942
943 <div class="ui modal" id="mainwp-overview-screen-options-modal">
944 <i class="close icon"></i>
945 <div class="header"><?php esc_html_e( 'Page Settings', 'mainwp' ); ?></div>
946 <div class="content ui form">
947 <?php
948 /**
949 * Action: mainwp_overview_screen_options_top
950 *
951 * Fires at the top of the Sceen Options modal on the Operations page.
952 *
953 * @since 4.1
954 */
955 do_action( 'mainwp_overview_screen_options_top' );
956 ?>
957 <form method="POST" action="" name="mainwp_overview_screen_options_form" id="mainwp-overview-screen-options-form">
958 <?php self::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
959 <input type="hidden" name="wp_nonce" value="<?php echo esc_html( wp_create_nonce( 'MainWPScrOptions' ) ); ?>" />
960 <?php static::render_screen_options( false ); ?>
961 <?php
962 /**
963 * Action: mainwp_overview_screen_options_bottom
964 *
965 * Fires at the bottom of the Sceen Options modal on the Operations page.
966 *
967 * @since 4.1
968 */
969 do_action( 'mainwp_overview_screen_options_bottom' );
970 ?>
971 </div>
972 <div class="actions">
973 <div class="ui two columns grid">
974 <div class="left aligned column">
975 <span data-tooltip="<?php esc_attr_e( 'Resets the page to its original layout and reinstates relocated widgets.', 'mainwp' ); ?>" data-inverted="" data-position="top left"><input type="button" class="ui button" name="reset" id="reset-overview-settings" value="<?php esc_attr_e( 'Reset Page', 'mainwp' ); ?>" /></span>
976 </div>
977 <div class="ui right aligned column">
978 <input type="submit" class="ui green button" id="submit-overview-settings" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>" />
979 </div>
980 </div>
981 </div>
982
983 <input type="hidden" name="reset_overview_settings" value="" />
984 </form>
985 </div>
986 <?php } ?>
987 <?php
988 $wrap_class = isset( $params['wrap_class'] ) ? $params['wrap_class'] : '';
989 ?>
990 <?php
991 /**
992 * Action: mainwp_before_header
993 *
994 * Fires before the MainWP header element.
995 *
996 * @param array $websites Array containing the child site data.
997 *
998 * @since 4.0
999 */
1000 do_action( 'mainwp_before_header', $websites );
1001 ?>
1002 <div id="mainwp-top-header">
1003 <div class="ui grid">
1004 <div class="center aligned middle aligned column" style="width:72px!important;padding:0!important;">
1005 <a href="
1006 <?php
1007 /**
1008 * Filter: mainwp_menu_logo_href
1009 *
1010 * Filters the Logo link.
1011 *
1012 * @since 4.1.4
1013 */
1014 echo esc_url( apply_filters( 'mainwp_menu_logo_href', admin_url( 'admin.php?page=mainwp_tab' ) ) );
1015 ?>
1016 ">
1017 <img src="
1018 <?php
1019 /**
1020 * Filter: mainwp_menu_logo_src
1021 *
1022 * Filters the Logo src attribute.
1023 *
1024 * @since 4.1
1025 */
1026 echo esc_url( apply_filters( 'mainwp_menu_logo_src', MAINWP_PLUGIN_URL . 'assets/images/mainwp-icon.svg' ) );
1027 ?>
1028 " alt="
1029 <?php
1030 /**
1031 * Filter: mainwp_menu_logo_alt
1032 *
1033 * Filters the Logo alt attribute.
1034 *
1035 * @since 4.1
1036 */
1037 echo esc_html( apply_filters( 'mainwp_menu_logo_alt', 'MainWP' ) );
1038 ?>
1039 " id="mainwp-navigation-icon" />
1040 </a>
1041 </div>
1042 <div class="left aligned middle aligned column" style="width:calc( 50% - 72px )!important">
1043 <h1 class="mainwp-page-title ui small header"><?php echo $left; // phpcs:ignore WordPress.Security.EscapeOutput ?></h1>
1044 </div>
1045 <div class="right aligned middle aligned column" style="width:50%!important">
1046 <?php echo $right; // phpcs:ignore WordPress.Security.EscapeOutput ?>
1047 </div>
1048 </div>
1049 </div>
1050 <script type="text/javascript">
1051 jQuery( document ).ready( function($) {
1052 $('#mainwp-top-header').prevAll().each(function () {
1053 let strId=$(this).attr('id');
1054 if(strId?.includes('mainwp')){
1055 return;
1056 }
1057 let strCls=$(this).attr('class');
1058 if(strCls?.includes('mainwp')){
1059 return;
1060 }
1061 if($(this).is(':visible')){
1062 $(this).prependTo('.mainwp-content-wrap'); // to fix display.
1063 $(this).css( 'margin-left', '0px' );
1064 }
1065 });
1066 });
1067 </script>
1068
1069 <?php
1070 if ( $show_menu ) {
1071 MainWP_Menu::render_left_menu();
1072 MainWP_Menu::render_mobile_menu();
1073 }
1074 ?>
1075 <div class="mainwp-content-wrap <?php echo esc_attr( $wrap_class ); ?> <?php echo empty( $sidebarPosition ) ? 'mainwp-sidebar-left' : ''; ?>" menu-overflow="<?php echo intval( $fix_menu_overflow ); ?>">
1076 <?php if ( MainWP_Demo_Handle::is_demo_mode() ) : ?>
1077 <div class="ui segment" style="background-color:#1c1d1b!important;margin-bottom:0px;">
1078 <div class="ui inverted accordion" id="mainwp_demo_mode_accordion" style="background-color:#1c1d1b;">
1079 <div class="title">
1080 <i class="dropdown icon"></i>
1081 <?php if ( ! MainWP_Demo_Handle::is_instawp_site() ) { ?>
1082 <strong style="color:#fff;font-size:16px;"><?php esc_html_e( 'You are in Demo Mode. Click here for more info or to disable it', 'mainwp' ); ?></strong>
1083 <?php } else { ?>
1084 <strong style="color:#fff;font-size:16px;"><?php esc_html_e( 'You are in Demo Mode. Click here for more info', 'mainwp' ); ?></strong>
1085 <?php } ?>
1086 </div>
1087 <div class="content">
1088 <br/>
1089 <div class="ui stackable grid">
1090 <div class="eleven wide middle aligned column">
1091 <?php if ( ! MainWP_Demo_Handle::is_instawp_site() ) { ?>
1092 <p style="color:#fff;font-size:16px;"><?php esc_html_e( 'Once you are ready to get started with MainWP, click the Disable Demo Mode & Remove Demo Content button to remove the demo content and start adding your own. ', 'mainwp' ); ?></p>
1093 <?php } ?>
1094 <p style="color:#fff;font-size:16px;"><strong><?php esc_html_e( 'The demo content serves as placeholder data to give you a feel for the MainWP Dashboard. Please note that because no real websites are connected in this demo, some functionality will be restricted. Features that require a connection to actual websites will be disabled for the duration of the demo.', 'mainwp' ); ?></strong></p>
1095 </div>
1096 <div class="five wide middle aligned column">
1097 <?php if ( ! MainWP_Demo_Handle::is_instawp_site() ) { ?>
1098 <div data-tooltip="<?php esc_attr_e( 'Delete the Demo content from your MainWP Dashboard and disable the Demo mode.', 'mainwp' ); ?>" data-inverted="" data-position="left center"><button class="ui big fluid button mainwp-remove-demo-data-button"><?php esc_html_e( 'Disable Demo Mode & Remove Demo Content', 'mainwp' ); ?></button></div>
1099 <?php } else { ?>
1100 <div data-tooltip="<?php esc_attr_e( 'Get started with MainWP.', 'mainwp' ); ?>" data-inverted="" data-position="left center"><a class="ui big fluid button" target="_blank" href="https://mainwp.com/install-mainwp/?utm_source=instawp-demo&utm_medium=banner&utm_campaign=download_black_banner&utm_id=instawp"><?php esc_html_e( 'Download MainWP', 'mainwp' ); // NOSONAR - noopener - open safe. ?></a></div>
1101 <?php } ?>
1102 </div>
1103 </div>
1104 <br/>
1105 </div>
1106 </div>
1107 </div>
1108 <script type="text/javascript">
1109 jQuery( '#mainwp_demo_mode_accordion' ).accordion();
1110 </script>
1111 <?php endif; ?>
1112
1113
1114 <?php if ( 1 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ) : ?>
1115 <script type="text/javascript">
1116 jQuery( document ).ready( function() {
1117 jQuery( '#mainwp-start-page-tour-button' ).on( 'click', function() {
1118 let tourId = jQuery( this ).attr( 'tour-id' );
1119 jQuery( '#mainwp-documentation-sidebar' ).sidebar( 'toggle' );
1120 if(tourId){
1121 window.USETIFUL.tour.start( Number.parseInt( tourId ) );
1122 } else {
1123 console.warn('Error: empty tour ID. Please set valid tour ID.');
1124 }
1125 } );
1126 jQuery( '#mainwp-interface-tour-button' ).on( 'click', function() {
1127 jQuery( '#mainwp-documentation-sidebar' ).sidebar( 'toggle' );
1128 window.USETIFUL.tour.start( 13282 );
1129 } );
1130 } );
1131 </script>
1132 <?php endif; ?>
1133
1134 <?php
1135 if ( isset( $_GET['message'] ) && ( 'qsw-import' === $_GET['message'] || 'enable-demo-mode' === $_GET['message'] ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
1136 ?>
1137 <script type= 'text/javascript'>
1138 let _count_retry = 0;
1139 _try_start_usetiful_tour = function () {
1140 setTimeout(
1141 function () {
1142 try {
1143 window.USETIFUL.tour.start( Number.parseInt( 40279 ) );
1144 } catch ( e ) {
1145 if ( _count_retry < 10 ) {
1146 _count_retry++;
1147 _try_start_usetiful_tour();
1148 }
1149 }
1150 },
1151 1000
1152 );
1153 }
1154 jQuery(document).ready(
1155 function () {
1156 _try_start_usetiful_tour();
1157 }
1158 );
1159 </script>
1160 <?php
1161 endif;
1162
1163 $fix_dom_issue_for_wp_editor = isset( $_GET['page'] ) && 'Extensions-Mainwp-Pro-Reports-Extension' === $_GET['page'] && isset( $_GET['tab'] ) && 'report' === $_GET['tab'] ? true : false; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended --NOSONAR - ok.
1164
1165 if ( $fix_dom_issue_for_wp_editor ) {
1166 ?>
1167 <style type="text/css">
1168 .mainwp-overlay-open #mainwp-main-mobile-navigation-container{
1169 top: 58px !important;
1170 }
1171 </style>
1172 <script type="text/javascript">
1173 jQuery(function ($) {
1174 const $body = $('body');
1175 const $flyout = $('#mainwp-main-mobile-navigation-container');
1176 const $overlay = $('#mainwp-overlay');
1177
1178 // Ensure elements are in body (safe move).
1179 if ($flyout.parent()[0] !== document.body) {
1180 $flyout.appendTo('body');
1181 $body.addClass('pushable');
1182 }
1183 if ($overlay.parent()[0] !== document.body) {
1184 $overlay.appendTo('body');
1185 $body.addClass('pushable');
1186 }
1187
1188 // Toggle
1189 $('#mainwp-mobile-menu-trigger').on('click', function () {
1190 $body.toggleClass('mainwp-overlay-open');
1191
1192 $(this).find('i.icon')
1193 .toggleClass('bars times');
1194 $flyout.toggleClass('overlay visible');
1195 $overlay.toggleClass('pusher dimmed');
1196 });
1197
1198 // Close on overlay click
1199 $overlay.on('click', function () {
1200 $body.removeClass('mainwp-overlay-open');
1201 $flyout.removeClass('overlay visible');
1202 $overlay.removeClass('pusher dimmed');
1203
1204 $('#mainwp-mobile-menu-trigger i.icon')
1205 .removeClass('times')
1206 .addClass('bars');
1207 });
1208
1209 $(document).on('keydown', function (e) {
1210 if (e.key === 'Escape') {
1211 $('body').removeClass('mainwp-overlay-open');
1212 $flyout.removeClass('overlay visible');
1213 $overlay.removeClass('pusher dimmed');
1214 $('#mainwp-mobile-menu-trigger i.icon')
1215 .removeClass('times')
1216 .addClass('bars');
1217 }
1218 });
1219 });
1220 </script>
1221 <?php
1222 }
1223 ?>
1224
1225 <script type="text/javascript">
1226 jQuery( document ).ready( function ($) {
1227
1228 let pulse = jQuery( '#mainwp-screen-options-pulse-control' ).val();
1229
1230 if (pulse == 1) {
1231 jQuery('#mainwp-top-header .cog.icon').parent('.button').transition({
1232 animation: 'pulse',
1233 duration: 1000,
1234 interval: 5500,
1235 onStart: function () {
1236 jQuery(this).removeClass('basic').addClass('green');
1237 },
1238 onComplete: function () {
1239 jQuery(this).addClass('basic').removeClass('green');
1240 }
1241 });
1242 }
1243
1244 jQuery( '#mainwp-sites-menu-sidebar' ).prependTo( 'body' );
1245 jQuery( '#mainwp-documentation-sidebar' ).prependTo( 'body' );
1246
1247 jQuery( '#mainwp-help-sidebar' ).on( 'click', function() {
1248 jQuery( '.ui.help.sidebar' ).sidebar( {
1249 transition: 'overlay'
1250 } );
1251 jQuery( '.ui.help.sidebar' ).sidebar( 'toggle' );
1252 return false;
1253 } );
1254 jQuery( '#mainwp-sites-sidebar' ).on( 'click', function() {
1255 jQuery( '.ui.sites.sidebar' ).sidebar( {
1256 transition: 'overlay',
1257 'onVisible': function() {
1258 jQuery( '#mainwp-sites-menu-filter' ).focus();
1259 }
1260 } );
1261 jQuery( '.ui.sites.sidebar' ).sidebar( 'toggle' );
1262 return false;
1263 } );
1264 jQuery( '#mainwp-sites-sidebar-menu' ).accordion();
1265 jQuery( '#mainwp-sites-sidebar-menu' ).on( 'click', '.mainwp-site-menu-item', function ( e ) {
1266 if ( ! jQuery( e.target ).closest( '.content' ).length && ! jQuery( e.target ).closest( '.title' ).length ) {
1267 jQuery( this ).find( '.title' ).first().trigger( 'click' );
1268 }
1269 } );
1270
1271 <?php if ( ! $fix_dom_issue_for_wp_editor ) { ?>
1272
1273 if( jQuery( '#mainwp-main-mobile-navigation-container' ).length ){
1274 jQuery('<div class="pusher"></div>')
1275 .append($('#wpwrap'))
1276 .prependTo('body');
1277 jQuery( '#mainwp-main-mobile-navigation-container' ).prependTo( 'body' );
1278 setTimeout(function () {
1279 // Initialize flyout
1280 $('#mainwp-main-mobile-navigation-container.ui.flyout')
1281 .flyout({
1282 dimPage: true,
1283 onShow: function() {
1284 $(this).css({
1285 'top': '58px',
1286 });
1287 $('#mainwp-mobile-menu-trigger').find('i.icon').removeClass('bars').addClass('times');
1288 },
1289 onHide: function() {
1290 $('#mainwp-mobile-menu-trigger').find('i.icon').removeClass('times').addClass('bars');
1291 }
1292 });
1293 }, 2000);
1294
1295 // Trigger button
1296 $('#mainwp-mobile-menu-trigger').on('click', function() {
1297 $('#mainwp-main-mobile-navigation-container.ui.flyout').flyout('toggle');
1298 });
1299 }
1300 <?php } ?>
1301 } );
1302 </script>
1303
1304 <?php static::render_help_modal(); ?>
1305 <?php static::render_loader_element(); ?>
1306 <?php
1307 ob_start();
1308 /**
1309 * Action: mainwp_after_header
1310 *
1311 * Fires after the MainWP header element.
1312 *
1313 * @param array $websites Array containing the child site data.
1314 *
1315 * @since 4.0
1316 */
1317 do_action( 'mainwp_after_header', $websites );
1318 $after_header_content = ob_get_clean();
1319 if ( ! empty( trim( $after_header_content ) ) ) {
1320 $has_extension_update_failure_notice = false !== strpos( $after_header_content, 'mainwp-extension-update-failure-notice' );
1321 $admin_notices_style = $has_extension_update_failure_notice ? 'padding-bottom:0 !important;' : '';
1322 $admin_notices_class = $has_extension_update_failure_notice ? ' mainwp-extension-update-failure-notice-segment' : '';
1323 ?>
1324 <div class="ui padded segment<?php echo esc_attr( $admin_notices_class ); ?>" id="mainwp-admin-notices-segment" style="<?php echo esc_attr( $admin_notices_style ); ?>">
1325 <?php echo $after_header_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1326 </div>
1327 <?php
1328 }
1329 ?>
1330 <?php
1331 }
1332
1333
1334 /**
1335 * Method render_showhide_columns_settings()
1336 *
1337 * Render show/hide columns settings.
1338 *
1339 * @param array $cols Columns.
1340 * @param array $show_columns Show Columns.
1341 * @param string $what what.
1342 */
1343 public static function render_showhide_columns_settings( $cols, $show_columns, $what ) {
1344 ?>
1345 <div class="ui grid field">
1346 <label class="six wide column"><?php esc_html_e( 'Show columns', 'mainwp' ); ?></label>
1347 <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Select columns that you want to hide.', 'mainwp' ); ?> data-inverted="" data-position="top left">
1348 <ul>
1349 <?php
1350 foreach ( $cols as $name => $title ) {
1351 $_selected = '';
1352 if ( ! isset( $show_columns[ $name ] ) || 1 === (int) $show_columns[ $name ] ) {
1353 $_selected = 'checked';
1354 }
1355 ?>
1356 <li>
1357 <div class="ui checkbox">
1358 <input type="checkbox" id="mainwp_show_column_<?php echo esc_attr( $name ); ?>" name="mainwp_show_columns[]" <?php echo esc_html( $_selected ); ?> value="<?php echo esc_attr( $name ); ?>">
1359 <label for="mainwp_show_column_<?php echo esc_attr( $name ); ?>" ><?php echo esc_html( $title ); ?></label>
1360 </div>
1361 <input type="hidden" name="mainwp_columns_name[]" value="<?php echo esc_attr( $name ); ?>">
1362 </li>
1363 <?php
1364 }
1365 ?>
1366 </ul>
1367 </div>
1368
1369 </div>
1370 <?php
1371
1372 $input_name = '';
1373 if ( 'post' === $what ) {
1374 $input_name = 'mainwp_manageposts_show_columns_settings';
1375 } elseif ( 'page' === $what ) {
1376 $input_name = 'mainwp_managepages_show_columns_settings';
1377 } elseif ( 'user' === $what ) {
1378 $input_name = 'mainwp_manageusers_show_columns_settings';
1379 }
1380
1381 if ( ! empty( $input_name ) ) {
1382 ?>
1383 <input type="hidden" name="<?php echo esc_attr( $input_name ); ?>" value="1">
1384 <?php
1385 }
1386 }
1387
1388 /**
1389 * Method render_second_top_header()
1390 *
1391 * Render second top header.
1392 *
1393 * @param string $which Current page.
1394 *
1395 * @return void Render second top header html.
1396 */
1397 public static function render_second_top_header( $which = '' ) {
1398
1399 /**
1400 * Action: mainwp_before_subheader
1401 *
1402 * Fires before the MainWP sub-header element.
1403 *
1404 * @since 4.0
1405 */
1406 do_action( 'mainwp_before_subheader' );
1407 if ( has_action( 'mainwp_subheader_actions' ) || 'overview' === $which || 'managesites' === $which || 'monitoringsites' === $which ) {
1408 ?>
1409 <div class="mainwp-sub-header">
1410 <?php
1411 if ( 'overview' === $which ) {
1412 ?>
1413 <div class="ui stackable grid">
1414 <div class="column full">
1415 <?php static::gen_groups_sites_selection(); ?>
1416 </div>
1417 </div>
1418 <?php
1419 }
1420 ?>
1421 <?php if ( 'managesites' === $which || 'monitoringsites' === $which ) : ?>
1422 <?php
1423 /**
1424 * Action: mainwp_managesites_tabletop
1425 *
1426 * Fires at the table top on the Manage Sites and Monitoring page.
1427 *
1428 * @since 4.0
1429 */
1430 do_action( 'mainwp_managesites_tabletop' );
1431 ?>
1432
1433 <?php else : ?>
1434 <?php
1435 /**
1436 * Action: mainwp_subheader_actions
1437 *
1438 * Fires at the subheader element to hook available actions.
1439 *
1440 * @since 4.0
1441 */
1442 do_action( 'mainwp_subheader_actions' );
1443 ?>
1444 <?php endif; ?>
1445 </div>
1446 <?php
1447 }
1448 /**
1449 * Action: mainwp_after_subheader
1450 *
1451 * Fires after the MainWP sub-header element.
1452 *
1453 * @since 4.0
1454 */
1455 do_action( 'mainwp_after_subheader' );
1456 }
1457
1458 /**
1459 * Method gen_groups_sites_selection()
1460 *
1461 * Generate group sites selection box.
1462 *
1463 * @return void Render group sites selection box.
1464 *
1465 * @uses \MainWP\Dashboard\MainWP_DB_Common::get_groups_for_manage_sites()
1466 * @uses \MainWP\Dashboard\MainWP_DB_Common::get_not_empty_groups()
1467 * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
1468 * @uses \MainWP\Dashboard\MainWP_DB::query()
1469 * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
1470 * @uses \MainWP\Dashboard\MainWP_DB::free_result()
1471 */
1472 public static function gen_groups_sites_selection() {
1473 $sql = MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, false, array( 'premium_upgrades', 'plugins_outdate_dismissed', 'themes_outdate_dismissed', 'plugins_outdate_info', 'themes_outdate_info', 'favi_icon' ) );
1474 $websites = MainWP_DB::instance()->query( $sql );
1475 $g = isset( $_GET['g'] ) ? intval( $_GET['g'] ) : -1; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
1476 $s = isset( $_GET['dashboard'] ) ? intval( $_GET['dashboard'] ) : -1; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
1477 ?>
1478 <div class="column full wide">
1479 <select id="mainwp_top_quick_jump_group" class="ui dropdown">
1480 <option value="" class="item"><?php esc_html_e( 'All Tags', 'mainwp' ); ?></option>
1481 <option <?php echo ( -1 === $g ) ? 'selected' : ''; ?> value="-1" class="item"><?php esc_html_e( 'All Tags', 'mainwp' ); ?></option>
1482 <?php
1483 $groups = MainWP_DB_Common::instance()->get_groups_for_manage_sites();
1484 foreach ( $groups as $group ) {
1485 ?>
1486 <option class="item" <?php echo ( $g === (int) $group->id ) ? 'selected' : ''; ?> value="<?php echo esc_attr( $group->id ); ?>"><?php echo esc_html( stripslashes( $group->name ) ); ?></option>
1487 <?php
1488 }
1489 ?>
1490 </select>
1491 <select class="ui dropdown" id="mainwp_top_quick_jump_page">
1492 <option value="" class="item"><?php esc_html_e( 'All Sites', 'mainwp' ); ?></option>
1493 <option <?php echo ( -1 === $s ) ? 'selected' : ''; ?> value="-1" class="item" ><?php esc_html_e( 'All Sites', 'mainwp' ); ?></option>
1494 <?php
1495 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
1496 ?>
1497 <option value="<?php echo intval( $website->id ); ?>" <?php echo ( $s === (int) $website->id ) ? 'selected' : ''; ?> class="item" ><?php echo esc_html( stripslashes( $website->name ) ); ?></option>
1498 <?php
1499 }
1500 ?>
1501 </select>
1502 </div>
1503 <script type="text/javascript">
1504 jQuery( document ).on( 'change', '#mainwp_top_quick_jump_group', function () {
1505 let jumpid = jQuery( this ).val();
1506 window.location = 'admin.php?page=managesites&g=' + jumpid;
1507 } );
1508 jQuery( document ).on( 'change', '#mainwp_top_quick_jump_page', function () {
1509 let jumpid = jQuery( this ).val();
1510 if ( jumpid == -1 )
1511 window.location = 'admin.php?page=managesites&s=' + jumpid;
1512 else
1513 window.location = 'admin.php?page=managesites&dashboard=' + jumpid;
1514 } );
1515 </script>
1516 <?php
1517 MainWP_DB::free_result( $websites );
1518 }
1519
1520 /**
1521 * Method render_header_actions()
1522 *
1523 * Render header action buttons,
1524 * (Sync|Add|Options|Community|User|Updates).
1525 *
1526 * @return mixed $output Render header action buttons html.
1527 *
1528 * @uses \MainWP\Dashboard\MainWP_DB::get_websites_count()
1529 */
1530 public static function render_header_actions() { // phpcs:ignore -- NOSONAR - complex method.
1531 $sites_count = MainWP_DB::instance()->get_websites_count();
1532 $sidebar_pages = array( 'ManageGroups', 'PostBulkManage', 'PostBulkAdd', 'PageBulkManage', 'PageBulkAdd', 'ThemesManage', 'ThemesInstall', 'ThemesAutoUpdate', 'PluginsManage', 'PluginsInstall', 'PluginsAutoUpdate', 'UserBulkManage', 'UserBulkAdd', 'UpdateAdminPasswords', 'Extensions' );
1533 $sidebar_pages = apply_filters( 'mainwp_sidbar_pages', $sidebar_pages ); // deprecated filter.
1534 $sidebar_pages = apply_filters( 'mainwp_sidebar_pages', $sidebar_pages );
1535 $current_user = get_current_user_id();
1536 $custom_theme = MainWP_Settings::get_instance()->get_current_user_theme();
1537 $screen = get_current_screen();
1538 $show_command_palette_trigger = wp_script_is( 'wp-core-commands', 'enqueued' );
1539 $command_palette_shortcut = '';
1540 $command_palette_label = '';
1541
1542 if ( $show_command_palette_trigger ) {
1543 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Used only to mirror WordPress core shortcut labels.
1544 $is_apple_os = (bool) preg_match( '/Macintosh|Mac OS X|Mac_PowerPC/i', $_SERVER['HTTP_USER_AGENT'] ?? '' );
1545
1546 $command_palette_shortcut = $is_apple_os
1547 ? _x( '⌘K', 'keyboard shortcut to open the command palette', 'mainwp' )
1548 : _x( 'Ctrl+K', 'keyboard shortcut to open the command palette', 'mainwp' );
1549
1550 /* translators: %s: Keyboard shortcut label. */
1551 $command_palette_label = sprintf( esc_attr__( 'Open command palette (%s)', 'mainwp' ), $command_palette_shortcut );
1552 }
1553
1554 if ( false === $custom_theme ) {
1555 $compat_theme = null;
1556 // to compatible with Custom Dashboard extension settings.
1557 $compat_settings = get_option( 'mainwp_custom_dashboard_settings' );
1558 if ( is_array( $compat_settings ) && isset( $compat_settings['theme'] ) ) {
1559 $compat_theme = $compat_settings['theme'];
1560 }
1561 if ( null !== $compat_theme ) {
1562 $custom_theme = $compat_theme;
1563 }
1564 }
1565 $themes_files = MainWP_Settings::get_instance()->get_custom_themes_files();
1566 if ( empty( $themes_files ) ) {
1567 $themes_files = array();
1568 }
1569
1570 // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1571 $page = isset( $_GET['page'] ) ? wp_unslash( $_GET['page'] ) : '';
1572 $id = 0;
1573 $website = null;
1574 if ( isset( $_GET['dashboard'] ) || ( isset( $_GET['id'] ) && 'CostTrackerAdd' !== $page ) || isset( $_GET['updateid'] ) || isset( $_GET['emailsettingsid'] ) || isset( $_GET['scanid'] ) ) {
1575 if ( isset( $_GET['dashboard'] ) ) {
1576 $id = intval( $_GET['dashboard'] );
1577 } elseif ( isset( $_GET['id'] ) ) {
1578 $id = intval( $_GET['id'] );
1579 } elseif ( isset( $_GET['updateid'] ) ) {
1580 $id = intval( $_GET['updateid'] );
1581 } elseif ( isset( $_GET['emailsettingsid'] ) ) {
1582 $id = intval( $_GET['emailsettingsid'] );
1583 } elseif ( isset( $_GET['scanid'] ) ) {
1584 $id = intval( $_GET['scanid'] );
1585 } elseif ( isset( $_GET['monitor_wpid'] ) ) {
1586 $id = intval( $_GET['monitor_wpid'] );
1587 }
1588 if ( $id ) {
1589 $website = MainWP_DB::instance()->get_website_by_id( $id );
1590 }
1591 }
1592 ob_start();
1593 if ( $show_command_palette_trigger ) :
1594 ?>
1595 <span id="mainwp-header-command-palette-actions" class="mainwp-768-hide">
1596 <a href="#" class="ui button hide-if-no-js" id="mainwp-command-palette-trigger" data-tooltip="<?php echo esc_attr( $command_palette_label ); ?>" data-inverted="" data-position="left center" aria-label="<?php echo esc_attr( $command_palette_label ); ?>" onclick='if ( window.wp && wp.data && wp.data.dispatch ) { wp.data.dispatch( "core/commands" ).open(); } return false;'>
1597 <kbd><?php echo esc_html( $command_palette_shortcut ); ?></kbd>
1598 </a>
1599 </span>
1600 <?php
1601 endif;
1602 if ( $website ) :
1603 ?>
1604 <?php if ( $id && $website && '' !== $website->sync_errors ) : ?>
1605 <a href="#" class="mainwp-updates-overview-reconnect-site ui green button" adminuser="<?php echo esc_attr( $website->adminname ); ?>" siteid="<?php echo intval( $website->id ); ?>" data-position="bottom right" aria-label="Reconnect <?php echo esc_html( stripslashes( $website->name ) ); ?>" data-tooltip="Reconnect <?php echo esc_html( stripslashes( $website->name ) ); ?>" data-inverted=""><i class="undo alternate icon"></i> <?php echo esc_html__( 'Reconnect', 'mainwp' ); ?></a>
1606 <?php
1607 else :
1608 $site_sync_info = MainWP_Utility::get_last_sync_info( $id );
1609 $site_sync_tooltip = '';
1610 $site_sync_outdated = false;
1611 $current_time = time();
1612 $twenty_four_h = 24 * HOUR_IN_SECONDS;
1613
1614 $site_name = stripslashes( $website->name );
1615 if ( ! empty( $site_sync_info['timestamp'] ) && ( $current_time - $site_sync_info['timestamp'] ) > $twenty_four_h ) {
1616 $site_sync_outdated = true;
1617 /* translators: 1: Site name. */
1618 $site_sync_tooltip = sprintf( esc_attr__( 'Data not synced for more than 24h. Click here to sync %1$s.', 'mainwp' ), $site_name );
1619 } elseif ( ! empty( $site_sync_info['formatted'] ) ) {
1620 /* translators: 1: Last sync date/time, 2: Site name. */
1621 $site_sync_tooltip = sprintf( esc_attr__( 'Last sync: %1$s. Click here to sync %2$s.', 'mainwp' ), $site_sync_info['formatted'], $site_name );
1622 } else {
1623 /* translators: 1: Site name. */
1624 $site_sync_tooltip = sprintf( esc_attr__( 'Get fresh data from %1$s.', 'mainwp' ), $site_name );
1625 }
1626 ?>
1627 <a class="ui green <?php echo 0 < $sites_count ? '' : 'disabled'; ?> button" id="mainwp-sync-sites" data-tooltip="<?php echo esc_attr( $site_sync_tooltip ); ?>" data-inverted="" data-position="left center" aria-label="<?php echo esc_attr( $site_sync_tooltip ); ?>" style="position: relative;">
1628 <?php if ( $site_sync_outdated ) : ?>
1629 <span class="ui red empty circular looping pulsating transition label" style="position: absolute; top: -4px; right: -4px;"></span>
1630 <?php endif; ?>
1631 <i class="sync alternate icon"></i> <span class="mainwp-768-hide"><?php echo esc_html__( 'Sync', 'mainwp' ); ?></span>
1632 </a>
1633 <?php endif; ?>
1634 <?php
1635 else :
1636 $el_id_syc_1 = 'mainwp-sync-sites';
1637 $sync_info = MainWP_Utility::get_last_sync_info();
1638 $sync_tooltip = '';
1639 $sync_outdated = false;
1640 $current_time = time();
1641 $twenty_four_h = 24 * HOUR_IN_SECONDS;
1642
1643 if ( ! empty( $sync_info['timestamp'] ) && ( $current_time - $sync_info['timestamp'] ) > $twenty_four_h ) {
1644 $sync_outdated = true;
1645 $sync_tooltip = esc_attr__( 'Data not synced for more than 24h. Click here to sync all sites.', 'mainwp' );
1646 } elseif ( ! empty( $sync_info['formatted'] ) ) {
1647 /* translators: 1: Last sync date/time. */
1648 $sync_tooltip = sprintf( esc_attr__( 'Last sync: %1$s. Click here to sync all sites.', 'mainwp' ), $sync_info['formatted'] );
1649 } else {
1650 $sync_tooltip = esc_attr__( 'Click here to sync all sites.', 'mainwp' );
1651 }
1652 ?>
1653 <a class="ui green <?php echo 0 < $sites_count ? '' : 'disabled'; ?> button" id="<?php echo esc_attr( $el_id_syc_1 ); ?>" data-tooltip="<?php echo esc_attr( $sync_tooltip ); ?>" data-inverted="" data-position="left center" aria-label="<?php echo esc_attr( $sync_tooltip ); ?>" style="position: relative;">
1654 <?php if ( $sync_outdated ) : ?>
1655 <span class="ui red empty circular looping pulsating transition label" style="position: absolute; top: -4px; right: -4px;"></span>
1656 <?php endif; ?>
1657 <i class="sync alternate icon"></i> <span class="mainwp-768-hide"><?php echo esc_html__( 'Sync', 'mainwp' ); ?></span>
1658 </a>
1659 <?php endif; ?>
1660
1661 <div class="ui top left pointing dropdown <?php echo empty( $sites_count ) ? 'green' : ''; ?> button" id="mainwp-add-new-buttons" aria-label="<?php esc_attr_e( 'Add new item to your MainWP Dashboard', 'mainwp' ); ?>">
1662 <i class="plus icon"></i> <?php echo esc_html__( 'Add', 'mainwp' ); ?>
1663 <div class="menu">
1664 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&do=new' ) ); ?>"><?php esc_html_e( 'Add Website', 'mainwp' ); ?></a>
1665 <?php if ( \mainwp_current_user_can( 'dashboard', 'manage_clients' ) ) { ?>
1666 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=ClientAddNew' ) ); ?>"><?php esc_html_e( 'Add Client', 'mainwp' ); ?></a>
1667 <?php } ?>
1668 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=CostTrackerAdd' ) ); ?>"><?php esc_html_e( 'Add Cost', 'mainwp' ); ?></a>
1669 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=PostBulkAdd' ) ); ?>"><?php esc_html_e( 'Create Post', 'mainwp' ); ?></a>
1670 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=PageBulkAdd' ) ); ?>"><?php esc_html_e( 'Create Page', 'mainwp' ); ?></a>
1671 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=PluginsInstall' ) ); ?>"><?php esc_html_e( 'Install Plugin', 'mainwp' ); ?></a>
1672 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=ThemesInstall' ) ); ?>"><?php esc_html_e( 'Install Theme', 'mainwp' ); ?></a>
1673 <a class="item" href="<?php echo esc_url( admin_url( 'admin.php?page=UserBulkAdd' ) ); ?>"><?php esc_html_e( ' Create User', 'mainwp' ); ?></a>
1674 </div>
1675 </div>
1676
1677 <?php if ( $screen && ( ( 'mainwp_tab' === $page ) || isset( $_GET['dashboard'] ) || ( ( 'ManageClients' === $page ) && isset( $_GET['client_id'] ) ) || ( 'CostSummary' === $page ) || ( 'InsightsOverview' === $page ) ) ) : ?>
1678 <span id="mainwp-header-layout-actions">
1679 <?php MainWP_Ui_Manage_Widgets_Layout::render_edit_layout( $screen->id ); ?>
1680 </span>
1681 <?php endif; ?>
1682
1683 <span id="mainwp-header-secondary-actions" class="mainwp-768-hide">
1684 <?php if ( ( 'mainwp_tab' === $page ) || isset( $_GET['dashboard'] ) || in_array( $page, $sidebar_pages ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended ?>
1685 <a id="mainwp-screen-options-button" class="ui icon button" onclick="jQuery( '#mainwp-overview-screen-options-modal' ).modal({allowMultiple:true}).modal( 'show' ); return false;" data-inverted="" data-position="bottom right" href="#" aria-label="<?php esc_attr_e( 'Page Settings', 'mainwp' ); ?>" data-tooltip="<?php esc_html_e( 'Page Settings', 'mainwp' ); ?>">
1686 <i class="cog icon"></i>
1687 </a>
1688
1689 <?php endif; ?>
1690 <?php
1691 // phpcs:enable
1692 /**
1693 * Filter: mainwp_header_actions_right
1694 *
1695 * Filters the MainWP header element actions.
1696 *
1697 * @since 4.0
1698 */
1699 $actions = apply_filters( 'mainwp_header_actions_right', '' );
1700 if ( ! empty( $actions ) ) {
1701 echo $actions; // phpcs:ignore WordPress.Security.EscapeOutput
1702 }
1703 ?>
1704 <a class="ui button icon" id="mainwp-sites-sidebar" aria-label="<?php esc_attr_e( 'Open sites shortcuts sidebar', 'mainwp' ); ?>">
1705 <i class="globe icon"></i>
1706 </a>
1707 <?php if ( 'default-dark' === $custom_theme && empty( $themes_files ) ) : ?>
1708 <a id="mainwp-select-light-theme-button" class="ui button icon" aria-label="<?php esc_attr_e( 'Select MainWP Light theme', 'mainwp' ); ?>" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_html_e( 'Switch to Light mode', 'mainwp' ); ?>">
1709 <i class="sun icon"></i>
1710 </a>
1711 <?php elseif ( 'default' === $custom_theme && empty( $themes_files ) ) : ?>
1712 <a id="mainwp-select-dark-theme-button" class="ui button icon" aria-label="<?php esc_attr_e( 'Select MainWP Dark theme', 'mainwp' ); ?>" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_html_e( 'Switch to Dark mode', 'mainwp' ); ?>">
1713 <i class="moon icon"></i>
1714 </a>
1715 <?php else : ?>
1716 <a id="mainwp-select-theme-button" class="ui button icon mainwp-selecte-theme-button" aria-label="<?php esc_attr_e( 'Select MainWP theme', 'mainwp' ); ?>" custom-theme="default" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_html_e( 'Select MainWP theme', 'mainwp' ); ?>">
1717 <i class="palette icon"></i>
1718 </a>
1719 <?php endif; ?>
1720 </span>
1721
1722 <?php
1723 /**
1724 * After select theme actions.
1725 *
1726 * @since 4.5.2
1727 */
1728 do_action( 'mainwp_header_actions_after_select_themes' );
1729 $show_avar = get_option( 'show_avatars' );
1730 ?>
1731 <div class="ui top right pointing dropdown <?php echo $show_avar ? '' : 'icon button'; ?> mainwp-768-hide" id="mainwp-user-menu-button">
1732 <?php
1733 if ( $show_avar ) {
1734 echo get_avatar(
1735 $current_user,
1736 38,
1737 'wavatar',
1738 esc_html__( 'Settings', 'mainwp' ),
1739 array(
1740 'extra_attr' => 'style="width:38px!important;height:38px!important;"',
1741 'class' => 'ui small avatar image',
1742 )
1743 );
1744 } else {
1745 ?>
1746 <i class="user icon"></i>
1747 <?php
1748 }
1749 ?>
1750 <div class="menu">
1751 <a class="item" id="mainwp-settings-menu-item" href="<?php echo esc_url( admin_url( 'admin.php?page=Settings' ) ); ?>">
1752 <i class="cog grey icon"></i> <?php esc_html_e( 'MainWP Settings', 'mainwp' ); ?>
1753 </a>
1754 <a class="item" id="mainwp-tools-menu-item" href="<?php echo esc_url( admin_url( 'admin.php?page=MainWPTools' ) ); ?>">
1755 <i class="tools grey icon"></i> <?php esc_html_e( 'MainWP Tools', 'mainwp' ); ?>
1756 </a>
1757 <a class="item" id="mainwp-system-info-menu-item" href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformation' ) ); ?>">
1758 <i class="circle grey info icon"></i> <?php esc_html_e( 'System Info', 'mainwp' ); ?>
1759 </a>
1760 <a class="item" id="mainwp-privacy-policy-menu-item" href="<?php echo esc_url( admin_url( 'admin.php?page=PluginPrivacy' ) ); ?>">
1761 <i class="file contract grey icon"></i> <?php esc_html_e( 'Privacy Policy', 'mainwp' ); ?>
1762 </a>
1763 <a id="mainwp-help-sidebar" class="item" href="#" target="_blank">
1764 <i class="life ring grey icon"></i> <?php esc_html_e( 'Get Help', 'mainwp' ); ?>
1765 </a>
1766 <div class="ui divider"></div>
1767 <a class="item" id="mainwp-wp-admin-menu-item" href="<?php echo esc_url( admin_url( 'index.php' ) ); ?>">
1768 <i class="wordpress grey icon"></i> <?php //phpcs:ignore -- ignore wordpress icon. ?> <?php esc_html_e( 'Go to WP Admin', 'mainwp' ); ?>
1769 </a>
1770 <?php $all_updates = wp_get_update_data(); ?>
1771 <?php if ( is_array( $all_updates ) && isset( $all_updates['counts']['total'] ) && 0 < $all_updates['counts']['total'] ) : ?>
1772 <a class="item" id="mainwp-available-updates-menu-item" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Your MainWP Dashboard sites needs your attention. Please check the available updates', 'mainwp' ); ?>" aria-label="<?php esc_attr_e( 'Your MainWP Dashboard sites needs your attention. Please check the available updates', 'mainwp' ); ?>" href="update-core.php">
1773 <i class="exclamation triangle red icon"></i> <?php esc_html_e( 'Update Dashboard Site', 'mainwp' ); ?>
1774 </a>
1775 <?php endif; ?>
1776 <div class="ui divider"></div>
1777 <a class="item" id="mainwp-community-button" href="https://community.mainwp.com/" target="_blank">
1778 <i class="discourse grey icon"></i> <?php esc_html_e( 'Managers Community', 'mainwp' ); ?>
1779 </a>
1780 <a class="item" id="mainwp-account-button" target="_blank" href="https://mainwp.com/my-account/"> <?php // NOSONAR - noopener - open safe. ?>
1781 <i class="user grey icon"></i> <?php esc_html_e( 'My MainWP Account', 'mainwp' ); ?>
1782 </a>
1783 <div class="ui divider"></div>
1784 <a class="item" id="mainwp-sign-out-button" href="<?php echo wp_logout_url(); // phpcs:ignore WordPress.Security.EscapeOutput ?>">
1785 <i class="sign out grey icon"></i> <?php esc_html_e( 'Log Out', 'mainwp' ); ?>
1786 </a>
1787 </div>
1788 </div>
1789 <a class="ui icon button" href="javascript:void(0)" id="mainwp-mobile-menu-trigger">
1790 <i class="bars icon"></i>
1791 </a>
1792 <?php $pulse = apply_filters( 'mainwp_screen_options_pulse_control', 1 ); ?>
1793 <input type="hidden" id="mainwp-screen-options-pulse-control" value="<?php echo esc_attr( $pulse ); ?>">
1794 <script>
1795 jQuery( document ).ready( function( $ ) {
1796 $( '#mainwp-user-menu-button' ).dropdown();
1797 } );
1798 </script>
1799 <?php
1800 return ob_get_clean();
1801 }
1802
1803 /**
1804 * Method render_page_navigation()
1805 *
1806 * Render page navigation.
1807 *
1808 * @param array $subitems [access, active, style, target, rel].
1809 * @param null $name_caller Menu Name.
1810 */
1811 public static function render_page_navigation( $subitems = array(), $name_caller = null ) { //phpcs:ignore -- NOSONAR - complex.
1812
1813 /**
1814 * Filter: mainwp_page_navigation
1815 *
1816 * Filters MainWP page navigation menu items.
1817 *
1818 * @since 4.0
1819 */
1820 $subitems = apply_filters( 'mainwp_page_navigation', $subitems, $name_caller );
1821 ?>
1822 <div id="mainwp-page-navigation-wrapper">
1823 <?php if ( isset( $_GET['dashboard'] ) || isset( $_GET['id'] ) || isset( $_GET['updateid'] ) || isset( $_GET['emailsettingsid'] ) || isset( $_GET['scanid'] ) || isset( $_GET['monitor_wpid'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification ?>
1824 <?php
1825 //phpcs:disable WordPress.Security.NonceVerification
1826 $id = 0;
1827 if ( isset( $_GET['dashboard'] ) ) {
1828 $id = intval( $_GET['dashboard'] );
1829 } elseif ( isset( $_GET['id'] ) ) {
1830 $id = intval( $_GET['id'] );
1831 } elseif ( isset( $_GET['updateid'] ) ) {
1832 $id = intval( $_GET['updateid'] );
1833 } elseif ( isset( $_GET['emailsettingsid'] ) ) {
1834 $id = intval( $_GET['emailsettingsid'] );
1835 } elseif ( isset( $_GET['scanid'] ) ) {
1836 $id = intval( $_GET['scanid'] );
1837 } elseif ( isset( $_GET['monitor_wpid'] ) ) {
1838 $id = intval( $_GET['monitor_wpid'] );
1839 }
1840 // phpcs:enable
1841 $website = MainWP_DB::instance()->get_website_by_id( $id );
1842
1843 // To avoid error in case of direct access to page with wrong id.
1844 if ( ! empty( $website ) && ! empty( $website->url ) ) {
1845 $overview_mshot = static::get_mshots_image_sources( $website->url, 170 );
1846 ?>
1847 <img alt="<?php esc_attr_e( 'Website preview', 'mainwp' ); ?>" src="<?php echo esc_url( $overview_mshot['src'] ); ?>" data-mainwp-mshot-src="<?php echo esc_url( $overview_mshot['src'] ); ?>" data-mainwp-mshot-requeue-src="<?php echo esc_url( $overview_mshot['requeue_src'] ); ?>" id="mainwp-site-preview-image">
1848 <?php
1849 }
1850 ?>
1851 <?php endif; ?>
1852 <div class="ui vertical menu mainwp-page-navigation">
1853
1854 <?php
1855
1856 if ( is_array( $subitems ) ) {
1857 foreach ( $subitems as $item ) {
1858
1859 if ( ! is_array( $item ) ) {
1860 continue;
1861 }
1862
1863 if ( isset( $item['access'] ) && ! $item['access'] ) {
1864 continue;
1865 }
1866
1867 $class = '';
1868 if ( isset( $item['active'] ) && $item['active'] ) {
1869 $class = 'active';
1870 }
1871
1872 if ( isset( $item['class'] ) ) {
1873 $class = $class . ' ' . $item['class'];
1874 }
1875
1876 $style = '';
1877 if ( isset( $item['style'] ) ) {
1878 $style = $item['style'];
1879 }
1880
1881 $target = '';
1882 if ( isset( $item['target'] ) ) {
1883 $target = $item['target'];
1884 }
1885
1886 $rel = '';
1887 if ( isset( $item['rel'] ) ) {
1888 $rel = $item['rel'];
1889 } elseif ( '_blank' === $target ) {
1890 $rel = 'noopener noreferrer';
1891 }
1892
1893 ?>
1894 <a class="<?php echo esc_attr( $class ); ?> item" style="<?php echo esc_attr( $style ); ?>" href="<?php echo esc_url( $item['href'] ); ?>" <?php if ( ! empty( $target ) ) : ?>target="<?php echo esc_attr( $target ); ?>"<?php endif; ?> <?php if ( ! empty( $rel ) ) : ?>rel="<?php echo esc_attr( $rel ); ?>"<?php endif; ?>>
1895 <?php echo isset( $item['before_title'] ) ? $item['before_title'] : ''; ?> <?php echo esc_html( $item['title'] ); ?> <?php echo isset( $item['after_title'] ) ? $item['after_title'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput ?>
1896 </a>
1897 <?php
1898 }
1899 }
1900
1901 do_action( 'mainwp_page_navigation_menu' );
1902 ?>
1903 </div>
1904
1905 </div>
1906 <?php
1907 $is_site = MainWP_System::is_mainwp_site_page();
1908 if ( $is_site ) {
1909 echo '<div id="mainwp-site-mode-wrap">';
1910 }
1911 }
1912
1913 /**
1914 * Method render_header()
1915 *
1916 * Render page title.
1917 *
1918 * @param string $title Page title.
1919 *
1920 * @return void Render page title and hidden divider html.
1921 */
1922 public static function render_header( $title = '' ) {
1923 static::render_top_header( array( 'title' => $title ) );
1924 echo '<div class="ui hidden clearing fitted divider"></div>';
1925 echo '<div class="wrap">';
1926 }
1927
1928 /**
1929 * Method render_footer()
1930 *
1931 * Render page footer.
1932 *
1933 * @return void Render closing tags for page container.
1934 */
1935 public static function render_footer() {
1936 $is_site = MainWP_System::is_mainwp_site_page();
1937 if ( $is_site ) {
1938 echo '</div>';
1939 }
1940 echo '</div>';
1941 echo '</div>';
1942 }
1943
1944 /**
1945 * Method add_widget_box()
1946 *
1947 * Customize WordPress add_meta_box() function.
1948 *
1949 * @param mixed $id Widget ID parameter.
1950 * @param mixed $callback Callback function.
1951 * @param null $screen Current page.
1952 * @param array $layout widget layout.
1953 *
1954 * @uses \MainWP\Dashboard\MainWP_System_Utility::get_page_id()
1955 */
1956 public static function add_widget_box( $id, $callback, $screen = null, $layout = array() ) {
1957 /**
1958 * MainWP widget boxes array.
1959 *
1960 * @global object
1961 */
1962 global $mainwp_widget_boxes;
1963
1964 $page = MainWP_System_Utility::get_page_id( $screen );
1965
1966 if ( empty( $page ) ) {
1967 return;
1968 }
1969
1970 if ( ! isset( $mainwp_widget_boxes ) ) {
1971 $mainwp_widget_boxes = array();
1972 }
1973 if ( ! isset( $mainwp_widget_boxes[ $page ] ) ) {
1974 $mainwp_widget_boxes[ $page ] = array();
1975 }
1976
1977 $mainwp_widget_boxes[ $page ][ $id ] = array(
1978 'id' => $id,
1979 'callback' => $callback,
1980 'layout' => $layout,
1981 );
1982 }
1983
1984 /**
1985 * Method do_widget_boxes()
1986 *
1987 * Customize WordPress do_meta_boxes() function.
1988 *
1989 * @param mixed $screen_id Current page ID.
1990 * @param array ...$args Widget callback args.
1991 *
1992 * @return void Renders widget container box.
1993 *
1994 * @uses \MainWP\Dashboard\MainWP_System_Utility::get_page_id()
1995 */
1996 public static function do_widget_boxes( $screen_id, ...$args ) { // phpcs:ignore -- NOSONAR - complex.
1997 global $mainwp_widget_boxes;
1998 $page = MainWP_System_Utility::get_page_id( $screen_id );
1999 if ( empty( $page ) ) {
2000 return;
2001 }
2002
2003 $page_widget = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
2004
2005 $wgsorted = false;
2006 $selected_widget_layout = '';
2007
2008 if ( ! empty( $_GET['page'] ) && ! empty( $_GET['select_layout'] ) && ! empty( $_GET['_opennonce'] ) && wp_verify_nonce( sanitize_key( $_GET['_opennonce'] ), 'mainwp-admin-nonce' ) && ! empty( $_GET['updated'] ) && ! empty( $_GET['screen_slug'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
2009 $layid = sanitize_text_field( wp_unslash( $_GET['updated'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
2010 $screen_slug = sanitize_text_field( wp_unslash( $_GET['screen_slug'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
2011
2012 $saved_layouts = MainWP_Ui_Manage_Widgets_Layout::set_get_widgets_layout( false, array(), $screen_slug );
2013 $selected_layout = is_array( $saved_layouts ) && isset( $saved_layouts[ $layid ] ) ? $saved_layouts[ $layid ] : array();
2014 if ( is_array( $selected_layout ) && isset( $selected_layout['layout'] ) ) {
2015 $wgsorted = $selected_layout['layout'];
2016 if ( isset( $selected_layout['name'] ) ) {
2017 $selected_widget_layout = $selected_layout['name'];
2018 }
2019 }
2020 }
2021
2022 if ( empty( $wgsorted ) ) {
2023 $wgsorted = get_user_option( 'mainwp_widgets_sorted_' . $page );
2024 }
2025
2026 if ( ! empty( $wgsorted ) && is_string( $wgsorted ) ) {
2027 $wgsorted = json_decode( $wgsorted, true );
2028 }
2029
2030 if ( ! is_array( $wgsorted ) ) {
2031 $wgsorted = array();
2032 }
2033
2034 $client_id = 0;
2035 if ( 'mainwp_page_manageclients' === $page ) {
2036 $sorted_array = is_array( $wgsorted ) ? $wgsorted : array();
2037 $wgsorted = array();
2038 $client_id = isset( $_GET['client_id'] ) ? intval( $_GET['client_id'] ) : 0; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
2039 if ( ! empty( $client_id ) && is_array( $sorted_array ) && isset( $sorted_array[ $client_id ] ) ) {
2040 $wgsorted = $sorted_array[ $client_id ];
2041 }
2042 }
2043
2044 $wgsorted = apply_filters( 'mainwp_do_widget_boxes_sorted', $wgsorted, $page, $client_id );
2045
2046 if ( 'mainwp_page_manageclients' === $page ) {
2047 $show_widgets = get_user_option( 'mainwp_clients_show_widgets' );
2048 } elseif ( 'toplevel_page_mainwp_tab' === $page || 'mainwp_page_managesites' === $page ) {
2049 $show_widgets = get_user_option( 'mainwp_settings_show_widgets' );
2050 } else {
2051 $show_widgets = apply_filters( 'mainwp_widget_boxes_show_widgets', array(), $page );
2052 }
2053
2054 if ( ! is_array( $show_widgets ) ) {
2055 $show_widgets = array();
2056 }
2057
2058 if ( $selected_widget_layout ) {
2059 // to support saving selected layout.
2060 ?>
2061 <input type="hidden" id="mainwp-widgets-selected-layout" layout-name="<?php echo esc_attr( $selected_layout['name'] ); ?>" layout-idx="<?php echo esc_attr( $layid ); ?>" data-save-on-load="true" >
2062 <?php
2063 }
2064 ?>
2065 <div id="mainwp-grid-stack-wrapper" class="grid-stack">
2066 <?php
2067 if ( isset( $mainwp_widget_boxes[ $page ] ) ) {
2068 foreach ( (array) $mainwp_widget_boxes[ $page ] as $box ) {
2069 if ( false === $box || ! isset( $box['callback'] ) ) {
2070 continue;
2071 }
2072
2073 // to avoid hidden widgets.
2074 if ( isset( $show_widgets[ $box['id'] ] ) && 0 === (int) $show_widgets[ $box['id'] ] ) {
2075 continue;
2076 }
2077
2078 $layout = array();
2079 if ( isset( $wgsorted[ $box['id'] ] ) ) {
2080 $val = $wgsorted[ $box['id'] ];
2081 if ( is_array( $val ) && ( isset( $val['x'] ) || isset( $val['w'] ) ) ) {
2082 $layout = array(
2083 'x' => $val['x'],
2084 'y' => $val['y'],
2085 'w' => $val['w'],
2086 'h' => $val['h'],
2087 );
2088 }
2089 }
2090
2091 // init widget layout settings.
2092 if ( ! isset( $layout['x'] ) && ! isset( $layout['w'] ) && isset( $box['layout']['2'] ) ) {
2093 $layout = array(
2094 'x' => $box['layout']['0'],
2095 'y' => $box['layout']['1'],
2096 'w' => $box['layout']['2'],
2097 'h' => $box['layout']['3'],
2098 );
2099 }
2100
2101 $layout_attrs_escaped = '';
2102 if ( isset( $layout['x'] ) && (int) $layout['x'] >= 0 ) {
2103 $layout_attrs_escaped .= ' gs-x="' . esc_attr( $layout['x'] ) . '"';
2104 }
2105 if ( isset( $layout['y'] ) && (int) $layout['y'] >= 0 ) {
2106 $layout_attrs_escaped .= ' gs-y="' . esc_attr( $layout['y'] ) . '"';
2107 }
2108 if ( isset( $layout['w'] ) && (int) $layout['w'] > 0 ) {
2109 $layout_attrs_escaped .= ' gs-w="' . esc_attr( $layout['w'] ) . '"';
2110 }
2111 if ( isset( $layout['h'] ) && (int) $layout['h'] > 0 ) {
2112 $layout_attrs_escaped .= ' gs-h="' . esc_attr( $layout['h'] ) . '"';
2113 }
2114
2115 echo '<div id="widget-' . esc_html( $box['id'] ) . '" class="grid-stack-item" ' . $layout_attrs_escaped . '>' . "\n"; //phpcs:ignore -- escaped.
2116 echo '<div class="grid-stack-item-content ui segment mainwp-widget">' . "\n";
2117 call_user_func( $box['callback'], $screen_id, $args );
2118 echo "</div>\n";
2119 echo "</div>\n";
2120
2121 }
2122 }
2123 ?>
2124 </div>
2125 <script type="text/javascript">
2126 let page_sortablewidgets = '<?php echo esc_js( $page ); ?>';
2127 let page_widget = '<?php echo esc_js( $page_widget ); ?>';
2128 jQuery( document ).ready( function( $ ) {
2129 let wgIds = [];
2130 jQuery( ".mainwp-widget" ).each( function () {
2131 wgIds.push( jQuery( this ).attr('id') );
2132 } );
2133 let gsOpts = {
2134 auto: true,
2135 cellHeight: '1rem',
2136 float: false,
2137 resizable: {
2138 handles: 'e,se,s,sw,w'
2139 },
2140 margin: '1rem',
2141 itemClass: 'grid-stack-item',
2142 handleClass: 'handle-drag',
2143 columnOpts: {
2144 breakpointForWindow: true, // test window vs grid size
2145 breakpoints: [{w:768, c:1}],
2146 },
2147 }
2148 let grid = GridStack.init(gsOpts);
2149
2150 grid.on('change', function() {
2151 mainwp_overview_gridstack_save_layout(<?php echo (int) $client_id; ?>, grid);
2152 });
2153
2154 if (jQuery('#mainwp-widgets-selected-layout[data-save-on-load="true"]').length) {
2155 mainwp_overview_gridstack_save_layout(<?php echo (int) $client_id; ?>, grid);
2156 }
2157
2158 jQuery('#mainwp-widgets-placeholder').dimmer('hide');
2159 });
2160 </script>
2161 <?php
2162 }
2163
2164 /**
2165 * Method add_bulkpost_widget_box()
2166 *
2167 * @param mixed $boxid box id.
2168 * @param mixed $params parameters.
2169 */
2170 public static function add_bulkpost_widget_box( $boxid, $params ) {
2171 /**
2172 * MainWP widget boxes array.
2173 *
2174 * @global object
2175 */
2176 global $wp_meta_boxes;
2177
2178 $screen_page_id = MainWP_System_Utility::get_page_id();
2179
2180 if ( empty( $screen_page_id ) ) {
2181 return;
2182 }
2183
2184 if ( ! is_array( $params ) ) {
2185 $params = array();
2186 }
2187
2188 if ( ! isset( $wp_meta_boxes ) ) {
2189 $wp_meta_boxes = array(); //phpcs:ignore -- NOSONAR - ok.
2190 }
2191
2192 $page = MainWP_Post::get_fix_metabox_page( $screen_page_id );
2193
2194 if ( ! isset( $wp_meta_boxes[ $page ] ) ) {
2195 $wp_meta_boxes[ $page ] = array(); //phpcs:ignore -- NOSONAR - ok.
2196 }
2197
2198 $context = ! empty( $params['context'] ) ? $params['context'] : 'normal';
2199 $priority = ! empty( $params['priority'] ) ? $params['priority'] : 'default';
2200
2201 if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
2202 $wp_meta_boxes[ $page ][ $context ] = array(); //phpcs:ignore -- NOSONAR - ok.
2203 }
2204
2205 if ( ! isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
2206 $wp_meta_boxes[ $page ][ $context ][ $priority ] = array(); //phpcs:ignore -- NOSONAR - ok.
2207 }
2208
2209 if ( ! empty( $params['id'] ) ) {
2210 $params['id'] = 'bulkpost-metabox-' . $params['id'];
2211 } else {
2212 $params['id'] = '';
2213 }
2214
2215 if ( empty( $params['metabox-custom'] ) ) {
2216 $params['metabox-custom'] = 'bulkpost';
2217 }
2218 $wp_meta_boxes[ $page ][ $context ][ $priority ][ $boxid ] = $params; //phpcs:ignore -- NOSONAR - ok.
2219 }
2220
2221 /**
2222 * Method render_empty_bulk_actions()
2223 *
2224 * Render empty bulk actions when drop down is disabled.
2225 */
2226 public static function render_empty_bulk_actions() {
2227 ?>
2228 <select class="ui disabled dropdown" id="mainwp-bulk-actions">
2229 <option value=""><?php esc_html_e( 'Bulk Actions', 'mainwp' ); ?></option>
2230 </select>
2231 <button class="ui tiny basic disabled button" href="javascript:void(0)" ><?php esc_html_e( 'Apply', 'mainwp' ); ?></button>
2232 <?php
2233 }
2234
2235 /**
2236 * Method render_modal_install_plugin_theme()
2237 *
2238 * Render modal window for installing plugins & themes.
2239 *
2240 * @param string $what Which window to render, plugin|theme.
2241 */
2242 public static function render_modal_install_plugin_theme( $what = 'plugin' ) {
2243 ?>
2244 <div id="plugintheme-installation-progress-modal" class="ui modal">
2245 <i class="close icon"></i>
2246 <div class="header">
2247 <?php
2248 if ( 'plugin' === $what ) {
2249 esc_html_e( 'Plugin Installation', 'mainwp' );
2250 } elseif ( 'theme' === $what ) {
2251 esc_html_e( 'Theme Installation', 'mainwp' );
2252 }
2253 ?>
2254 </div>
2255 <div class="ui green progress mainwp-modal-progress">
2256 <div class="bar"><div class="progress"></div></div>
2257 <div class="label"></div>
2258 </div>
2259 <div class="scrolling content">
2260 <?php
2261 /**
2262 * Action: mainwp_before_plugin_theme_install_progress
2263 *
2264 * Fires before the progress list in the install modal element.
2265 *
2266 * @since 4.1
2267 */
2268 do_action( 'mainwp_before_plugin_theme_install_progress' );
2269 ?>
2270 <div id="plugintheme-installation-queue"></div>
2271 <?php
2272 /**
2273 * Action: mainwp_after_plugin_theme_install_progress
2274 *
2275 * Fires after the progress list in the install modal element.
2276 *
2277 * @since 4.1
2278 */
2279 do_action( 'mainwp_after_plugin_theme_install_progress' );
2280 ?>
2281 </div>
2282 <div class="actions" item-type="<?php echo esc_attr( $what ); ?>">
2283 <?php
2284 /**
2285 * Action: mainwp_after_plugin_theme_install_progress
2286 *
2287 * Fires after the progress list in the install modal element.
2288 *
2289 * @since 4.1
2290 */
2291 do_action( 'mainwp_install_plugin_theme_modal_action', $what );
2292 ?>
2293
2294 </div>
2295 </div>
2296 <?php
2297 }
2298
2299 /**
2300 * Method render_modal_upload_icon()
2301 *
2302 * Render modal window for upload plugins & themes icon.
2303 */
2304 public static function render_modal_upload_icon() {
2305
2306 ?>
2307 <div id="mainwp-upload-custom-icon-modal" class="ui modal">
2308 <i class="close icon"></i>
2309 <div class="header">
2310 <?php
2311 esc_html_e( 'Upload Icon', 'mainwp' );
2312 ?>
2313 </div>
2314 <div class="content" id="mainwp-upload-custom-icon-content">
2315 <form action="" method="post" enctype="multipart/form-data" name="uploadicon_form" id="uploadicon_form" class="">
2316 <?php self::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
2317 <div class="ui message" id="mainwp-message-zone-upload" style="display:none;"></div>
2318 <?php
2319 /**
2320 * Action: mainwp_after_upload_custom_icon
2321 *
2322 * Fires before the modal element.
2323 *
2324 * @since 4.3
2325 */
2326 do_action( 'mainwp_before_upload_custom_icon' );
2327 ?>
2328 <div class="ui form">
2329 <div class="ui grid field">
2330 <label class="six wide column middle aligned"><?php esc_html_e( 'Custom icon', 'mainwp' ); ?></label>
2331 <div class="six wide column" data-tooltip="<?php esc_attr_e( 'Upload a custom icon.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
2332 <div class="ui file input">
2333 <input type="file" id="mainwp_upload_icon_uploader" name="mainwp_upload_icon_uploader[]" accept="image/*" data-inverted="" data-tooltip="<?php esc_attr_e( 'Upload a custom icon.', 'mainwp' ); ?>" />
2334 </div>
2335 </div>
2336 </div>
2337 <div class="ui grid field" id="mainwp_delete_image_field">
2338 <label class="six wide column middle aligned"></label>
2339 <div class="six wide column">
2340 <img class="ui tiny image" src="" alt="<?php esc_attr_e( 'Icon to remove.', 'mainwp' ); ?>"/><br/>
2341 <div class="ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, delete image.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
2342 <input type="checkbox"id="mainwp_delete_image_chk" item-icon-id="" />
2343 <label for="mainwp_delete_image_chk"><?php esc_html_e( 'Delete Image', 'mainwp' ); ?></label>
2344 </div>
2345 </div>
2346 </div>
2347 </div>
2348 <?php
2349 /**
2350 * Action: mainwp_after_upload_custom_icon
2351 *
2352 * Fires after the modal element.
2353 *
2354 * @since 4.3
2355 */
2356 do_action( 'mainwp_after_upload_custom_icon' );
2357 ?>
2358 </form>
2359 </div>
2360 <div class="actions">
2361 <div class="ui green button" uploading-icon="default" id="update_custom_icon_btn"><?php esc_html_e( 'Update', 'mainwp' ); ?></div>
2362 </div>
2363 </div>
2364 <?php
2365 }
2366
2367 /**
2368 * Method render_show_all_updates_button()
2369 *
2370 * Render show all updates button.
2371 *
2372 * @return void Render Show All Updates button html.
2373 */
2374 public static function render_show_all_updates_button() {
2375 ?>
2376 <a href="javascript:void(0)" class="ui mini button trigger-all-accordion mainwp-show-all-updates-button">
2377 <?php
2378 /**
2379 * Filter: mainwp_show_all_updates_button_text
2380 *
2381 * Filters the Show All Updates button text.
2382 *
2383 * @since 4.1
2384 */
2385 echo esc_html( apply_filters( 'mainwp_show_all_updates_button_text', esc_html__( 'Show All Updates', 'mainwp' ) ) );
2386 ?>
2387 </a>
2388 <?php
2389 }
2390
2391 /**
2392 * Method render_sorting_icons()
2393 *
2394 * Render sorting up & down icons.
2395 *
2396 * @return void Render Sort up & down incon html.
2397 */
2398 public static function render_sorting_icons() {
2399 ?>
2400 <i class="sort icon"></i><i class="sort up icon"></i><i class="sort down icon"></i>
2401 <?php
2402 }
2403
2404 /**
2405 * Method render_modal_edit_notes()
2406 *
2407 * Render modal window for edit notes.
2408 *
2409 * @param string $what What modal window to render. Default = site.
2410 *
2411 * @return void
2412 */
2413 public static function render_modal_edit_notes( $what = 'site' ) {
2414 ?>
2415 <div id="mainwp-notes-modal" class="ui modal">
2416 <i class="close icon" id="mainwp-notes-cancel"></i>
2417 <div class="header"><?php esc_html_e( 'Notes', 'mainwp' ); ?></div>
2418 <div class="content" id="mainwp-notes-content">
2419 <div id="mainwp-notes-status" class="ui message hidden"></div>
2420 <?php
2421 /**
2422 * Action: mainwp_before_edit_site_note
2423 *
2424 * Fires before the site note content in the Edit Note modal element.
2425 *
2426 * @since 4.1
2427 */
2428 do_action( 'mainwp_before_edit_site_note' );
2429 ?>
2430 <div id="mainwp-notes-html"></div>
2431 <div id="mainwp-notes-editor" class="ui form" style="display:none;">
2432 <div class="field">
2433 <label><?php esc_html_e( 'Edit note', 'mainwp' ); ?></label>
2434 <textarea id="mainwp-notes-note"></textarea>
2435 </div>
2436 <div><?php esc_html_e( 'Allowed HTML tags:', 'mainwp' ); ?> &lt;p&gt;, &lt;strong&gt;, &lt;em&gt;, &lt;br&gt;, &lt;hr&gt;, &lt;a&gt;, &lt;ul&gt;, &lt;ol&gt;, &lt;li&gt;, &lt;h1&gt;, &lt;h2&gt; </div>
2437 </div>
2438 <?php
2439 /**
2440 * Action: mainwp_after_edit_site_note
2441 *
2442 * Fires after the site note content in the Edit Note modal element.
2443 *
2444 * @since 4.1
2445 */
2446 do_action( 'mainwp_after_edit_site_note' );
2447 ?>
2448 </div>
2449 <div class="actions">
2450 <div class="ui grid">
2451 <div class="eight wide left aligned middle aligned column">
2452 <input type="button" class="ui green button" id="mainwp-notes-save" value="<?php esc_attr_e( 'Save Note', 'mainwp' ); ?>" style="display:none;"/>
2453 <input type="button" class="ui green button" id="mainwp-notes-edit" value="<?php esc_attr_e( 'Edit Note', 'mainwp' ); ?>"/>
2454 </div>
2455 <div class="eight wide column">
2456 <input type="hidden" id="mainwp-notes-websiteid" value=""/>
2457 <input type="hidden" id="mainwp-notes-slug" value=""/>
2458 <input type="hidden" id="mainwp-which-note" value="<?php echo esc_html( $what ); ?>"/>
2459 <input type="hidden" id="mainwp-notes-itemid" value=""/>
2460 </div>
2461 </div>
2462 </div>
2463 </div>
2464 <?php
2465 }
2466
2467 /**
2468 * No Sites Modal
2469 *
2470 * Renders modal window for notification when there are no connected sites.
2471 *
2472 * @return void
2473 */
2474 public static function render_modal_no_sites_note() {
2475 if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-no-sites-modal-notice' ) ) :
2476 ?>
2477 <div id="mainwp-no-sites-modal" class="ui small modal">
2478 <div class="content" id="mainwp-no-sites-modal-content" style="text-align:center">
2479 <div class="ui hidden divider"></div>
2480 <div class="ui hidden divider"></div>
2481 <h4><?php esc_html_e( 'Hi MainWP Manager, there is not anything to see here before connecting your first site.', 'mainwp' ); ?></h4>
2482 <div class="ui hidden divider"></div>
2483 <div class="ui hidden divider"></div>
2484 <a href="admin.php?page=managesites&do=new" class="ui big green button"><?php esc_html_e( 'Connect Your WordPress Site', 'mainwp' ); ?></a>
2485 <div class="ui hidden fitted divider"></div>
2486 <small><?php /* translators: 1: Opening anchor tag for bulk import link, 2: Closing anchor tag. */ printf( esc_html__( 'or you can %1$sbulk import%2$s your sites.', 'mainwp' ), '<a href="admin.php?page=managesites&do=bulknew">', '</a>' ); ?></small>
2487 </div>
2488 <div class="actions">
2489 <div class="ui grid">
2490 <div class="eight wide left aligned middle aligned column">
2491 <a href="https://docs.mainwp.com/getting-started/get-started-with-mainwp" class="ui basic green mini button" target="_blank"><?php esc_html_e( 'See How to Connect Sites', 'mainwp' ); // NOSONAR - noopener - open safe. ?></a>
2492 </div>
2493 <div class="eight wide column">
2494 <input type="button" class="ui mini basic cancel button mainwp-notice-dismiss" notice-id="mainwp-no-sites-modal-notice" value="<?php esc_attr_e( 'Let Me Look Around', 'mainwp' ); ?>"/>
2495 </div>
2496 </div>
2497 </div>
2498 </div>
2499 <script type="text/javascript">
2500 jQuery( '#mainwp-no-sites-modal' ).modal( {
2501 blurring: true,
2502 inverted: true,
2503 closable: false
2504 } ).modal( 'show' );
2505 </script>
2506 <?php
2507 endif;
2508 }
2509
2510 /**
2511 * Help Modal
2512 *
2513 * Renders the help modal.
2514 *
2515 * @return void
2516 */
2517 public static function render_help_modal() { //phpcs:ignore -- NOSONAR - complex.
2518 $siteViewMode = MainWP_Utility::get_siteview_mode();
2519
2520 // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized.Recommended
2521 $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
2522
2523 $tour_id = '';
2524 $video_id = '';
2525 if ( 'mainwp_tab' === $page ) {
2526 $tour_id = '13112';
2527 $video_id = 'VZeUhuihddw';
2528 } elseif ( 'managesites' === $page ) {
2529 if ( isset( $_GET['do'] ) && 'new' === $_GET['do'] ) {
2530 $tour_id = '13210';
2531 $video_id = 'k1-4x6h0LfE';
2532 } elseif ( isset( $_GET['do'] ) && 'bulknew' === $_GET['do'] ) {
2533 $tour_id = '60206';
2534 } elseif ( ! isset( $_GET['dashboard'] ) && ! isset( $_GET['id'] ) && ! isset( $_GET['updateid'] ) && ! isset( $_GET['emailsettingsid'] ) && ! isset( $_GET['scanid'] ) ) {
2535 if ( 'grid' === $siteViewMode ) {
2536 $tour_id = '27217';
2537 } else {
2538 $tour_id = '29331';
2539 }
2540 }
2541 } elseif ( 'MonitoringSites' === $page ) {
2542 $tour_id = '29003';
2543 } elseif ( 'ManageClients' === $page ) {
2544 if ( isset( $_GET['client_id'] ) ) {
2545 $tour_id = '28258';
2546 } else {
2547 $tour_id = '28240';
2548 }
2549 } elseif ( 'ClientAddNew' === $page ) {
2550 if ( isset( $_GET['client_id'] ) ) {
2551 $tour_id = '28962';
2552 } else {
2553 $tour_id = '28256';
2554 }
2555 $video_id = '8Th7bSZAHjw';
2556 } elseif ( 'ClientAddField' === $page ) {
2557 $tour_id = '28257';
2558 } elseif ( 'PluginsManage' === $page ) {
2559 $tour_id = '28510';
2560 $video_id = 'p0pB7mXoIYw';
2561 } elseif ( 'ManageGroups' === $page ) {
2562 $tour_id = '27275';
2563 } elseif ( 'UpdatesManage' === $page ) {
2564 $video_id = 'igOn8wOBcAQ';
2565 $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
2566 if ( 'plugins-updates' === $tab ) {
2567 $tour_id = '28259';
2568 } elseif ( 'themes-updates' === $tab ) {
2569 $tour_id = '28447';
2570 } elseif ( 'wordpress-updates' === $tab ) {
2571 $tour_id = '29005';
2572 } elseif ( 'translations-updates' === $tab ) {
2573 $tour_id = '29007';
2574 } elseif ( 'abandoned-plugins' === $tab ) {
2575 $tour_id = '29008';
2576 } elseif ( 'abandoned-themes' === $tab ) {
2577 $tour_id = '29009';
2578 } elseif ( 'plugin-db-updates' === $tab ) {
2579 $tour_id = '33161';
2580 } else {
2581 $tour_id = '28259';
2582 }
2583 } elseif ( 'PluginsInstall' === $page ) {
2584 $tour_id = '29011';
2585 } elseif ( 'PluginsAutoUpdate' === $page ) {
2586 $tour_id = '29015';
2587 } elseif ( 'PluginsIgnore' === $page ) {
2588 $tour_id = '29018';
2589 } elseif ( 'PluginsIgnoredAbandoned' === $page ) {
2590 $tour_id = '29329';
2591 } elseif ( 'ThemesManage' === $page ) {
2592 $tour_id = '28511';
2593 $video_id = 'fWYBTWNL9gw';
2594 } elseif ( 'ThemesInstall' === $page ) {
2595 $tour_id = '29010';
2596 } elseif ( 'ThemesAutoUpdate' === $page ) {
2597 $tour_id = '29016';
2598 } elseif ( 'ThemesIgnore' === $page ) {
2599 $tour_id = '29019';
2600 } elseif ( 'ThemesIgnoredAbandoned' === $page ) {
2601 $tour_id = '29330';
2602 } elseif ( 'UserBulkManage' === $page ) {
2603 $tour_id = '28574';
2604 $video_id = 'lvzpE04nsTs';
2605 } elseif ( 'UserBulkAdd' === $page ) {
2606 $tour_id = '28575';
2607 } elseif ( 'BulkImportUsers' === $page ) {
2608 $tour_id = '28736';
2609 } elseif ( 'UpdateAdminPasswords' === $page ) {
2610 $tour_id = '28737';
2611 } elseif ( 'PostBulkManage' === $page ) {
2612 $tour_id = '28796';
2613 $video_id = 'Z81gzO16K8o';
2614 } elseif ( 'PostBulkAdd' === $page ) {
2615 $tour_id = '28799';
2616 } elseif ( 'PageBulkManage' === $page ) {
2617 $tour_id = '29045';
2618 $video_id = 'O4jG-GRHE2Q';
2619 } elseif ( 'PageBulkAdd' === $page ) {
2620 $tour_id = '29048';
2621 } elseif ( 'Extensions' === $page ) {
2622 $tour_id = '28800';
2623 $video_id = 'FMkXqpRu6-E';
2624 } elseif ( 'Settings' === $page ) {
2625 $tour_id = '28883';
2626 } elseif ( 'SettingsAdvanced' === $page ) {
2627 $tour_id = '28886';
2628 } elseif ( 'SettingsEmail' === $page ) {
2629 $tour_id = '29054';
2630 } elseif ( 'MainWPTools' === $page ) {
2631 $tour_id = '29272';
2632 } elseif ( 'RESTAPI' === $page ) {
2633 $tour_id = '29273';
2634 $video_id = 'BO-u1FlptY0';
2635 } elseif ( 'ServerInformation' === $page ) {
2636 $tour_id = '28873';
2637 } elseif ( 'ServerInformationCron' === $page ) {
2638 $tour_id = '28874';
2639 } elseif ( 'ErrorLog' === $page ) {
2640 $tour_id = '28876';
2641 } elseif ( 'ActionLogs' === $page ) {
2642 $tour_id = '28877';
2643 } elseif ( 'ManageCostTracker' === $page ) {
2644 $video_id = 'Q1aVVGpkJAQ';
2645 } elseif ( 'CostTrackerAdd' === $page ) {
2646 $video_id = 'Q1aVVGpkJAQ';
2647 } elseif ( 'Extensions-Mainwp-Jetpack-Protect-Extension' === $page ) {
2648 $tour_id = '31700';
2649 } elseif ( 'Extensions-Mainwp-Jetpack-Scan-Extension' === $page ) {
2650 $tour_id = '31694';
2651 } elseif ( 'Extensions-Termageddon-For-Mainwp' === $page ) {
2652 $tour_id = '32104';
2653 $video_id = 'HAHySipH22I';
2654 } elseif ( 'Extensions-Advanced-Uptime-Monitor-Extension' === $page ) {
2655 $tour_id = '32149';
2656 $video_id = '3PIsyNM3OM0';
2657 } elseif ( 'Extensions-Mainwp-Custom-Dashboard-Extension' === $page ) {
2658 $tour_id = '32150';
2659 $video_id = 'T6jzvD3ogfw';
2660 } elseif ( 'Extensions-Mainwp-Updraftplus-Extension' === $page ) {
2661 $tour_id = '32151';
2662 } elseif ( 'Extensions-Mainwp-Sucuri-Extension' === $page ) {
2663 $tour_id = '32152';
2664 $video_id = 'bykz9YabuA8';
2665 } elseif ( 'Extensions-Mainwp-Clean-And-Lock-Extension' === $page ) {
2666 $tour_id = '32153';
2667 $video_id = 'uCCDiPbqXUc';
2668 } elseif ( 'Extensions-Mainwp-Woocommerce-Shortcuts-Extension' === $page ) {
2669 $tour_id = '32851';
2670 } elseif ( 'Extensions-Mainwp-Buddy-Extension' === $page ) {
2671 $tour_id = '33064';
2672 } elseif ( 'Extensions-Mainwp-Backwpup-Extension' === $page ) {
2673 $tour_id = '32923';
2674 } elseif ( 'Extensions-Mainwp-Ssl-Monitor-Extension' === $page ) {
2675 $tour_id = '33164';
2676 $video_id = 'HYb9xZ7Lxe0';
2677 } elseif ( 'Extensions-Mainwp-Cache-Control-Extension' === $page ) {
2678 $tour_id = '33167';
2679 } elseif ( 'Extensions-Mainwp-Maintenance-Extension' === $page ) {
2680 $tour_id = '33301';
2681 } elseif ( 'Extensions-Mainwp-Domain-Monitor-Extension' === $page ) {
2682 $tour_id = '66031';
2683 $video_id = 'QMziJ1BxEcE';
2684 } elseif ( 'Extensions-Mainwp-Favorites-Extension' === $page ) {
2685 $tour_id = '66035';
2686 $video_id = 'JRn7SLC4028';
2687 } elseif ( 'Extensions-Mainwp-Regression-Testing-Extension' === $page ) {
2688 $tour_id = '66037';
2689 $video_id = 'rrynCqVxKSw';
2690 } elseif ( 'Extension-Mainwp-Google-Analytics-Extension' === $page ) {
2691 $video_id = 'BV0xTftH7as';
2692 } elseif ( 'Extensions-Mainwp-Code-Snippets-Extension' === $page ) {
2693 $video_id = 'Bl7rJzGmNU0';
2694 } elseif ( 'Extensions-Mainwp-Article-Uploader-Extension' === $page ) {
2695 $video_id = 'e8WoikPFyB0';
2696 } elseif ( 'Extensions-Mainwp-Branding-Extension' === $page ) {
2697 $video_id = 'kWvEVIpPEss';
2698 } elseif ( 'Extensions-Mainwp-Time-Tracker-Extension' === $page ) {
2699 $video_id = 'nvsKRp_rtiA';
2700 } elseif ( 'Extensions-Mainwp-Comments-Extension' === $page ) {
2701 $video_id = 'tCSX3z1KOOg';
2702 } elseif ( 'Extensions-Mainwp-Lighthouse-Extension' === $page ) {
2703 $video_id = 'GNYKJsoJso8';
2704 } elseif ( 'Extensions-Mainwp-Rocket-Extension' === $page ) {
2705 $video_id = 'qahq6cR7Svo';
2706 }
2707
2708 $enable_guided_tours = get_option( 'mainwp_enable_guided_tours', 0 );
2709 $enable_guided_chatbase = get_option( 'mainwp_enable_guided_chatbase', 0 );
2710 $enable_guided_video = get_option( 'mainwp_enable_guided_video', 0 );
2711
2712 ?>
2713 <div id="mainwp-help-modal" class="ui modal">
2714 <i class="close icon"></i>
2715 <div class="header"><?php esc_html_e( 'Support', 'mainwp' ); ?></div>
2716
2717 <div class="scrolling center aligned content" id="mainwp-help-modal-content">
2718 <div class="ui two cards" id="mainwp-help-modal-options">
2719
2720 <div class="ui secondary card">
2721 <div class="content">
2722 <a id="mainwp-start-chat-card" class="<?php echo $enable_guided_chatbase ? '' : 'mainwp-disabled-link'; ?>" onclick="jQuery('#mainwp-update-permissions-button').fadeOut(200);jQuery('#mainwp-help-back-button').fadeIn(200);mainwp_help_modal_start_content_onclick( false, false, true );return false;">
2723 <div class="header"><?php esc_html_e( 'Support Assistant', 'mainwp' ); ?></div>
2724 <div class="ui hidden divider"></div>
2725 <i class="robot big grey icon" style="opacity:0.5"></i>
2726 <div class="ui fitted hidden divider"></div><br/>
2727 <span class="ui grey small text"><?php esc_html_e( 'Chat with our AI Support Assistant for quick guidance and troubleshooting. It\'s trained on MainWP documentation to help you find answers faster.', 'mainwp' ); ?> <span class="ui mini green label">BETA</span></span>
2728 </a>
2729 </div>
2730 <div class="content">
2731 <div class="ui tiny left aligned list">
2732 <div class="item" style="padding:0 0 0.21428571em 0;">
2733 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Database', 'mainwp' ); ?></div>
2734 </div>
2735 <div class="item" style="padding:0.21428571em 0;">
2736 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Screeen', 'mainwp' ); ?></div>
2737 </div>
2738 <div class="item" style="padding:0 0 0 0.21428571em;">
2739 <i class="check green icon"></i> <div class="content"><?php esc_html_e( 'Processes only information you submit', 'mainwp' ); ?></div>
2740 </div>
2741 </div>
2742 </div>
2743 <div class="left aligned extra content">
2744 <div class="ui toggle checkbox" id="mainwp-guided-chatbase-check">
2745 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp-guided-chatbase-option" id="mainwp-guided-chatbase-option" <?php echo 1 === (int) get_option( 'mainwp_enable_guided_chatbase', 0 ) ? 'checked="true"' : ''; ?> />
2746 <label><?php esc_html_e( 'Turn On / Turn Off', 'mainwp' ); ?></label>
2747 </div>
2748 </div>
2749 </div>
2750
2751 <div class="ui card">
2752 <div class="content">
2753 <a id="mainwp-start-tour-card" class="<?php echo $enable_guided_tours ? '' : 'mainwp-disabled-link'; ?>" onclick="jQuery('#mainwp-help-modal').modal('hide');mainwp_help_modal_start_content_onclick( <?php echo (int) $tour_id; ?> );" >
2754 <div class="header"><?php esc_html_e( 'Take a Quick Tour', 'mainwp' ); ?></div>
2755 <div class="ui hidden divider"></div>
2756 <i class="map marked alternate big grey icon" style="opacity:0.5"></i>
2757 <div class="ui fitted hidden divider"></div><br/>
2758 <span class="ui grey small text"><?php esc_html_e( 'Learn how to navigate and use key features with an interactive step-by-step tour.', 'mainwp' ); ?></span>
2759 </a>
2760 <div class="ui mini green label"><?php esc_html_e( 'Recommended for first-time users.', 'mainwp' ); ?></div>
2761 </div>
2762 <div class="content">
2763 <div class="ui tiny left aligned list">
2764 <div class="item" style="padding:0 0 0.21428571em 0;">
2765 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Database', 'mainwp' ); ?></div>
2766 </div>
2767 <div class="item" style="padding:0.21428571em 0;">
2768 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Screen', 'mainwp' ); ?></div>
2769 </div>
2770 <div class="item" style="padding:0 0 0 0.21428571em;">
2771 <i class="check green icon"></i> <div class="content"><?php esc_html_e( 'Processes only information you submit', 'mainwp' ); ?></div>
2772 </div>
2773 </div>
2774 </div>
2775 <div class="left aligned extra content">
2776 <div class="ui toggle checkbox" id="mainwp-guided-tours-check" data-tooltip="<?php esc_attr_e( 'Changes apply after page reload', 'mainwp' ); ?>" data-position="top left" data-inverted="">
2777 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp-guided-tours-option" id="mainwp-guided-tours-option" <?php echo 1 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ? 'checked="true"' : ''; ?> />
2778 <label><?php esc_html_e( 'Turn On / Turn Off', 'mainwp' ); ?></label>
2779 </div>
2780 </div>
2781 </div>
2782
2783 <div class="ui card">
2784 <div class="content">
2785 <a id="mainwp-start-video-card" class="<?php echo $enable_guided_video ? '' : 'mainwp-disabled-link'; ?>" <?php echo '' !== $video_id ? '' : 'style="display:none"'; ?> onclick="jQuery('#mainwp-update-permissions-button').fadeOut(200);jQuery('#mainwp-help-back-button').fadeIn(200);mainwp_help_modal_start_content_onclick( false, '<?php echo esc_js( $video_id ); ?>', false );return false;" >
2786 <div class="header"><?php esc_html_e( 'MainWP 101 Video Tour', 'mainwp' ); ?></div>
2787 <div class="ui hidden divider"></div>
2788 <i class="youtube big grey icon" style="opacity:0.5"></i>
2789 <div class="ui fitted hidden divider"></div><br/>
2790 <span class="ui grey small text"><?php esc_html_e( 'Discover the essential features of this page in our quick, step-by-step video guide.', 'mainwp' ); ?></span>
2791 </a>
2792 </div>
2793 <div class="content">
2794 <div class="ui tiny left aligned list">
2795 <div class="item" style="padding:0 0 0.21428571em 0;">
2796 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Database', 'mainwp' ); ?></div>
2797 </div>
2798 <div class="item" style="padding:0.21428571em 0;">
2799 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Screen', 'mainwp' ); ?></div>
2800 </div>
2801 <div class="item" style="padding:0 0 0 0.21428571em;">
2802 <i class="check green icon"></i> <div class="content"><?php esc_html_e( 'Plays only when you activate it', 'mainwp' ); ?></div>
2803 </div>
2804 </div>
2805 </div>
2806 <div class="left aligned extra content">
2807 <div class="ui toggle checkbox" id="mainwp-guided-video-check">
2808 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp-guided-video-option" id="mainwp-guided-video-option" <?php echo 1 === (int) get_option( 'mainwp_enable_guided_video', 0 ) ? 'checked="true"' : ''; ?> />
2809 <label><?php esc_html_e( 'Turn On / Turn Off', 'mainwp' ); ?></label>
2810 </div>
2811 </div>
2812 </div>
2813
2814 <div class="ui card">
2815 <div class="content">
2816 <a id="mainwp-ticket-form-card" target="_blank" href="https://community.mainwp.com/">
2817 <div class="header"><?php esc_html_e( 'Contact MainWP Support', 'mainwp' ); ?></div>
2818 <div class="ui hidden divider"></div>
2819 <i class="ticket big grey icon" style="opacity:0.5"></i>
2820 <div class="ui fitted hidden divider"></div><br/>
2821 <span class="ui grey small text"><?php esc_html_e( 'Get in touch with our team for any inquiries or support ? we\'re here to help you.', 'mainwp' ); ?></span>
2822
2823 </a>
2824 </div>
2825 <div class="content">
2826 <div class="ui tiny left aligned list">
2827 <div class="item" style="padding:0 0 0.21428571em 0;">
2828 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Database', 'mainwp' ); ?></div>
2829 </div>
2830 <div class="item" style="padding:0.21428571em 0;">
2831 <i class="times red icon"></i> <div class="content"><?php esc_html_e( 'Access to your Screen', 'mainwp' ); ?></div>
2832 </div>
2833 <div class="item" style="padding:0 0 0 0.21428571em;">
2834 <i class="check green icon"></i> <div class="content"><?php esc_html_e( 'Access to community knowledge', 'mainwp' ); ?></div>
2835 </div>
2836 </div>
2837 </div>
2838 <div class="left aligned extra content">
2839 <div class="ui toggle disabled checked checkbox on-stop-propagation">
2840 <input type="checkbox" class="" name="" id="" checked="true" />
2841 <label><?php esc_html_e( 'Always On', 'mainwp' ); ?></label>
2842 </div>
2843 </div>
2844 </div>
2845
2846 </div>
2847 <div style="display:none" id="mainwp-chatbase-chat-screen">
2848 <iframe src="" width="100%" style="height: 100%; min-height: 600px;border: none;" title="MainWP Support Assistant"></iframe>
2849 </div>
2850 <div style="display:none;position:relative;padding-bottom:56.25%;height:0;" id="mainwp-chatbase-video-screen">
2851 <iframe width="420" height="315" src="" style="position:absolute;top:0;left:0;width:100%;height:100%;border:none;" title="MainWP Video Tutorials"></iframe>
2852 </div>
2853 </div>
2854 <div class="actions">
2855 <div class="ui grid">
2856 <div class="eight wide left aligned middle aligned column">
2857 <a href="#" style="display:none" id="mainwp-help-back-button" class="ui mini basic button" onclick="jQuery('#mainwp-help-modal-options').fadeIn(200);jQuery('#mainwp-chatbase-video-screen').fadeOut(200);jQuery('#mainwp-chatbase-chat-screen').fadeOut(200);jQuery('#mainwp-help-back-button').fadeOut(200);jQuery('#mainwp-update-permissions-button').fadeIn(200);return false;"><i class="angle left icon"></i> <?php esc_html_e( 'Back to Support Options', 'mainwp' ); ?></a>
2858 </div>
2859 <div class="eight wide right aligned middle aligned column">
2860 <a class="ui mini basic button" id="mainwp-update-permissions-button" onclick="mainwp_help_modal_content_onclick();return false;"><?php esc_html_e( 'Update Permissions', 'mainwp' ); ?></a>
2861 </div>
2862 </div>
2863 </div>
2864
2865 </div>
2866 <script type="text/javascript">
2867 // to fix not keyboard accessible issue.
2868 document.querySelector('.ui.toggle.on-stop-propagation')
2869 .addEventListener('keydown', function (event) {
2870 if (event.key === 'Enter' || event.key === ' ') {
2871 event.preventDefault();
2872 event.stopPropagation();
2873 }
2874 });
2875 </script>
2876 <?php
2877 }
2878
2879 /**
2880 * Method render_loader_element()
2881 *
2882 * Renders navigation loading dimmer element with click handlers.
2883 *
2884 * Displays a page dimmer with loading text that shows when users click
2885 * on left menu items (level 0 and level 2). The dimmer provides visual
2886 * feedback during page navigation transitions.
2887 *
2888 * @return void Outputs HTML dimmer element and JavaScript event handlers.
2889 */
2890 public static function render_loader_element() {
2891 ?>
2892 <div id="mainwp-nav-dimmer" class="ui page dimmer">
2893 <div class="ui double text loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div>
2894 </div>
2895 <script>
2896 jQuery( document ).ready( function () {
2897 jQuery('#mainwp-first-level-navigation-menu .left-menu-item-level-0, #mainwp-second-level-navigation .left-menu-item-level-2:not(.extension-inactive)').on('click', function () {
2898 jQuery('#mainwp-nav-dimmer').dimmer({
2899 duration: 25,
2900 opacity: 1,
2901 }).dimmer('show');
2902 });
2903 } );
2904 </script>
2905 <?php
2906 }
2907
2908 /**
2909 * Method render_screen_options()
2910 *
2911 * Render modal window for Page Settings.
2912 *
2913 * @param bool $setting_page Default: True. Widgets that you want to hide in the MainWP Operations page.
2914 *
2915 * @return void Render modal window for Page Settings html.
2916 */
2917 public static function render_screen_options( $setting_page = true ) { // phpcs:ignore -- NOSONAR -Current complexity is the only way to achieve desired results, pull request solutions appreciated.
2918
2919 $default_widgets = array(
2920 'overview' => esc_html__( 'Updates Overview', 'mainwp' ),
2921 'recent_posts' => esc_html__( 'Recent Posts', 'mainwp' ),
2922 'recent_pages' => esc_html__( 'Recent Pages', 'mainwp' ),
2923 'plugins' => esc_html__( 'Plugins (Individual Site Operations page)', 'mainwp' ),
2924 'themes' => esc_html__( 'Themes (Individual Site Operations page)', 'mainwp' ),
2925 'connection_status' => esc_html__( 'Connection Status', 'mainwp' ),
2926 'security_issues' => esc_html__( 'Site Hardening', 'mainwp' ),
2927 'notes' => esc_html__( 'Notes (Individual Site Operations page)', 'mainwp' ),
2928 'clients' => esc_html__( 'Clients', 'mainwp' ),
2929 'child_site_info' => esc_html__( 'Child site info (Individual Site Operations page)', 'mainwp' ),
2930 'client_info' => esc_html__( 'Client info (Individual Site Operations page)', 'mainwp' ),
2931 'non_mainwp_changes' => esc_html__( 'Network Activity', 'mainwp' ),
2932 'get-started' => esc_html__( 'Get Started with MainWP', 'mainwp' ),
2933 'uptime_monitoring_status' => esc_html__( 'Uptime Monitoring', 'mainwp' ),
2934 'uptime_monitoring_response_time' => esc_html__( 'Uptime Monitoring (Individual Site Operations page)', 'mainwp' ),
2935 );
2936
2937 if ( ! MainWP_Uptime_Monitoring_Edit::is_enable_global_monitoring() ) {
2938 unset( $default_widgets['uptime_monitoring_status'] );
2939 unset( $default_widgets['uptime_monitoring_response_time'] );
2940 }
2941
2942 $custom_opts = apply_filters_deprecated( 'mainwp-widgets-screen-options', array( array() ), '4.0.7.2', 'mainwp_widgets_screen_options' ); // @deprecated Use 'mainwp_widgets_screen_options' instead. NOSONAR - not IP.
2943
2944 /**
2945 * Filter: mainwp_widgets_screen_options
2946 *
2947 * Filters available widgets on the Operations page allowing users to unset unwanted widgets.
2948 *
2949 * @since 4.0
2950 */
2951 $custom_opts = apply_filters( 'mainwp_widgets_screen_options', $custom_opts );
2952
2953 if ( is_array( $custom_opts ) && ! empty( $custom_opts ) ) {
2954 $default_widgets = array_merge( $default_widgets, $custom_opts );
2955 }
2956
2957 $show_widgets = get_user_option( 'mainwp_settings_show_widgets' );
2958
2959 if ( ! is_array( $show_widgets ) ) {
2960 $show_widgets = array();
2961 }
2962
2963 $sidebar_pages = array( 'ManageGroups', 'PostBulkManage', 'PostBulkAdd', 'PageBulkManage', 'PageBulkAdd', 'ThemesManage', 'ThemesInstall', 'ThemesAutoUpdate', 'PluginsManage', 'PluginsInstall', 'PluginsAutoUpdate', 'UserBulkManage', 'UserBulkAdd', 'UpdateAdminPasswords', 'Extensions' );
2964 $sidebar_pages = apply_filters( 'mainwp_sidbar_pages', $sidebar_pages ); // deprecated filter.
2965 $sidebar_pages = apply_filters( 'mainwp_sidebar_pages', $sidebar_pages );
2966
2967 /**
2968 * Action: mainwp_screen_options_modal_top
2969 *
2970 * Fires at the top of the Page Settings modal element.
2971 *
2972 * @since 4.1
2973 */
2974 do_action( 'mainwp_screen_options_modal_top' );
2975 $which_settings = 'overview_settings';
2976 ?>
2977 <?php if ( ! $setting_page ) : ?>
2978 <?php if ( isset( $_GET['page'] ) && in_array( $_GET['page'], $sidebar_pages ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended ?>
2979 <?php
2980 $which_settings = 'sidebar_settings';
2981 $sidebarPosition = (int) get_user_option( 'mainwp_sidebarPosition', 1 );
2982 $manageGroupsPage = false;
2983 if ( isset( $_GET['page'] ) && 'ManageGroups' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
2984 $manageGroupsPage = true;
2985 }
2986 ?>
2987 <div class="ui grid field">
2988 <label tabindex="0" class="six wide column middle aligned"><?php echo $manageGroupsPage ? esc_html__( 'Tags menu position', 'mainwp' ) : esc_html__( 'Sidebar position', 'mainwp' ); ?></label>
2989 <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Select if you want to show the element on left or right.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
2990 <select name="mainwp_sidebarPosition" id="mainwp_sidebarPosition" class="ui dropdown">
2991 <option value="1" <?php echo 1 === $sidebarPosition ? 'selected' : ''; ?>><?php esc_html_e( 'Right', 'mainwp' ); ?></option>
2992 <option value="0" <?php echo 0 === $sidebarPosition ? 'selected' : ''; ?>><?php esc_html_e( 'Left', 'mainwp' ); ?></option>
2993 </select>
2994 </div>
2995 </div>
2996 <?php endif; ?>
2997 <?php endif; ?>
2998 <?php
2999 if ( isset( $_GET['page'] ) && ! in_array( $_GET['page'], $sidebar_pages ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
3000 $hide_up_everything = (int) get_option( 'mainwp_hide_update_everything' );
3001 ?>
3002 <div class="ui grid field settings-field-indicator-wrapper">
3003 <label class="six wide column middle aligned">
3004 <?php
3005 MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_hide_update_everything', $hide_up_everything );
3006 esc_html_e( 'Hide the Update Everything button', 'mainwp' );
3007 ?>
3008 </label>
3009 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the "Update Everything" button will be hidden in the Updates Overview widget.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
3010 <input type="checkbox" class="settings-field-value-change-handler" name="hide_update_everything" <?php echo 1 === $hide_up_everything ? 'checked="true"' : ''; ?> />
3011 </div>
3012 </div>
3013 <?php
3014 $indi_val = 'all';
3015 foreach ( $default_widgets as $name => $title ) {
3016 if ( ! isset( $show_widgets[ $name ] ) || 1 === (int) $show_widgets[ $name ] ) {
3017 continue;
3018 }
3019 $indi_val = '';
3020 }
3021 ?>
3022 <div class="ui grid field settings-field-indicator-wrapper" default-indi-value="all">
3023 <label class="six wide column">
3024 <?php
3025 if ( $setting_page ) {
3026 MainWP_Settings_Indicator::render_not_default_indicator( 'show_default_widgets', $indi_val );
3027 }
3028 esc_html_e( 'Show widgets', 'mainwp' );
3029 ?>
3030 </label>
3031 <div class="ten wide column" <?php echo $setting_page ? 'data-tooltip="' . esc_attr__( 'Select widgets that you want to hide in the MainWP Operations page.', 'mainwp' ) . '"' : ''; ?> data-inverted="" data-position="top left">
3032 <ul class="mainwp_hide_wpmenu_checkboxes">
3033 <?php
3034 foreach ( $default_widgets as $name => $title ) {
3035 $_selected = '';
3036 if ( ! isset( $show_widgets[ $name ] ) || 1 === (int) $show_widgets[ $name ] ) {
3037 $_selected = 'checked';
3038 }
3039 ?>
3040 <li>
3041 <div class="ui checkbox">
3042 <input type="checkbox" class="settings-field-value-change-handler" id="mainwp_show_widget_<?php echo esc_attr( $name ); ?>" name="mainwp_show_widgets[]" <?php echo esc_html( $_selected ); ?> value="<?php echo esc_attr( $name ); ?>">
3043 <label for="mainwp_show_widget_<?php echo esc_attr( $name ); ?>" ><?php echo esc_html( $title ); ?></label>
3044 </div>
3045 <input type="hidden" name="mainwp_widgets_name[]" value="<?php echo esc_attr( $name ); ?>">
3046 </li>
3047 <?php
3048 }
3049 ?>
3050 </ul>
3051 </div>
3052 </div>
3053 <?php
3054 endif;
3055 // phpcs:enable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized.Recommended
3056 ?>
3057 <input type="hidden" name="reset_overview_which_settings" value="<?php echo esc_html( $which_settings ); ?>" />
3058 <?php
3059 /**
3060 * Action: mainwp_screen_options_modal_bottom
3061 *
3062 * Fires at the bottom of the Page Settings modal element.
3063 *
3064 * @since 4.1
3065 */
3066 do_action( 'mainwp_screen_options_modal_bottom' );
3067 }
3068
3069 /**
3070 * Method render_select_mainwp_themes_modal()
3071 *
3072 * Render modal window for mainwp themes selection.
3073 *
3074 * @return void Render modal window for themes selection.
3075 */
3076 public static function render_select_mainwp_themes_modal() {
3077 ?>
3078 <div class="ui modal" id="mainwp-select-mainwp-themes-modal">
3079 <i class="close icon"></i>
3080 <div class="header"><?php esc_html_e( 'Select MainWP Theme', 'mainwp' ); ?></div>
3081 <div class="content ui form">
3082 <div class="ui blue message">
3083 <div class=""><?php /* translators: 1: Opening anchor tag for documentation link, 2: Closing anchor tag. */ printf( esc_html__( 'Did you know you can create your custom theme? %1$sSee here how to do it%2$s!', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/management/mainwp-dashboard-settings#select-mainwp-theme" target="_blank">', '</a>' ); // NOSONAR - noopener - open safe. ?></div>
3084 </div>
3085 <form method="POST" action="" name="mainwp_select_mainwp_themes_form" id="mainwp_select_mainwp_themes_form">
3086 <?php self::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
3087 <input type="hidden" name="wp_scr_options_nonce" value="<?php echo esc_attr( wp_create_nonce( 'MainWPSelectThemes' ) ); ?>" />
3088 <?php
3089 /**
3090 * Action: mainwp_select_themes_modal_top
3091 *
3092 * Fires at the top of the modal.
3093 *
3094 * @since 4.3
3095 */
3096 do_action( 'mainwp_select_themes_modal_top' );
3097
3098 MainWP_Settings::get_instance()->render_select_custom_themes();
3099
3100 /**
3101 * Action: mainwp_select_themes_modal_bottom
3102 *
3103 * Fires at the bottom of the modal.
3104 *
3105 * @since 4.3
3106 */
3107 do_action( 'mainwp_select_themes_modal_bottom' );
3108 ?>
3109 </div>
3110 <div class="actions">
3111 <div class="ui two columns grid">
3112 <div class="left aligned column">
3113
3114 </div>
3115 <div class="ui right aligned column">
3116 <input type="submit" class="ui green button" id="submit-select-mainwp-themes" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>" />
3117 </div>
3118 </div>
3119 </div>
3120 </form>
3121 </div>
3122 <?php
3123 }
3124
3125 /**
3126 * Method render_install_extensions_promo_modal()
3127 */
3128 public static function render_install_extensions_promo_modal() {
3129 $mainwp_api_key = MainWP_Api_Manager_Key::instance()->get_decrypt_master_api_key();
3130 ?>
3131 <div class="ui small modal" id="mainwp-install-extensions-promo-modal">
3132 <i class="close icon"></i>
3133 <?php if ( empty( $mainwp_api_key ) ) : ?>
3134 <div class="header"><?php esc_html_e( 'Get MainWP Pro', 'mainwp' ); ?></div>
3135 <div class="content">
3136 <div class="ui header"><?php esc_html_e( 'With your MainWP Pro subscription, you get access to:', 'mainwp' ); ?></div>
3137 <div class="ui bulleted list">
3138 <div class="item"><?php esc_html_e( 'All 30+ Existing Premium Add-ons', 'mainwp' ); ?></div>
3139 <div class="item"><?php esc_html_e( 'All Future Add-ons', 'mainwp' ); ?></div>
3140 <div class="item"><?php esc_html_e( 'Critical Security & Performance Updates', 'mainwp' ); ?></div>
3141 <div class="item"><?php esc_html_e( 'Priority Support with Subscription', 'mainwp' ); ?></div>
3142 <div class="item"><?php esc_html_e( 'Manage Unlimited Websites', 'mainwp' ); ?></div>
3143 </div>
3144 <a href="https://mainwp.com/signup/?utm_campaign=Dashboard%20-%20Upgrade%20to%20Pro&utm_source=Dashboard&utm_medium=grey%20link%20modal&utm_term=get%20mainwp%20pro" class="ui big green button" target="_blank">Get MainWP Pro</a> <?php // NOSONAR - noopener - open safe. ?>
3145 </div>
3146 <?php else : ?>
3147 <div class="header"><?php esc_html_e( 'Install Add-ons', 'mainwp' ); ?></div>
3148 <div class="content">
3149 <div class="ui header"><?php esc_html_e( 'Add-on not activated', 'mainwp' ); ?></div>
3150 <div><?php esc_html_e( 'Go to the ', 'mainwp' ); ?><a href="admin.php?page=Extensions">MainWP > Add-ons</a><?php esc_html_e( ' page to install and activate add-ons.', 'mainwp' ); ?></div>
3151 </div>
3152 <?php endif; ?>
3153 </div>
3154 <?php
3155 }
3156
3157 /**
3158 * Method render_empty_element_placeholder()
3159 *
3160 * Renders the content for empty elements.
3161 *
3162 * @param string $title Title text.
3163 * @param string $message Message text.
3164 * @param string $icon Icon HTML markup.
3165 */
3166 public static function render_empty_element_placeholder( $title = '', $message = '', $icon = '' ) {
3167 ?>
3168 <div class="mainwp-empty-widget-placeholder">
3169 <h3 class="ui big icon header">
3170 <?php if ( '' !== $icon ) : ?>
3171 <?php echo $icon; //phpcs:ignore -- requires escaped. ?>
3172 <?php else : ?>
3173 <i class="search icon"></i>
3174 <?php endif; ?>
3175 <div class="content">
3176 <?php if ( '' !== $title ) : ?>
3177 <?php echo $title; //phpcs:ignore -- requires escaped. ?>
3178 <?php else : ?>
3179 <?php echo esc_html__( 'Nothing to show right now.', 'mainwp' ); ?>
3180 <?php endif; ?>
3181 <?php if ( '' !== $message ) : ?>
3182 <div class="sub header">
3183 <?php echo $message; //phpcs:ignore -- requires escaped. ?>
3184 </div>
3185 <?php endif; ?>
3186 </div>
3187 </h3>
3188 </div>
3189 <?php
3190 }
3191
3192 /**
3193 * Method render_empty_page_placeholder()
3194 *
3195 * Renders the content for empty pages.
3196 *
3197 * @param string $title Title text.
3198 * @param string $message Message text.
3199 * @param string $icon Icon HTML markup.
3200 */
3201 public static function render_empty_page_placeholder( $title = '', $message = '', $icon = '' ) {
3202 ?>
3203 <div class="mainwp-empty-page-placeholder ui center aligned middle aligned very padded segment">
3204 <div class="ui hidden divider"></div>
3205 <h2 class="ui icon header">
3206 <?php if ( '' !== $icon ) : ?>
3207 <?php echo $icon; //phpcs:ignore -- requires escaped. ?>
3208 <?php else : ?>
3209 <i class="massive green check tada transition icon"></i>
3210 <?php endif; ?>
3211 <div class="content">
3212 <?php if ( '' !== $title ) : ?>
3213 <?php echo $title; //phpcs:ignore -- requires escaped. ?>
3214 <?php else : ?>
3215 <?php echo esc_html__( 'Nothing to show here!', 'mainwp' ); ?>
3216 <?php endif; ?>
3217 <?php if ( '' !== $message ) : ?>
3218 <div class="sub header"><?php echo $message; //phpcs:ignore -- requires escaped. ?></div>
3219 <?php else : ?>
3220 <div class="sub header"><?php echo esc_html__( 'Check back later.', 'mainwp' ); ?></div>
3221 <?php endif; ?>
3222 </div>
3223 </h2>
3224 </div>
3225 <?php
3226 }
3227
3228 /**
3229 * Method render_modal_save_segment()
3230 *
3231 * Render modal window.
3232 *
3233 * @param string $name Model segment name.
3234 *
3235 * @return void
3236 */
3237 public static function render_modal_save_segment( $name = '' ) {
3238 ?>
3239 <div id="mainwp-common-filter-segment-modal" class="ui tiny modal">
3240 <i class="close icon" id="mainwp-common-filter-segment-cancel"></i>
3241 <div class="header"><?php esc_html_e( 'Save Segment', 'mainwp' ); ?></div>
3242 <div class="content" id="mainwp-common-filter-segment-content">
3243 <div id="mainwp-common-filter-edit-segment-status" class="ui message hidden"></div>
3244 <div id="mainwp-common-filter-segment-edit-fields" class="ui form">
3245 <div class="field">
3246 <label><?php esc_html_e( 'Enter the segment name', 'mainwp' ); ?></label>
3247 </div>
3248 <div class="field">
3249 <input type="text" id="mainwp-common-filter-edit-segment-name" value=""/>
3250 </div>
3251 </div>
3252 <div id="mainwp-common-filter-segment-select-fields" style="display:none;">
3253 <div class="field">
3254 <label><?php esc_html_e( 'Select a segment', 'mainwp' ); ?></label>
3255 </div>
3256 <div class="field">
3257 <div id="mainwp-common-filter-segments-lists-wrapper"></div>
3258 </div>
3259 </div>
3260 </div>
3261 <div class="actions">
3262 <div class="ui grid">
3263 <div class="eight wide left aligned middle aligned column">
3264 <input type="button" class="ui green button" id="mainwp-common-filter-edit-segment-save" value="<?php esc_attr_e( 'Save', 'mainwp' ); ?>"/>
3265 <input type="button" class="ui green button" id="mainwp-common-filter-select-segment-choose-button" value="<?php esc_attr_e( 'Choose', 'mainwp' ); ?>" style="display:none;"/>
3266 <input type="button" class="ui basic button" id="mainwp-common-filter-select-segment-delete-button" value="<?php esc_attr_e( 'Delete', 'mainwp' ); ?>" style="display:none;"/>
3267 </div>
3268 <div class="eight wide column">
3269
3270 </div>
3271 </div>
3272 </div>
3273 <input type="hidden" id="mainwp-common-filter-segments-model-name" value="<?php echo esc_attr( $name ); ?>" />
3274 </div>
3275 <?php
3276 }
3277
3278
3279 /**
3280 * Method generate_wp_nonce()
3281 *
3282 * @param mixed $act Action.
3283 * @param mixed $name Input name.
3284 * @param mixed $id Input id.
3285 * @param mixed $echo_out Echo or not.
3286 * @return mixed Output.
3287 */
3288 public static function generate_wp_nonce( $act, $name = '_wpnonce', $id = '__auto__', $echo_out = true ) {
3289
3290 if ( '__auto__' === $id ) {
3291 $id = wp_generate_password( 12, false );
3292 }
3293
3294 $nonce = wp_create_nonce( $act );
3295 $out = '<input type="hidden" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="' . esc_attr( $nonce ) . '" />';
3296
3297 if ( $echo_out ) {
3298 echo $out; //phpcs:ignore --ok.
3299 return '';
3300 }
3301 return $out;
3302 }
3303
3304 /**
3305 * Method render_modal_reconnect()
3306 *
3307 * Render modal window.
3308 *
3309 * @return void
3310 */
3311 public static function render_modal_reconnect() {
3312 ?>
3313 <div class="ui modal" id="mainwp-reconnect-site-with-user-passwd-modal">
3314 <i class="close icon"></i>
3315 <div class="header"><?php esc_html_e( 'Reconnect Site', 'mainwp' ); ?></div>
3316 <div class="content">
3317 <div class="ui message" id="mainwp-message-zone-reconnect" style="display:none;"></div>
3318 <div class="ui grid field" >
3319 <label class="six wide column middle aligned"><?php esc_html_e( 'Administrator username', 'mainwp' ); ?></label>
3320 <div class="ui ten wide fluid column" data-tooltip="<?php esc_attr_e( 'Enter the website Administrator username.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
3321 <div class="ui left fluid labeled input" tabindex="0">
3322 <input type="text" id="mainwp_managesites_add_wpadmin" name="mainwp_managesites_add_wpadmin" value="" />
3323 </div>
3324 </div>
3325 </div>
3326 <div id="mainwp-administrator-password-field">
3327 <input type="password" id="fake-disable-autofill" style="display:none;" name="fake-disable-autofill" />
3328 <div class="ui grid field">
3329 <label class="six wide column top aligned"><?php esc_html_e( 'Administrator password', 'mainwp' ); ?></label>
3330 <div class="ui ten wide column" data-tooltip="<?php esc_attr_e( 'Enter the website Administrator password.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
3331 <div class="ui left fluid labeled input">
3332 <input type="password" id="mainwp_managesites_add_admin_pwd" name="mainwp_managesites_add_admin_pwd" autocomplete="one-time-code" autocorrect="off" autocapitalize="none" spellcheck="false" value="" />
3333 </div>
3334 <div class="ui hidden fitted divider"></div>
3335 <span class="ui small text"><?php esc_html_e( 'Your password is never stored by your Dashboard and never sent to MainWP.com. Once this initial connection is complete, your MainWP Dashboard generates a secure Public and Private key pair (2048 bits) using OpenSSL, allowing future connections without needing your password again. For added security, you can even change this admin password once connected, just be sure not to delete the admin account, as this would disrupt the connection.', 'mainwp' ); ?></span>
3336 </div>
3337 </div>
3338 </div>
3339 </div>
3340 <div class="actions">
3341 <input type="button" autofocus name="mainwp-popup-reconnect-site-btn" id="mainwp-popup-reconnect-site-btn" class="ui button green big focus" value="<?php esc_attr_e( 'Reconnect', 'mainwp' ); ?>" />
3342 </div>
3343 </div>
3344 <?php
3345 }
3346
3347 /**
3348 * Method get_default_icons().
3349 *
3350 * @return array icons.
3351 */
3352 public static function get_default_icons() { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR - compatible phpcs's line breaks.
3353 return array(
3354 'wordpress', //phpcs:ignore -- WP icon.
3355 'ambulance',
3356 'anchor',
3357 'archive',
3358 'award',
3359 'baby carriage',
3360 'balance scale',
3361 'balance scale left',
3362 'balance scale right',
3363 'bath',
3364 'bed',
3365 'beer',
3366 'bell',
3367 'bell outline',
3368 'bicycle',
3369 'binoculars',
3370 'birthday cake',
3371 'blender',
3372 'bomb',
3373 'book',
3374 'book dead',
3375 'bookmark',
3376 'bookmark outline',
3377 'briefcase',
3378 'broadcast tower',
3379 'bug',
3380 'building',
3381 'building outline',
3382 'bullhorn',
3383 'bullseye',
3384 'bus',
3385 'calculator',
3386 'calendar',
3387 'calendar alternate',
3388 'calendar alternate outline',
3389 'calendar outline',
3390 'camera',
3391 'camera retro',
3392 'candy cane',
3393 'car',
3394 'carrot',
3395 'church',
3396 'clipboard',
3397 'clipboard outline',
3398 'cloud',
3399 'coffee',
3400 'cog',
3401 'cogs',
3402 'compass',
3403 'compass outline',
3404 'cookie',
3405 'cookie bite',
3406 'copy',
3407 'copy outline',
3408 'cube',
3409 'cubes',
3410 'cut',
3411 'dice',
3412 'dice d20',
3413 'dice d6',
3414 'dice five',
3415 'dice four',
3416 'dice one',
3417 'dice six',
3418 'dice three',
3419 'dice two',
3420 'digital tachograph',
3421 'door closed',
3422 'door open',
3423 'drum',
3424 'drum steelpan',
3425 'envelope',
3426 'envelope open',
3427 'envelope open outline',
3428 'envelope outline',
3429 'eraser',
3430 'eye',
3431 'eye dropper',
3432 'eye outline',
3433 'fax',
3434 'feather',
3435 'feather alternate',
3436 'fighter jet',
3437 'file',
3438 'file alternate',
3439 'file alternate outline',
3440 'file outline',
3441 'file prescription',
3442 'film',
3443 'fire',
3444 'fire alternate',
3445 'fire extinguisher',
3446 'flag',
3447 'flag checkered',
3448 'flag outline',
3449 'flask',
3450 'futbol',
3451 'futbol outline',
3452 'gamepad',
3453 'gavel',
3454 'gem',
3455 'gem outline',
3456 'gift',
3457 'gifts',
3458 'glass cheers',
3459 'glass martini',
3460 'glass whiskey',
3461 'glasses',
3462 'globe',
3463 'graduation cap',
3464 'guitar',
3465 'hat wizard',
3466 'hdd',
3467 'hdd outline',
3468 'headphones',
3469 'headphones alternate',
3470 'headset',
3471 'heart',
3472 'heart broken',
3473 'heart outline',
3474 'helicopter',
3475 'highlighter',
3476 'holly berry',
3477 'home',
3478 'hospital',
3479 'hospital outline',
3480 'hourglass',
3481 'hourglass outline',
3482 'igloo',
3483 'image',
3484 'image outline',
3485 'images',
3486 'images outline',
3487 'industry',
3488 'key',
3489 'keyboard',
3490 'keyboard outline',
3491 'laptop',
3492 'leaf',
3493 'lemon',
3494 'lemon outline',
3495 'life ring',
3496 'life ring outline',
3497 'lightbulb',
3498 'lightbulb outline',
3499 'lock',
3500 'lock open',
3501 'magic',
3502 'magnet',
3503 'map',
3504 'map marker',
3505 'map marker alternate',
3506 'map outline',
3507 'map pin',
3508 'map signs',
3509 'marker',
3510 'medal',
3511 'medkit',
3512 'memory',
3513 'microchip',
3514 'microphone',
3515 'microphone alternate',
3516 'mitten',
3517 'mobile',
3518 'mobile alternate',
3519 'money bill',
3520 'money bill alternate',
3521 'money bill alternate outline',
3522 'money check',
3523 'money check alternate',
3524 'moon',
3525 'moon outline',
3526 'motorcycle',
3527 'mug hot',
3528 'newspaper',
3529 'newspaper outline',
3530 'paint brush',
3531 'paper plane',
3532 'paper plane outline',
3533 'paperclip',
3534 'paste',
3535 'paw',
3536 'pen',
3537 'pen alternate',
3538 'pen fancy',
3539 'pen nib',
3540 'pencil alternate',
3541 'phone',
3542 'phone alternate',
3543 'plane',
3544 'plug',
3545 'print',
3546 'puzzle piece',
3547 'ring',
3548 'road',
3549 'rocket',
3550 'ruler combined',
3551 'ruler horizontal',
3552 'ruler vertical',
3553 'satellite',
3554 'satellite dish',
3555 'save',
3556 'save outline',
3557 'school',
3558 'screwdriver',
3559 'scroll',
3560 'sd card',
3561 'search',
3562 'shield alternate',
3563 'shopping bag',
3564 'shopping basket',
3565 'shopping cart',
3566 'shower',
3567 'sim card',
3568 'skull crossbones',
3569 'sleigh',
3570 'snowflake',
3571 'snowflake outline',
3572 'snowplow',
3573 'space shuttle',
3574 'star',
3575 'star outline',
3576 'sticky note',
3577 'sticky note outline',
3578 'stopwatch',
3579 'stroopwafel',
3580 'subway',
3581 'suitcase',
3582 'sun',
3583 'sun outline',
3584 'tablet',
3585 'tablet alternate',
3586 'tachometer alternate',
3587 'tag',
3588 'tags',
3589 'taxi',
3590 'thumbtack',
3591 'ticket alternate',
3592 'toilet',
3593 'toolbox',
3594 'tools',
3595 'train',
3596 'tram',
3597 'trash',
3598 'trash alternate',
3599 'trash alternate outline',
3600 'tree',
3601 'trophy',
3602 'truck',
3603 'tv',
3604 'umbrella',
3605 'university',
3606 'unlock',
3607 'unlock alternate',
3608 'utensil spoon',
3609 'utensils',
3610 'wallet',
3611 'weight',
3612 'wheelchair',
3613 'wine glass',
3614 'wrench',
3615 'folder',
3616 'folder open',
3617 'palette',
3618 'server',
3619 'tint',
3620 );
3621 }
3622 }
3623