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