PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.1
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
← All changes | class/class-mainwp-ui.php +640 -1736 5.0.3.24.1 View file →
@@ -29,23 +29,19 @@
29 29 * Method select_sites_box()
30 30 *
31 31 * Select sites box.
32 32 *
33 - * @deprecated 4.3 Use MainWP_UI_Select_Sites::select_sites_box().
34 - *
35 33 * @param string $type Input type, radio.
36 34 * @param bool $show_group Whether or not to show group, Default: true.
37 35 * @param bool $show_select_all Whether to show select all.
38 - * @param string $class_style Default = ''.
36 + * @param string $class Default = ''.
39 37 * @param string $style Default = ''.
40 38 * @param array $selected_websites Selected Child Sites.
41 39 * @param array $selected_groups Selected Groups.
42 40 * @param bool $enableOfflineSites (bool) True, if offline sites is enabled. False if not.
43 41 * @param integer $postId Post Meta ID.
44 - *
45 - * @uses \MainWP\Dashboard\MainWP_System_Utility::maybe_unserialyze()
46 42 */
47 - 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 ) {
43 + 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 ) {
48 44
49 45 if ( $postId ) {
50 46
51 47 $sites_val = get_post_meta( $postId, '_selected_sites', true );
@@ -50,9 +46,9 @@
50 46
51 47 $sites_val = get_post_meta( $postId, '_selected_sites', true );
52 48 $selected_websites = MainWP_System_Utility::maybe_unserialyze( $sites_val );
53 49
54 - if ( empty( $selected_websites ) ) {
50 + if ( '' == $selected_websites ) {
55 51 $selected_websites = array();
56 52 }
57 53
58 54 $groups_val = get_post_meta( $postId, '_selected_groups', true );
@@ -57,15 +53,15 @@
57 53
58 54 $groups_val = get_post_meta( $postId, '_selected_groups', true );
59 55 $selected_groups = MainWP_System_Utility::maybe_unserialyze( $groups_val );
60 56
61 - if ( empty( $selected_groups ) ) {
57 + if ( '' == $selected_groups ) {
62 58 $selected_groups = array();
63 59 }
64 60 }
65 61
66 - if ( empty( $selected_websites ) && isset( $_GET['selected_sites'] ) && ! empty( $_GET['selected_sites'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
67 - $selected_sites = explode( '-', sanitize_text_field( wp_unslash( $_GET['selected_sites'] ) ) );// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
62 + if ( empty( $selected_websites ) && isset( $_GET['selected_sites'] ) && ! empty( $_GET['selected_sites'] ) ) {
63 + $selected_sites = explode( '-', sanitize_text_field( wp_unslash( $_GET['selected_sites'] ) ) ); // sanitize ok.
68 64 $selected_sites = array_map( 'intval', $selected_sites );
69 65 $selected_websites = array_filter( $selected_sites );
70 66 }
71 67
@@ -96,10 +92,8 @@
96 92 * Method select_sites_box_body()
97 93 *
98 94 * Select sites box Body.
99 95 *
100 - * @deprecated 4.3 Use MainWP_UI_Select_Sites::select_sites_box_body().
101 - *
102 96 * @param array $selected_websites Child Site that are selected.
103 97 * @param array $selected_groups Group that are selected.
104 98 * @param string $type Selector type.
105 99 * @param bool $show_group Whether or not to show group, Default: true.
@@ -106,11 +100,8 @@
106 100 * @param bool $show_select_all Whether or not to show select all, Default: true.
107 101 * @param bool $updateQty Whether or not to update quantity, Default = false.
108 102 * @param bool $enableOfflineSites Whether or not to enable offline sites, Default: true.
109 103 * @param int $postId Post ID.
110 - *
111 - * @uses \MainWP\Dashboard\MainWP_DB::query()
112 - * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
113 104 */
114 105 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 ) {
115 106
116 107 if ( 'all' !== $selected_websites && ! is_array( $selected_websites ) ) {
@@ -120,14 +111,9 @@
120 111 if ( ! is_array( $selected_groups ) ) {
121 112 $selected_groups = array();
122 113 }
123 114
124 - $selectedby = 'site';
125 - if ( ! empty( $selected_groups ) ) {
126 - $selectedby = 'group';
127 - }
128 -
129 - $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.name' ) );
115 + $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user() );
130 116 $groups = MainWP_DB_Common::instance()->get_not_empty_groups( null, $enableOfflineSites );
131 117
132 118 // support staging extension.
133 119 $staging_enabled = is_plugin_active( 'mainwp-staging-extension/mainwp-staging-extension.php' ) || is_plugin_active( 'mainwp-timecapsule-extension/mainwp-timecapsule-extension.php' );
@@ -143,35 +129,17 @@
143 129 }
144 130 // to fix layout with multi sites selector.
145 131 $tab_id = wp_rand();
146 132
147 - self::render_select_sites_header( $tab_id, $staging_enabled, $selectedby, $show_group );
148 - ?>
149 - <div class="ui tab <?php echo 'site' === $selectedby ? 'active' : ''; ?>" data-tab="mainwp-select-sites-<?php echo esc_attr( $tab_id ); ?>" id="mainwp-select-sites">
150 - <?php
151 - self::render_select_sites( $websites, $type, $selected_websites, $enableOfflineSites, $edit_site_id, $show_select_all );
152 - ?>
153 - </div>
154 - <?php if ( $staging_enabled ) { ?>
155 - <div class="ui tab <?php echo 'staging' === $selectedby ? 'active' : ''; ?>" data-tab="mainwp-select-staging-sites-<?php echo esc_attr( $tab_id ); ?>">
156 - <?php
157 - self::render_select_sites_staging( $selected_websites, $edit_site_id, $type );
158 - ?>
159 - </div>
160 - <?php
161 - }
133 + self::render_select_sites_header( $tab_id, $staging_enabled, $selected_groups, $show_group, $show_select_all );
134 + self::render_select_sites( $websites, $type, $tab_id, $selected_websites, $enableOfflineSites, $edit_site_id );
135 + self::render_select_sites_staging( $staging_enabled, $tab_id, $selected_websites, $edit_site_id, $type );
162 136 if ( $show_group ) {
163 - ?>
164 - <div class="ui tab <?php echo 'group' === $selectedby ? 'active' : ''; ?>" data-tab="mainwp-select-groups-<?php echo esc_attr( $tab_id ); ?>" id="mainwp-select-groups">
165 - <?php
166 - self::render_select_sites_group( $groups, $selected_groups, $type );
167 - ?>
168 - </div>
169 - <?php
137 + self::render_select_sites_group( $groups, $tab_id, $selected_groups, $type );
170 138 }
171 139 ?>
172 140 <script type="text/javascript">
173 - jQuery( function () {
141 + jQuery( document ).ready( function () {
174 142 jQuery('#mainwp-select-sites-header .ui.menu .item').tab( {'onVisible': function() { mainwp_sites_selection_onvisible_callback( this ); } } );
175 143 } );
176 144 </script>
177 145 <?php
@@ -183,31 +151,43 @@
183 151 * Render selected sites header.
184 152 *
185 153 * @param int $tab_id Datatab ID.
186 154 * @param bool $staging_enabled True, if in the active plugins list. False, not in the list.
187 - * @param array $selectedby Selected by.
155 + * @param array $selected_groups Selected groups.
188 156 * @param bool $show_group Whether or not to show group, Default: true.
189 - * @param bool $show_client Whether or not to show client, Default: true.
157 + * @param bool $show_select_all Whether or not to show select all, Default: true.
190 158 *
191 159 * @todo Move to view folder.
192 160 */
193 - public static function render_select_sites_header( $tab_id, $staging_enabled, $selectedby, $show_group = true, $show_client = false ) {
161 + public static function render_select_sites_header( $tab_id, $staging_enabled, $selected_groups, $show_group = true, $show_select_all = true ) {
194 162
195 163 /**
196 164 * Action: mainwp_before_select_sites_filters
197 165 *
198 166 * Fires before the Select Sites box filters.
199 - *
167 + *
200 168 * @since 4.1
201 - */
169 + */
202 170 do_action( 'mainwp_before_select_sites_filters' );
203 171 ?>
204 172 <div id="mainwp-select-sites-filters">
173 + <div class="ui grid">
174 + <?php if ( $show_select_all ) { ?>
175 + <div class="four wide column">
176 + <div class="ui basic icon mini buttons">
177 + <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>
178 + <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>
179 + </div>
180 + </div>
181 + <?php } ?>
182 + <div class="<?php echo $show_select_all ? 'twelve' : 'sixteen'; ?> wide column">
205 183 <div class="ui mini fluid icon input">
206 - <input type="text" id="mainwp-select-sites-filter" value="" placeholder="<?php esc_attr_e( 'Type to filter your sites', 'mainwp' ); ?>" <?php echo 'site' === $selectedby ? '' : 'style="display: none;"'; ?> />
184 + <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;"' : '' ); ?> />
207 185 <i class="filter icon"></i>
208 186 </div>
209 187 </div>
188 + </div>
189 + </div>
210 190 <?php
211 191 /**
212 192 * Action: mainwp_after_select_sites_filters
213 193 *
@@ -216,24 +196,22 @@
216 196 * @since 4.1
217 197 */
218 198 do_action( 'mainwp_after_select_sites_filters' );
219 199 ?>
220 - <input type="hidden" name="select_by" id="select_by" value="<?php echo esc_attr( $selectedby ); ?>"/>
221 - <input type="hidden" id="select_sites_tab" value="<?php echo esc_attr( $selectedby ); ?>"/>
200 + <input type="hidden" name="select_by" id="select_by" value="<?php echo esc_attr( 0 < count( $selected_groups ) ? 'group' : 'site' ); ?>"/>
201 + <input type="hidden" id="select_sites_tab" value="<?php echo esc_attr( 0 < count( $selected_groups ) ? 'group' : 'site' ); ?>"/>
222 202 <div id="mainwp-select-sites-header">
223 203 <div class="ui pointing green secondary menu">
224 - <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>
204 + <a class="item active" data-tab="mainwp-select-sites-<?php echo $tab_id; ?>"><?php esc_html_e( 'Sites', 'mainwp' ); ?></a>
225 205 <?php if ( $show_group ) : ?>
226 - <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>
206 + <a class="item" data-tab="mainwp-select-groups-<?php echo $tab_id; ?>"><?php esc_html_e( 'Groups', 'mainwp' ); ?></a>
227 207 <?php endif; ?>
228 - <?php if ( $show_client ) : ?>
229 - <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>
230 - <?php endif; ?>
231 208 <?php if ( $staging_enabled ) : ?>
232 - <a class="item ui tab" data-tab="mainwp-select-staging-sites-<?php echo esc_attr( $tab_id ); ?>" select-by="staging"><?php esc_html_e( 'Staging', 'mainwp' ); ?></a>
209 + <a class="item" data-tab="mainwp-select-staging-sites-<?php echo $tab_id; ?>"><?php esc_html_e( 'Staging', 'mainwp' ); ?></a>
233 210 <?php endif; ?>
234 211 </div>
235 212 </div>
213 + <div class="ui divider hidden"></div>
236 214 <?php
237 215 }
238 216
239 217 /**
@@ -240,79 +218,58 @@
240 218 * Method render_select_sites()
241 219 *
242 220 * @param object $websites Object containing child sites info.
243 221 * @param string $type Selector type.
222 + * @param mixed $tab_id Datatab ID.
244 223 * @param mixed $selected_websites Selected Child Sites.
245 224 * @param bool $enableOfflineSites (bool) True, if offline sites is enabled. False if not.
246 225 * @param mixed $edit_site_id Child Site ID to edit.
247 - * @param bool $show_select_all Whether or not to show select all, Default: true.
248 - * @param mixed $add_edit_client_id Show enable sites for client. Default: false, 0: add new client, 0 <: edit client.
249 - * @param bool $show_select_all_disc Whether or not to show select all disconnect sites, Default: false.
250 226 *
251 227 * @return void Render Select Sites html.
252 - *
253 - * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
254 - * @uses \MainWP\Dashboard\MainWP_DB::free_result()
255 228 */
256 - 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
257 - /**
258 - * Action: mainwp_before_select_sites_list
259 - *
260 - * Fires before the Select Sites list.
261 - *
262 - * @param object $websites Object containing child sites info.
263 - *
264 - * @since 4.1
265 - */
266 - do_action( 'mainwp_before_select_sites_list', $websites );
267 - $count_disc = 0;
229 + public static function render_select_sites( $websites, $type, $tab_id, $selected_websites, $enableOfflineSites, $edit_site_id ) {
268 230 ?>
231 + <div class="ui tab active" data-tab="mainwp-select-sites-<?php echo $tab_id; ?>" id="mainwp-select-sites" select-by="site">
232 + <?php
233 + /**
234 + * Action: mainwp_before_select_sites_list
235 + *
236 + * Fires before the Select Sites list.
237 + *
238 + * @param object $websites Object containing child sites info.
239 + *
240 + * @since 4.1
241 + */
242 + do_action( 'mainwp_before_select_sites_list', $websites );
243 + ?>
269 244 <div id="mainwp-select-sites-body">
270 245 <div class="ui relaxed divided list" id="mainwp-select-sites-list">
271 246 <?php if ( ! $websites ) : ?>
272 - <div id="mainwp-select-sites-placeholder" class="ui segment">
273 - <?php self::render_empty_element_placeholder( __( 'No sites connected.', 'mainwp' ) ); ?>
274 - </div>
247 + <h2 class="ui icon header">
248 + <i class="folder open outline icon"></i>
249 + <div class="content"><?php esc_html_e( 'No Sites connected!', 'mainwp' ); ?></div>
250 + <div class="ui divider hidden"></div>
251 + <a href="admin.php?page=managesites&do=new" class="ui green button basic"><?php esc_html_e( 'Add Site', 'mainwp' ); ?></a>
252 + </h2>
275 253 <?php
276 254 else :
277 255 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
278 - $enable_site = true;
279 - if ( false === $add_edit_client_id ) {
280 - $enable_site = true;
281 - } elseif ( 0 === intval( $add_edit_client_id ) && false !== $add_edit_client_id ) {
282 - if ( 0 < intval( $website->client_id ) ) {
283 - $enable_site = false;
284 - }
285 - } elseif ( is_numeric( $add_edit_client_id ) && intval( $add_edit_client_id ) > 0 ) {
286 - if ( 0 < intval( $website->client_id ) && intval( $website->client_id ) !== intval( $add_edit_client_id ) ) {
287 - $enable_site = false;
288 - }
289 - }
290 -
291 - $site_client_editing = ( $add_edit_client_id && $website->client_id && $add_edit_client_id === $website->client_id ) ? true : false;
292 -
293 - $selected = false;
294 - $disconnected = false;
295 - if ( ( empty( $website->sync_errors ) || $enableOfflineSites ) && ( ! MainWP_System_Utility::is_suspended_site( $website ) || $site_client_editing ) && $enable_site ) {
256 + $selected = false;
257 + if ( '' == $website->sync_errors || $enableOfflineSites ) {
296 258 $selected = ( 'all' === $selected_websites || in_array( $website->id, $selected_websites ) );
297 259 $disabled = '';
298 260 if ( $edit_site_id ) {
299 - if ( (int) $website->id === $edit_site_id ) {
261 + if ( $website->id == $edit_site_id ) {
300 262 $selected = true;
301 263 } else {
302 264 $disabled = 'disabled="disabled"';
303 265 }
304 266 }
305 -
306 - if ( '' !== $website->sync_errors ) {
307 - $disconnected = true;
308 - ++$count_disc;
309 - }
310 267 ?>
311 - <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' : '' ); ?>">
312 - <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 intval( $website->id ); ?>" <?php echo ( $selected ? 'checked="true"' : '' ); ?> />
268 + <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' : '' ); ?>">
269 + <input <?php echo $disabled; ?> type="<?php echo $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 intval( $website->id ); ?>" <?php echo ( $selected ? 'checked="true"' : '' ); ?> />
313 270 <label for="selected_sites_<?php echo intval( $website->id ); ?>">
314 - <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
271 + <?php echo stripslashes( $website->name ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
315 272 </label>
316 273 </div>
317 274 <?php
318 275 } else {
@@ -319,9 +276,9 @@
319 276 ?>
320 277 <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' : '' ); ?>">
321 278 <input type="<?php echo esc_html( $type ); ?>" disabled="disabled"/>
322 279 <label for="selected_sites_<?php echo intval( $website->id ); ?>">
323 - <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
280 + <?php echo stripslashes( $website->name ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
324 281 </label>
325 282 </div>
326 283 <?php
327 284 }
@@ -329,9 +286,9 @@
329 286 MainWP_DB::free_result( $websites );
330 287 endif;
331 288 ?>
332 289 </div>
333 - </div>
290 + </div>
334 291 <?php
335 292 /**
336 293 * Action: mainwp_after_select_sites_list
337 294 *
@@ -342,8 +299,9 @@
342 299 * @since 4.1
343 300 */
344 301 do_action( 'mainwp_after_select_sites_list', $websites );
345 302 ?>
303 + </div>
346 304 <?php
347 305 }
348 306
349 307 /**
@@ -350,66 +308,67 @@
350 308 * Method render_select_sites_staging()
351 309 *
352 310 * Render selected staging sites.
353 311 *
312 + * @param bool $staging_enabled (bool) True, if in the active plugins list. False, not in the list.
313 + * @param mixed $tab_id Datatab ID.
354 314 * @param mixed $selected_websites Selected Child Sites.
355 315 * @param mixed $edit_site_id Child Site ID to edit.
356 316 * @param string $type Selector type.
357 317 *
358 318 * @return void Render selected staging sites html.
359 - *
360 - * @uses \MainWP\Dashboard\MainWP_DB::query()
361 - * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
362 - * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
363 - * @uses \MainWP\Dashboard\MainWP_DB::free_result()
364 319 */
365 - public static function render_select_sites_staging( $selected_websites, $edit_site_id, $type = 'checkbox' ) {
366 - $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' ), $is_staging = 'yes' ) );
367 - ?>
368 - <div id="mainwp-select-sites-body">
369 - <div class="ui relaxed divided list" id="mainwp-select-staging-sites-list">
370 - <?php if ( ! $websites ) : ?>
371 - <h2 class="ui icon header">
372 - <i class="folder open outline icon"></i>
373 - <div class="content"><?php esc_html_e( 'No staging websites have been found!', 'mainwp' ); ?></div>
374 - </h2>
375 - <?php
376 - else :
377 - while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
378 - $selected = false;
379 - if ( empty( $website->sync_errors ) && ! MainWP_System_Utility::is_suspended_site( $website ) ) {
380 - $selected = ( 'all' === $selected_websites || in_array( $website->id, $selected_websites ) );
381 - $disabled = '';
382 - if ( $edit_site_id ) {
383 - if ( $website->id !== $edit_site_id ) {
384 - $disabled = 'disabled="disabled"';
320 + public static function render_select_sites_staging( $staging_enabled, $tab_id, $selected_websites, $edit_site_id, $type = 'checkbox' ) {
321 + if ( $staging_enabled ) :
322 + $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' ), $is_staging = 'yes' ) );
323 + ?>
324 + <div class="ui tab" data-tab="mainwp-select-staging-sites-<?php echo $tab_id; ?>" select-by="staging">
325 + <div id="mainwp-select-sites-body">
326 + <div class="ui relaxed divided list" id="mainwp-select-staging-sites-list">
327 + <?php if ( ! $websites ) : ?>
328 + <h2 class="ui icon header">
329 + <i class="folder open outline icon"></i>
330 + <div class="content"><?php esc_html_e( 'No staging websites have been found!', 'mainwp' ); ?></div>
331 + </h2>
332 + <?php
333 + else :
334 + while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
335 + $selected = false;
336 + if ( '' == $website->sync_errors || $enableOfflineSites ) {
337 + $selected = ( 'all' === $selected_websites || in_array( $website->id, $selected_websites ) );
338 + $disabled = '';
339 + if ( $edit_site_id ) {
340 + if ( $website->id != $edit_site_id ) {
341 + $disabled = 'disabled="disabled"';
342 + }
385 343 }
344 + ?>
345 + <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' : '' ); ?>">
346 + <input <?php echo $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 intval( $website->id ); ?>" <?php echo ( $selected ? 'checked="true"' : '' ); ?> />
347 + <label for="selected_sites_<?php echo intval( $website->id ); ?>">
348 + <?php echo stripslashes( $website->name ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
349 + </label>
350 + </div>
351 + <?php
352 + } else {
353 + ?>
354 + <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' : '' ); ?>">
355 + <input <?php echo $disabled; ?> type="<?php echo esc_html( $type ); ?>" disabled="disabled"/>
356 + <label for="selected_sites_<?php echo intval( $website->id ); ?>">
357 + <?php echo stripslashes( $website->name ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
358 + </label>
359 + </div>
360 + <?php
386 361 }
387 - ?>
388 - <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' : '' ); ?>">
389 - <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 intval( $website->id ); ?>" <?php echo ( $selected ? 'checked="true"' : '' ); ?> />
390 - <label for="selected_sites_<?php echo intval( $website->id ); ?>">
391 - <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
392 - </label>
393 - </div>
394 - <?php
395 - } else {
396 - ?>
397 - <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' : '' ); ?>">
398 - <input type="<?php echo esc_html( $type ); ?>" disabled="disabled"/>
399 - <label for="selected_sites_<?php echo intval( $website->id ); ?>">
400 - <?php echo esc_html( stripslashes( $website->name ) ); ?> <span class="url"><?php echo esc_html( $website->url ); ?></span>
401 - </label>
402 - </div>
403 - <?php
404 362 }
405 - }
406 - MainWP_DB::free_result( $websites );
407 - endif;
408 - ?>
363 + MainWP_DB::free_result( $websites );
364 + endif;
365 + ?>
366 + </div>
409 367 </div>
410 368 </div>
411 - <?php
369 + <?php
370 + endif;
412 371 }
413 372
414 373 /**
415 374 * Method render_select_sites_group()
@@ -416,63 +375,70 @@
416 375 *
417 376 * Render selected sites group.
418 377 *
419 378 * @param array $groups Array of groups.
379 + * @param mixed $tab_id Datatab ID.
420 380 * @param mixed $selected_groups Selected groups.
421 381 * @param string $type Selector type.
422 382 *
423 383 * @return void Render selected sites group html.
424 384 */
425 - public static function render_select_sites_group( $groups, $selected_groups, $type = 'checkbox' ) {
426 - /**
427 - * Action: mainwp_before_select_groups_list
428 - *
429 - * Fires before the Select Groups list.
430 - *
431 - * @param object $groups Object containing groups info.
432 - *
433 - * @since 4.1
434 - */
435 - do_action( 'mainwp_before_select_groups_list', $groups );
385 + public static function render_select_sites_group( $groups, $tab_id, $selected_groups, $type = 'checkbox' ) {
436 386 ?>
437 - <div id="mainwp-select-sites-body">
438 - <div class="ui relaxed divided list" id="mainwp-select-groups-list">
439 - <?php
440 - if ( 0 === count( $groups ) ) {
441 - ?>
442 - <h2 class="ui icon header">
443 - <i class="folder open outline icon"></i>
444 - <div class="content"><?php esc_html_e( 'No Tags created!', 'mainwp' ); ?></div>
445 - <div class="ui divider hidden"></div>
446 - <a href="admin.php?page=ManageGroups" class="ui green button basic"><?php esc_html_e( 'Create Tags', 'mainwp' ); ?></a>
447 - </h2>
387 + <div class="ui tab" data-tab="mainwp-select-groups-<?php echo $tab_id; ?>" id="mainwp-select-groups" select-by="group">
388 + <?php
389 + /**
390 + * Action: mainwp_before_select_groups_list
391 + *
392 + * Fires before the Select Groups list.
393 + *
394 + * @param object $groups Object containing groups info.
395 + *
396 + * @since 4.1
397 + */
398 + do_action( 'mainwp_before_select_groups_list', $groups );
399 + ?>
400 + <div id="mainwp-select-sites-body">
401 + <div class="ui relaxed divided list" id="mainwp-select-groups-list">
448 402 <?php
449 - }
450 - foreach ( $groups as $group ) {
451 - $selected = in_array( $group->id, $selected_groups );
403 + if ( 0 === count( $groups ) ) {
404 + ?>
405 + <h2 class="ui icon header">
406 + <i class="folder open outline icon"></i>
407 + <div class="content"><?php esc_html_e( 'No Groups created!', 'mainwp' ); ?></div>
408 + <div class="ui divider hidden"></div>
409 + <a href="admin.php?page=ManageGroups" class="ui green button basic"><?php esc_html_e( 'Create Groups', 'mainwp' ); ?></a>
410 + </h2>
411 + <?php
412 + }
413 + foreach ( $groups as $group ) {
414 + $selected = in_array( $group->id, $selected_groups );
415 + ?>
416 + <div class="mainwp_selected_groups_item ui item <?php echo esc_html( $type ); ?> <?php echo ( $selected ? 'selected_groups_item_checked' : '' ); ?>">
417 + <input type="<?php echo esc_html( $type ); ?>" name="<?php echo ( 'radio' === $type ? 'selected_groups' : 'selected_groups[]' ); ?>" value="<?php echo $group->id; ?>" id="selected_groups_<?php echo $group->id; ?>" <?php echo ( $selected ? 'checked="true"' : '' ); ?> />
418 + <label for="selected_groups_<?php echo $group->id; ?>">
419 + <?php echo stripslashes( $group->name ); ?>
420 + </label>
421 + </div>
422 + <?php
423 + }
452 424 ?>
453 - <div class="mainwp_selected_groups_item ui item <?php echo esc_html( $type ); ?> <?php echo ( $selected ? 'selected_groups_item_checked' : '' ); ?>">
454 - <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"' : '' ); ?> />
455 - <label for="selected_groups_<?php echo esc_attr( $group->id ); ?>">
456 - <?php echo esc_html( stripslashes( $group->name ) ); ?>
457 - </label>
458 - </div>
459 - <?php
460 - }
461 - ?>
425 + </div>
462 426 </div>
427 + <?php
428 + /**
429 + * Action: mainwp_after_select_groups_list
430 + *
431 + * Fires after the Select Groups list.
432 + *
433 + * @param object $groups Object containing groups info.
434 + *
435 + * @since 4.1
436 + */
437 + do_action( 'mainwp_after_select_groups_list', $groups );
438 + ?>
463 439 </div>
464 440 <?php
465 - /**
466 - * Action: mainwp_after_select_groups_list
467 - *
468 - * Fires after the Select Groups list.
469 - *
470 - * @param object $groups Object containing groups info.
471 - *
472 - * @since 4.1
473 - */
474 - do_action( 'mainwp_after_select_groups_list', $groups );
475 441 }
476 442
477 443 /**
478 444 * Method render_top_header()
@@ -479,20 +445,13 @@
479 445 *
480 446 * Render top header.
481 447 *
482 448 * @param array $params Page parameters.
483 - *
484 - * @uses \MainWP\Dashboard\MainWP_DB::query()
485 - * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
486 - * @uses \MainWP\Dashboard\MainWP_Menu::render_left_menu()
487 449 */
488 - public static function render_top_header( $params = array() ) { // phpcs:ignore -- complex.
450 + public static function render_top_header( $params = array() ) {
489 451
490 - $before_title = isset( $params['before_title'] ) ? $params['before_title'] . ' ' : '';
491 - $title = isset( $params['title'] ) ? $params['title'] : '';
452 + $title = isset( $params['title'] ) ? $params['title'] : '';
492 453
493 - $which = isset( $params['which'] ) ? $params['which'] : '';
494 -
495 454 /**
496 455 * Filter: mainwp_header_title
497 456 *
498 457 * Filter the MainWP page title in the header element.
@@ -507,35 +466,8 @@
507 466 if ( isset( $params['show_menu'] ) ) {
508 467 $show_menu = $params['show_menu'];
509 468 }
510 469
511 - $more_tags = array(
512 - 'img' => array(
513 - 'src' => array(),
514 - 'width' => array(),
515 - 'height' => array(),
516 - 'class' => array(),
517 - ),
518 - 'div' => array(
519 - 'class' => array(),
520 - ),
521 - 'a' => array(
522 - 'href' => array(),
523 - 'class' => array(),
524 - 'target' => array(),
525 - 'style' => array(),
526 - 'site-id' => array(),
527 - 'siteid' => array(),
528 - ),
529 - 'i' => array(
530 - 'class' => array(),
531 - 'target' => array(),
532 - 'style' => array(),
533 - ),
534 - );
535 -
536 - $title = $before_title . $title;
537 -
538 470 /**
539 471 * Filter: mainwp_header_left
540 472 *
541 473 * Filter the MainWP header element left side content.
@@ -541,9 +473,9 @@
541 473 * Filter the MainWP header element left side content.
542 474 *
543 475 * @since 4.0
544 476 */
545 - $left = apply_filters( 'mainwp_header_left', $title, $params );
477 + $left = apply_filters( 'mainwp_header_left', $title );
546 478
547 479 $right = self::render_header_actions();
548 480
549 481 /**
@@ -556,9 +488,8 @@
556 488 $right = apply_filters( 'mainwp_header_right', $right );
557 489
558 490 if ( $show_menu ) {
559 491 MainWP_Menu::render_left_menu();
560 - MainWP_Menu::render_mobile_menu();
561 492 }
562 493
563 494 $sidebarPosition = get_user_option( 'mainwp_sidebarPosition' );
564 495 if ( false === $sidebarPosition ) {
@@ -564,163 +495,10 @@
564 495 if ( false === $sidebarPosition ) {
565 496 $sidebarPosition = 1;
566 497 }
567 498
568 - $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.name' ) );
499 + $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user() );
569 500
570 - $count_sites = MainWP_DB::instance()->get_websites_count();
571 -
572 - // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
573 - if ( empty( $count_sites ) ) {
574 - if ( ! isset( $_GET['do'] ) ) {
575 - self::render_modal_no_sites_note();
576 - }
577 - }
578 -
579 - $siteViewMode = MainWP_Utility::get_siteview_mode();
580 -
581 - $page = isset( $_GET['page'] ) ? wp_unslash( $_GET['page'] ) : '';
582 -
583 - $tour_id = '';
584 - if ( 'mainwp_tab' === $page ) {
585 - $tour_id = '13112';
586 - } elseif ( 'managesites' === $page ) {
587 - if ( isset( $_GET['do'] ) && 'new' === $_GET['do'] ) {
588 - $tour_id = '13210';
589 - } elseif ( isset( $_GET['do'] ) && 'bulknew' === $_GET['do'] ) {
590 - $tour_id = '27274';
591 - } elseif ( ! isset( $_GET['dashboard'] ) && ! isset( $_GET['id'] ) && ! isset( $_GET['updateid'] ) && ! isset( $_GET['emailsettingsid'] ) && ! isset( $_GET['scanid'] ) ) {
592 - if ( 'grid' === $siteViewMode ) {
593 - $tour_id = '27217';
594 - } else {
595 - $tour_id = '29331';
596 - }
597 - }
598 - } elseif ( 'MonitoringSites' === $page ) {
599 - $tour_id = '29003';
600 - } elseif ( 'ManageClients' === $page ) {
601 - if ( isset( $_GET['client_id'] ) ) {
602 - $tour_id = '28258';
603 - } else {
604 - $tour_id = '28240';
605 - }
606 - } elseif ( 'ClientAddNew' === $page ) {
607 - if ( isset( $_GET['client_id'] ) ) {
608 - $tour_id = '28962';
609 - } else {
610 - $tour_id = '28256';
611 - }
612 - } elseif ( 'ClientAddField' === $page ) {
613 - $tour_id = '28257';
614 - } elseif ( 'PluginsManage' === $page ) {
615 - $tour_id = '28510';
616 - } elseif ( 'ManageGroups' === $page ) {
617 - $tour_id = '27275';
618 - } elseif ( 'UpdatesManage' === $page ) {
619 - $tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : '';
620 - if ( 'plugins-updates' === $tab ) {
621 - $tour_id = '28259';
622 - } elseif ( 'themes-updates' === $tab ) {
623 - $tour_id = '28447';
624 - } elseif ( 'wordpress-updates' === $tab ) {
625 - $tour_id = '29005';
626 - } elseif ( 'translations-updates' === $tab ) {
627 - $tour_id = '29007';
628 - } elseif ( 'abandoned-plugins' === $tab ) {
629 - $tour_id = '29008';
630 - } elseif ( 'abandoned-themes' === $tab ) {
631 - $tour_id = '29009';
632 - } elseif ( 'plugin-db-updates' === $tab ) {
633 - $tour_id = '33161';
634 - } else {
635 - $tour_id = '28259';
636 - }
637 - } elseif ( 'PluginsInstall' === $page ) {
638 - $tour_id = '29011';
639 - } elseif ( 'PluginsAutoUpdate' === $page ) {
640 - $tour_id = '29015';
641 - } elseif ( 'PluginsIgnore' === $page ) {
642 - $tour_id = '29018';
643 - } elseif ( 'PluginsIgnoredAbandoned' === $page ) {
644 - $tour_id = '29329';
645 - } elseif ( 'ThemesManage' === $page ) {
646 - $tour_id = '28511';
647 - } elseif ( 'ThemesInstall' === $page ) {
648 - $tour_id = '29010';
649 - } elseif ( 'ThemesAutoUpdate' === $page ) {
650 - $tour_id = '29016';
651 - } elseif ( 'ThemesIgnore' === $page ) {
652 - $tour_id = '29019';
653 - } elseif ( 'ThemesIgnoredAbandoned' === $page ) {
654 - $tour_id = '29330';
655 - } elseif ( 'UserBulkManage' === $page ) {
656 - $tour_id = '28574';
657 - } elseif ( 'UserBulkAdd' === $page ) {
658 - $tour_id = '28575';
659 - } elseif ( 'BulkImportUsers' === $page ) {
660 - $tour_id = '28736';
661 - } elseif ( 'UpdateAdminPasswords' === $page ) {
662 - $tour_id = '28737';
663 - } elseif ( 'PostBulkManage' === $page ) {
664 - $tour_id = '28796';
665 - } elseif ( 'PostBulkAdd' === $page ) {
666 - $tour_id = '28799';
667 - } elseif ( 'PageBulkManage' === $page ) {
668 - $tour_id = '29045';
669 - } elseif ( 'PageBulkAdd' === $page ) {
670 - $tour_id = '29048';
671 - } elseif ( 'Extensions' === $page ) {
672 - $tour_id = '28800';
673 - } elseif ( 'Settings' === $page ) {
674 - $tour_id = '28883';
675 - } elseif ( 'SettingsAdvanced' === $page ) {
676 - $tour_id = '28886';
677 - } elseif ( 'SettingsEmail' === $page ) {
678 - $tour_id = '29054';
679 - } elseif ( 'MainWPTools' === $page ) {
680 - $tour_id = '29272';
681 - } elseif ( 'RESTAPI' === $page ) {
682 - $tour_id = '29273';
683 - } elseif ( 'ServerInformation' === $page ) {
684 - $tour_id = '28873';
685 - } elseif ( 'ServerInformationCron' === $page ) {
686 - $tour_id = '28874';
687 - } elseif ( 'ErrorLog' === $page ) {
688 - $tour_id = '28876';
689 - } elseif ( 'ActionLogs' === $page ) {
690 - $tour_id = '28877';
691 - } elseif ( 'Extensions-Mainwp-Jetpack-Protect-Extension' === $page ) {
692 - $tour_id = '31700';
693 - } elseif ( 'Extensions-Mainwp-Jetpack-Scan-Extension' === $page ) {
694 - $tour_id = '31694';
695 - } elseif ( 'Extensions-Termageddon-For-Mainwp' === $page ) {
696 - $tour_id = '32104';
697 - } elseif ( 'Extensions-Advanced-Uptime-Monitor-Extension' === $page ) {
698 - $tour_id = '32149';
699 - } elseif ( 'Extensions-Mainwp-Custom-Dashboard-Extension' === $page ) {
700 - $tour_id = '32150';
701 - } elseif ( 'Extensions-Mainwp-Updraftplus-Extension' === $page ) {
702 - $tour_id = '32151';
703 - } elseif ( 'Extensions-Mainwp-Sucuri-Extension' === $page ) {
704 - $tour_id = '32152';
705 - } elseif ( 'Extensions-Mainwp-Clean-And-Lock-Extension' === $page ) {
706 - $tour_id = '32153';
707 - } elseif ( 'Extensions-Mainwp-Woocommerce-Shortcuts-Extension' === $page ) {
708 - $tour_id = '32851';
709 - } elseif ( 'Extensions-Mainwp-Buddy-Extension' === $page ) {
710 - $tour_id = '33064';
711 - } elseif ( 'Extensions-Mainwp-Backwpup-Extension' === $page ) {
712 - $tour_id = '32923';
713 - } elseif ( 'Extensions-Mainwp-Ssl-Monitor-Extension' === $page ) {
714 - $tour_id = '33164';
715 - } elseif ( 'Extensions-Mainwp-Cache-Control-Extension' === $page ) {
716 - $tour_id = '33167';
717 - } elseif ( 'Extensions-Mainwp-Maintenance-Extension' === $page ) {
718 - $tour_id = '33301';
719 - } elseif ( 'Extensions-Mainwp-Domain-Monitor-Extension' === $page ) {
720 - $tour_id = '33300';
721 - }
722 - // phpcs:enable
723 501 ?>
724 502 <div class="ui segment right sites sidebar" style="padding:0px" id="mainwp-sites-menu-sidebar">
725 503 <div class="ui segment" style="margin-bottom:0px">
726 504 <div class="ui header"><?php esc_html_e( 'Quick Site Shortcuts', 'mainwp' ); ?></div>
@@ -732,45 +510,40 @@
732 510 <i class="filter icon"></i>
733 511 </div>
734 512 </div>
735 513 <div class="ui fluid vertical accordion menu" id="mainwp-sites-sidebar-menu" style="margin-top:0px;border-radius:0px;box-shadow:none;">
736 - <?php while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { ?>
514 + <?php foreach ( $websites as $website ) : ?>
737 515 <div class="item mainwp-site-menu-item">
738 - <div class="title">
516 + <a class="title">
739 517 <i class="dropdown icon"></i>
740 - <label><?php echo esc_html( $website->name ); ?></label>
741 - </div>
518 + <label><?php echo esc_html( $website['name'] ); ?></label>
519 + </a>
742 520 <div class="content">
743 - <div class="ui hiden divider"></div>
744 - <div class="ui fluid relaxed list">
745 - <div class="item" >
521 + <div class="ui link tiny list">
522 + <a class="item" href="<?php echo 'admin.php?page=managesites&dashboard=' . $website['id']; ?>">
746 523 <i class="grid layout icon"></i>
747 - <a href="<?php echo 'admin.php?page=managesites&dashboard=' . intval( $website->id ); ?>"><?php esc_html_e( 'Overview', 'mainwp' ); ?></a>
748 - </div>
749 - <div class="item" >
750 - <i class="redo icon"></i>
751 - <a href="<?php echo 'admin.php?page=managesites&updateid=' . intval( $website->id ); ?>"><?php esc_html_e( 'Updates', 'mainwp' ); ?></a>
752 - </div>
753 - <div class="item">
524 + <?php esc_html_e( 'Overview', 'mainwp' ); ?>
525 + </a>
526 + <a class="item" href="<?php echo 'admin.php?page=managesites&updateid=' . $website['id']; ?>">
527 + <i class="sync alternate icon"></i>
528 + <?php esc_html_e( 'Updates', 'mainwp' ); ?>
529 + </a>
530 + <a class="item" href="<?php echo 'admin.php?page=managesites&id=' . $website['id']; ?>">
754 531 <i class="edit icon"></i>
755 - <a href="<?php echo 'admin.php?page=managesites&id=' . intval( $website->id ); ?>"><?php esc_html_e( 'Edit Site', 'mainwp' ); ?></a>
756 - </div>
757 - <div class="item">
758 - <i class="sync alt icon"></i>
759 - <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>
760 - </div>
761 - <div class="item">
532 + <?php esc_html_e( 'Edit Site', 'mainwp' ); ?>
533 + </a>
534 + <a class="item" href="<?php echo 'admin.php?page=managesites&scanid=' . $website['id']; ?>">
762 535 <i class="shield icon"></i>
763 - <a href="<?php echo 'admin.php?page=managesites&scanid=' . intval( $website->id ); ?>"><?php esc_html_e( 'Site Hardening', 'mainwp' ); ?></a>
764 - </div>
765 - <div class="item">
766 - <i class="sign in icon"></i>
767 - <a target="_blank" href="<?php echo 'admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $website->id ); ?>&_opennonce=<?php echo esc_attr( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>"><?php esc_html_e( 'Go to WP Admin', 'mainwp' ); ?></a>
768 - </div>
769 - <div class="item">
536 + <?php esc_html_e( 'Security Scan', 'mainwp' ); ?>
537 + </a>
538 + <a class="item" href="<?php echo 'admin.php?page=SiteOpen&newWindow=yes&websiteid=' . $website['id']; ?>">
539 + <i class="sign-in icon"></i>
540 + <?php esc_html_e( 'Go to WP Admin', 'mainwp' ); ?>
541 + </a>
542 + <a class="item" href="<?php echo esc_url( $website['url'] ); ?>">
770 543 <i class="globe icon"></i>
771 - <a target="_blank" href="<?php echo esc_url( $website->url ); ?>"><?php esc_html_e( 'Visit Site', 'mainwp' ); ?></a>
772 - </div>
544 + <?php esc_html_e( 'Visit Site', 'mainwp' ); ?>
545 + </a>
773 546 <?php
774 547 /**
775 548 * Action: mainwp_quick_sites_shortcut
776 549 *
@@ -791,34 +564,14 @@
791 564 ?>
792 565 </div>
793 566 </div>
794 567 </div>
795 - <?php } ?>
568 + <?php endforeach; ?>
796 569 </div>
797 570 </div>
798 571 <div class="ui segment right wide help sidebar" id="mainwp-documentation-sidebar">
799 - <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>
572 + <div class="ui header"><?php esc_html_e( 'MainWP Documenation', 'mainwp' ); ?></div>
800 573 <div class="ui hidden divider"></div>
801 - <div class="ui info message" style="display:block!important;">
802 - <?php 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>' ); ?>
803 - </div>
804 - <div class="ui hidden divider"></div>
805 - <div class="ui toggle checkbox">
806 - <input type="checkbox" id="mainwp-select-guided-tours-option" onchange="mainwp_guidedtours_onchange(this);"<?php echo ( ( 1 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ) ? 'checked="true"' : '' ); ?> /> <label><?php esc_html_e( 'Switch to enable or disable tours.', 'mainwp' ); ?></label>
807 - </div>
808 - <div class="ui hidden divider"></div>
809 - <?php if ( 1 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ) : ?>
810 - <p><?php esc_html_e( 'MainWP guided tours are designed to provide information about all essential features on each MainWP Dashboard page.', 'mainwp' ); ?></p>
811 - <p><?php esc_html_e( 'Click the Start Page Tour button to start the guided tour for the current page.', 'mainwp' ); ?></p>
812 - <div class="ui hidden divider"></div>
813 - <a href="javacscript:void(0);" id="mainwp-start-page-tour-button" class="ui big green fluid basic button" tour-id="<?php esc_attr_e( $tour_id ); ?>"><?php esc_html_e( 'Start Page Tour', 'mainwp' ); ?></a>
814 - <?php if ( 'mainwp_tab' === $page ) : ?>
815 - <div class="ui hidden divider"></div>
816 - <a href="javacscript:void(0);" id="mainwp-interface-tour-button" class="ui big green fluid basic button"><?php esc_html_e( 'MainWP Interface Basics Tour', 'mainwp' ); ?></a>
817 - <?php endif; ?>
818 - <?php endif; ?>
819 - <div class="ui header"><?php esc_html_e( 'MainWP Knowledge Base', 'mainwp' ); ?></div>
820 - <div class="ui hidden divider"></div>
821 574 <?php
822 575 /**
823 576 * Action: mainwp_help_sidebar_content
824 577 *
@@ -831,9 +584,9 @@
831 584 <div class="ui hidden divider"></div>
832 585 <a href="https://kb.mainwp.com/" class="ui big green fluid button"><?php esc_html_e( 'Help Documentation', 'mainwp' ); ?></a>
833 586 <div class="ui hidden divider"></div>
834 587 <div id="mainwp-sticky-help-button" class="" style="position: absolute; bottom: 1em; left: 1em; right: 1em;">
835 - <a href="https://managers.mainwp.com/" target="_blank" class="ui fluid button"><?php esc_html_e( 'Still Need Help?', 'mainwp' ); ?></a>
588 + <a href="https://mainwp.com/my-account/get-support/" target="_blank" class="ui fluid button"><?php esc_html_e( 'Still Need Help?', 'mainwp' ); ?></a>
836 589 </div>
837 590 </div>
838 591 <?php
839 592 /**
@@ -845,101 +598,10 @@
845 598 *
846 599 * @since 4.1
847 600 */
848 601 do_action( 'mainwp_before_mainwp_content_wrap', $websites );
849 - global $wp_version;
850 - $fix_menu_overflow = 1;
851 - if ( version_compare( $wp_version, '5.5.3', '>' ) ) {
852 - $fix_menu_overflow = 2;
853 - }
854 -
855 - if ( 'page_clients_overview' !== $which ) {
856 - ?>
857 -
858 - <div class="ui modal" id="mainwp-overview-screen-options-modal">
859 - <i class="close icon"></i>
860 - <div class="header"><?php esc_html_e( 'Page Settings', 'mainwp' ); ?></div>
861 - <div class="content ui form">
862 - <?php
863 - /**
864 - * Action: mainwp_overview_screen_options_top
865 - *
866 - * Fires at the top of the Sceen Options modal on the Overview page.
867 - *
868 - * @since 4.1
869 - */
870 - do_action( 'mainwp_overview_screen_options_top' );
871 - ?>
872 - <form method="POST" action="" name="mainwp_overview_screen_options_form" id="mainwp-overview-screen-options-form">
873 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
874 - <input type="hidden" name="wp_nonce" value="<?php echo esc_html( wp_create_nonce( 'MainWPScrOptions' ) ); ?>" />
875 - <?php self::render_screen_options( false ); ?>
876 - <?php
877 - /**
878 - * Action: mainwp_overview_screen_options_bottom
879 - *
880 - * Fires at the bottom of the Sceen Options modal on the Overview page.
881 - *
882 - * @since 4.1
883 - */
884 - do_action( 'mainwp_overview_screen_options_bottom' );
885 - ?>
886 - </div>
887 - <div class="actions">
888 - <div class="ui two columns grid">
889 - <div class="left aligned column">
890 - <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>
891 - </div>
892 - <div class="ui right aligned column">
893 - <input type="submit" class="ui green button" id="submit-overview-settings" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>" />
894 - </div>
895 - </div>
896 - </div>
897 -
898 - <input type="hidden" name="reset_overview_settings" value="" />
899 - </form>
900 - </div>
901 - <?php } ?>
902 - <?php
903 - $wrap_class = isset( $params['wrap_class'] ) ? $params['wrap_class'] : '';
904 602 ?>
905 - <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 ); ?>">
906 - <?php if ( MainWP_Demo_Handle::is_demo_mode() ) : ?>
907 - <div class="ui segment" style="background-color:#1c1d1b!important;margin-bottom:0px;">
908 - <div class="ui inverted accordion" id="mainwp_demo_mode_accordion" style="background-color:#1c1d1b;">
909 - <div class="title">
910 - <i class="dropdown icon"></i>
911 - <?php if ( ! MainWP_Demo_Handle::is_instawp_site() ) { ?>
912 - <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>
913 - <?php } else { ?>
914 - <strong style="color:#fff;font-size:16px;"><?php esc_html_e( 'You are in Demo Mode. Click here for more info', 'mainwp' ); ?></strong>
915 - <?php } ?>
916 - </div>
917 - <div class="content">
918 - <br/>
919 - <div class="ui stackable grid">
920 - <div class="eleven wide middle aligned column">
921 - <?php if ( ! MainWP_Demo_Handle::is_instawp_site() ) { ?>
922 - <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>
923 - <?php } ?>
924 - <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>
925 - </div>
926 - <div class="five wide middle aligned column">
927 - <?php if ( ! MainWP_Demo_Handle::is_instawp_site() ) { ?>
928 - <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>
929 - <?php } else { ?>
930 - <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' ); ?></a></div>
931 - <?php } ?>
932 - </div>
933 - </div>
934 - <br/>
935 - </div>
936 - </div>
937 - </div>
938 - <script type="text/javascript">
939 - jQuery( '#mainwp_demo_mode_accordion' ).accordion();
940 - </script>
941 - <?php endif; ?>
603 + <div class="mainwp-content-wrap <?php echo empty( $sidebarPosition ) ? 'mainwp-sidebar-left' : ''; ?>">
942 604 <?php
943 605 /**
944 606 * Action: mainwp_before_header
945 607 *
@@ -950,84 +612,19 @@
950 612 * @since 4.0
951 613 */
952 614 do_action( 'mainwp_before_header', $websites );
953 615 ?>
954 - <div id="mainwp-top-header" class="ui native sticky">
955 - <div class="ui middle aligned stackable grid">
956 - <div class="six wide left aligned middle aligned column">
957 - <h4 class="mainwp-page-title ui header">
958 - <?php echo $left; // phpcs:ignore WordPress.Security.EscapeOutput ?>
959 - </h4>
616 + <div id="mainwp-top-header" class="ui sticky">
617 + <div class="ui stackable grid">
618 + <div class="two column row">
619 + <div class="left floated column"><h4 class="mainwp-page-title"><?php echo $left; ?></h4></div>
620 + <div class="right floated column right aligned"><?php echo $right; ?></div>
960 621 </div>
961 -
962 - <div class="ten wide right aligned column"><?php echo $right; ?></div> <?php // phpcs:ignore WordPress.Security.EscapeOutput ?>
963 -
964 622 </div>
965 623 </div>
966 -
967 - <?php if ( 1 === (int) get_option( 'mainwp_enable_guided_tours', 0 ) ) : ?>
968 - <script type="text/javascript">
969 - jQuery( document ).ready( function() {
970 - jQuery( '#mainwp-start-page-tour-button' ).on( 'click', function() {
971 - var tourId = jQuery( this ).attr( 'tour-id' );
972 - jQuery( '#mainwp-documentation-sidebar' ).sidebar( 'toggle' );
973 - window.USETIFUL.tour.start( parseInt( tourId ) );
974 - } );
975 - jQuery( '#mainwp-interface-tour-button' ).on( 'click', function() {
976 - jQuery( '#mainwp-documentation-sidebar' ).sidebar( 'toggle' );
977 - window.USETIFUL.tour.start( 13282 );
978 - } );
979 - } );
980 - </script>
981 - <?php endif; ?>
982 -
983 - <?php
984 - if ( isset( $_GET['message'] ) && ( 'qsw-import' === $_GET['message'] || 'enable-demo-mode' === $_GET['message'] ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
985 - ?>
986 - <script type= 'text/javascript'>
987 - var _count_retry = 0;
988 - _try_start_usetiful_tour = function () {
989 - setTimeout(
990 - function () {
991 - try {
992 - window.USETIFUL.tour.start( parseInt( 40279 ) );
993 - } catch ( e ) {
994 - if ( _count_retry < 10 ) {
995 - _count_retry++;
996 - console.log('retry:' + _count_retry);
997 - _try_start_usetiful_tour();
998 - }
999 - }
1000 - },
1001 - 1000
1002 - );
1003 - }
1004 - jQuery(document).ready(
1005 - function () {
1006 - _try_start_usetiful_tour();
1007 - }
1008 - );
1009 - </script>
1010 - <?php
1011 - endif;
1012 - ?>
1013 -
1014 624 <script type="text/javascript">
1015 625 jQuery( document ).ready( function () {
1016 -
1017 - jQuery( '#mainwp-jump-to-site-overview-dropdown' ).on( 'change', function() {
1018 - var site_id = jQuery( this ).val();
1019 - window.location.href = 'admin.php?page=managesites&dashboard=' + site_id;
1020 - } );
1021 -
1022 - jQuery( '#mainwp-sites-menu-sidebar' ).prependTo( 'body' );
1023 - jQuery( '#mainwp-documentation-sidebar' ).prependTo( 'body' );
1024 - jQuery( 'body > div#wpwrap' ).addClass( 'pusher' );
1025 -
1026 - jQuery( '.ui.sticky' ).sticky( {
1027 - pushing: false,
1028 - } ).sticky();
1029 -
626 + jQuery( '.ui.sticky' ).sticky();
1030 627 jQuery( '#mainwp-help-sidebar' ).on( 'click', function() {
1031 628 jQuery( '.ui.help.sidebar' ).sidebar( {
1032 629 transition: 'overlay'
1033 630 } );
@@ -1035,12 +632,9 @@
1035 632 return false;
1036 633 } );
1037 634 jQuery( '#mainwp-sites-sidebar' ).on( 'click', function() {
1038 635 jQuery( '.ui.sites.sidebar' ).sidebar( {
1039 - transition: 'overlay',
1040 - 'onVisible': function() {
1041 - jQuery( '#mainwp-sites-menu-filter' ).focus();
1042 - }
636 + transition: 'overlay'
1043 637 } );
1044 638 jQuery( '.ui.sites.sidebar' ).sidebar( 'toggle' );
1045 639 return false;
1046 640 } );
@@ -1061,64 +655,9 @@
1061 655 ?>
1062 656 <?php
1063 657 }
1064 658
1065 -
1066 659 /**
1067 - * Method render_showhide_columns_settings()
1068 - *
1069 - * Render show/hide columns settings.
1070 - *
1071 - * @param array $cols Columns.
1072 - * @param array $show_columns Show Columns.
1073 - * @param string $what what.
1074 - */
1075 - public static function render_showhide_columns_settings( $cols, $show_columns, $what ) {
1076 - ?>
1077 - <div class="ui grid field">
1078 - <label class="six wide column"><?php esc_html_e( 'Show columns', 'mainwp' ); ?></label>
1079 - <div class="ten wide column" data-tooltip="<?php echo esc_attr_e( 'Select columns that you want to hide.', 'mainwp' ); ?> data-inverted="" data-position="top left">
1080 - <ul>
1081 - <?php
1082 - foreach ( $cols as $name => $title ) {
1083 - $_selected = '';
1084 - if ( ! isset( $show_columns[ $name ] ) || 1 === (int) $show_columns[ $name ] ) {
1085 - $_selected = 'checked';
1086 - }
1087 - ?>
1088 - <li>
1089 - <div class="ui checkbox">
1090 - <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 ); ?>">
1091 - <label for="mainwp_show_column_<?php echo esc_attr( $name ); ?>" ><?php echo esc_html( $title ); ?></label>
1092 - </div>
1093 - <input type="hidden" name="mainwp_columns_name[]" value="<?php echo esc_attr( $name ); ?>">
1094 - </li>
1095 - <?php
1096 - }
1097 - ?>
1098 - </ul>
1099 - </div>
1100 -
1101 - </div>
1102 - <?php
1103 -
1104 - $input_name = '';
1105 - if ( 'post' === $what ) {
1106 - $input_name = 'mainwp_manageposts_show_columns_settings';
1107 - } elseif ( 'page' === $what ) {
1108 - $input_name = 'mainwp_managepages_show_columns_settings';
1109 - } elseif ( 'user' === $what ) {
1110 - $input_name = 'mainwp_manageusers_show_columns_settings';
1111 - }
1112 -
1113 - if ( ! empty( $input_name ) ) {
1114 - ?>
1115 - <input type="hidden" name="<?php echo esc_attr( $input_name ); ?>" value="1">
1116 - <?php
1117 - }
1118 - }
1119 -
1120 - /**
1121 660 * Method render_second_top_header()
1122 661 *
1123 662 * Render second top header.
1124 663 *
@@ -1138,19 +677,15 @@
1138 677 do_action( 'mainwp_before_subheader' );
1139 678 if ( has_action( 'mainwp_subheader_actions' ) || 'overview' === $which || 'managesites' === $which || 'monitoringsites' === $which ) {
1140 679 ?>
1141 680 <div class="mainwp-sub-header">
1142 - <?php
1143 - if ( 'overview' === $which ) {
1144 - ?>
681 + <?php if ( 'overview' === $which ) : ?>
1145 682 <div class="ui stackable grid">
1146 683 <div class="column full">
1147 684 <?php self::gen_groups_sites_selection(); ?>
1148 685 </div>
1149 686 </div>
1150 - <?php
1151 - }
1152 - ?>
687 + <?php endif; ?>
1153 688 <?php if ( 'managesites' === $which || 'monitoringsites' === $which ) : ?>
1154 689 <?php
1155 690 /**
1156 691 * Action: mainwp_managesites_tabletop
@@ -1160,9 +695,8 @@
1160 695 * @since 4.0
1161 696 */
1162 697 do_action( 'mainwp_managesites_tabletop' );
1163 698 ?>
1164 -
1165 699 <?php else : ?>
1166 700 <?php
1167 701 /**
1168 702 * Action: mainwp_subheader_actions
@@ -1176,16 +710,16 @@
1176 710 <?php endif; ?>
1177 711 </div>
1178 712 <?php
1179 713 }
1180 - /**
1181 - * Action: mainwp_after_subheader
1182 - *
1183 - * Fires after the MainWP sub-header element.
1184 - *
1185 - * @since 4.0
1186 - */
1187 - do_action( 'mainwp_after_subheader' );
714 + /**
715 + * Action: mainwp_after_subheader
716 + *
717 + * Fires after the MainWP sub-header element.
718 + *
719 + * @since 4.0
720 + */
721 + do_action( 'mainwp_after_subheader' );
1188 722 }
1189 723
1190 724 /**
1191 725 * Method gen_groups_sites_selection()
@@ -1192,31 +726,24 @@
1192 726 *
1193 727 * Generate group sites selection box.
1194 728 *
1195 729 * @return void Render group sites selection box.
1196 - *
1197 - * @uses \MainWP\Dashboard\MainWP_DB_Common::get_groups_for_manage_sites()
1198 - * @uses \MainWP\Dashboard\MainWP_DB_Common::get_not_empty_groups()
1199 - * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user()
1200 - * @uses \MainWP\Dashboard\MainWP_DB::query()
1201 - * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
1202 - * @uses \MainWP\Dashboard\MainWP_DB::free_result()
1203 730 */
1204 731 public static function gen_groups_sites_selection() {
1205 732 $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' ) );
1206 733 $websites = MainWP_DB::instance()->query( $sql );
1207 - $g = isset( $_GET['g'] ) ? intval( $_GET['g'] ) : -1; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
1208 - $s = isset( $_GET['dashboard'] ) ? intval( $_GET['dashboard'] ) : -1; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
734 + $g = isset( $_GET['g'] ) ? intval( $_GET['g'] ) : -1;
735 + $s = isset( $_GET['dashboard'] ) ? intval( $_GET['dashboard'] ) : -1;
1209 736 ?>
1210 737 <div class="column full wide">
1211 738 <select id="mainwp_top_quick_jump_group" class="ui dropdown">
1212 - <option value="" class="item"><?php esc_html_e( 'All Tags', 'mainwp' ); ?></option>
1213 - <option <?php echo ( -1 === $g ) ? 'selected' : ''; ?> value="-1" class="item"><?php esc_html_e( 'All Tags', 'mainwp' ); ?></option>
739 + <option value="" class="item"><?php esc_html_e( 'All Groups', 'mainwp' ); ?></option>
740 + <option <?php echo ( -1 === $g ) ? 'selected' : ''; ?> value="-1" class="item"><?php esc_html_e( 'All Groups', 'mainwp' ); ?></option>
1214 741 <?php
1215 742 $groups = MainWP_DB_Common::instance()->get_groups_for_manage_sites();
1216 743 foreach ( $groups as $group ) {
1217 744 ?>
1218 - <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>
745 + <option class="item" <?php echo ( $g == $group->id ) ? 'selected' : ''; ?> value="<?php echo $group->id; ?>"><?php echo stripslashes( $group->name ); ?></option>
1219 746 <?php
1220 747 }
1221 748 ?>
1222 749 </select>
@@ -1225,9 +752,9 @@
1225 752 <option <?php echo ( -1 === $s ) ? 'selected' : ''; ?> value="-1" class="item" ><?php esc_html_e( 'All Sites', 'mainwp' ); ?></option>
1226 753 <?php
1227 754 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
1228 755 ?>
1229 - <option value="<?php echo intval( $website->id ); ?>" <?php echo ( $s === (int) $website->id ) ? 'selected' : ''; ?> class="item" ><?php echo esc_html( stripslashes( $website->name ) ); ?></option>
756 + <option value="<?php echo intval( $website->id ); ?>" <?php echo ( $s == $website->id ) ? 'selected' : ''; ?> class="item" ><?php echo stripslashes( $website->name ); ?></option>
1230 757 <?php
1231 758 }
1232 759 ?>
1233 760 </select>
@@ -1244,10 +771,10 @@
1244 771 else
1245 772 window.location = 'admin.php?page=managesites&dashboard=' + jumpid;
1246 773 } );
1247 774 </script>
1248 - <?php
1249 - MainWP_DB::free_result( $websites );
775 + <?php
776 + MainWP_DB::free_result( $websites );
1250 777 }
1251 778
1252 779 /**
1253 780 * Method render_header_actions()
@@ -1255,160 +782,107 @@
1255 782 * Render header action buttons,
1256 783 * (Sync|Add|Options|Community|User|Updates).
1257 784 *
1258 785 * @return mixed $output Render header action buttons html.
1259 - *
1260 - * @uses \MainWP\Dashboard\MainWP_DB::get_websites_count()
1261 786 */
1262 - public static function render_header_actions() { //phpcs:ignore -- complex method.
1263 - $sites_count = MainWP_DB::instance()->get_websites_count();
1264 - $website_id = '';
1265 - $sidebar_pages = array( 'ManageGroups', 'PostBulkManage', 'PostBulkAdd', 'PageBulkManage', 'PageBulkAdd', 'ThemesManage', 'ThemesInstall', 'ThemesAutoUpdate', 'PluginsManage', 'PluginsInstall', 'PluginsAutoUpdate', 'UserBulkManage', 'UserBulkAdd', 'UpdateAdminPasswords', 'Extensions' );
1266 - $sidebar_pages = apply_filters( 'mainwp_sidbar_pages', $sidebar_pages ); // deprecated filter.
1267 - $sidebar_pages = apply_filters( 'mainwp_sidebar_pages', $sidebar_pages );
1268 -
1269 - // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1270 - $page = isset( $_GET['page'] ) ? wp_unslash( $_GET['page'] ) : '';
787 + public static function render_header_actions() {
788 + $sites_count = MainWP_DB::instance()->get_websites_count();
789 + $website_id = '';
1271 790 ob_start();
1272 - if ( isset( $_GET['dashboard'] ) || isset( $_GET['id'] ) || isset( $_GET['updateid'] ) || isset( $_GET['emailsettingsid'] ) || isset( $_GET['scanid'] ) ) :
1273 - $id = 0;
1274 - if ( isset( $_GET['dashboard'] ) ) {
1275 - $id = intval( $_GET['dashboard'] );
1276 - } elseif ( isset( $_GET['id'] ) ) {
1277 - $id = intval( $_GET['id'] );
1278 - } elseif ( isset( $_GET['updateid'] ) ) {
1279 - $id = intval( $_GET['updateid'] );
1280 - } elseif ( isset( $_GET['emailsettingsid'] ) ) {
1281 - $id = intval( $_GET['emailsettingsid'] );
1282 - } elseif ( isset( $_GET['scanid'] ) ) {
1283 - $id = intval( $_GET['scanid'] );
1284 - }
1285 -
1286 - $website = MainWP_DB::instance()->get_website_by_id( $id );
791 + ?>
792 + <button class="ui button green <?php echo ( 0 < $sites_count ? '' : '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' ); ?>">
793 + <?php
794 + /**
795 + * Filter: mainwp_main_sync_button_text
796 + *
797 + * Filters the Sync Dashboard with Child Sites button text.
798 + *
799 + * @since 4.1
800 + */
801 + echo esc_html( apply_filters( 'mainwp_main_sync_button_text', __( 'Sync Dashboard with Child Sites', 'mainwp' ) ) );
1287 802 ?>
1288 - <?php if ( $id && $website && '' !== $website->sync_errors ) : ?>
1289 - <a href="#" class="mainwp-updates-overview-reconnect-site ui green icon button" siteid="<?php echo intval( $website->id ); ?>" data-position="bottom right" data-tooltip="Reconnect <?php echo esc_html( stripslashes( $website->name ) ); ?>" data-inverted=""><i class="undo alternate icon"></i></a>
1290 - <?php else : ?>
1291 - <a class="ui icon button green <?php echo ( 0 < $sites_count ? '' : 'disabled' ); ?>" id="mainwp-sync-sites" data-tooltip="<?php esc_attr_e( 'Get fresh data from your child sites.', 'mainwp' ); ?> data-inverted="" data-position="bottom right">
1292 - <i class="sync icon"></i>
1293 - </a>
1294 - <?php endif; ?>
1295 - <?php else : ?>
1296 - <span data-tooltip="<?php esc_attr_e( 'Click here to sync data now.', 'mainwp' ); ?>" data-inverted="" data-position="left center">
1297 - <a class="ui icon button green <?php echo ( 0 < $sites_count ? '' : 'disabled' ); ?> " id="mainwp-sync-sites">
1298 - <i class="sync alternate icon"></i>
1299 - </a>
1300 - </span>
1301 - <?php endif; ?>
1302 -
1303 - <div class="ui icon top left pointing dropdown <?php echo ( empty( $sites_count ) ? 'green' : '' ); ?> button" id="mainwp-add-new-buttons">
1304 - <i class="plus icon"></i>
1305 - <div class="menu">
1306 - <a class="item" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Add a new Website to your MainWP Dashboard', 'mainwp' ); ?>" href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&do=new' ) ); ?>"><?php esc_html_e( 'Add Website', 'mainwp' ); ?></a>
1307 - <a class="item" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Add a new Client to your MainWP Dashboard', 'mainwp' ); ?>" href="<?php echo esc_url( admin_url( 'admin.php?page=ClientAddNew' ) ); ?>"><?php esc_html_e( 'Add Client', 'mainwp' ); ?></a>
1308 - <a class="item" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Add a new Cost to for tracking', 'mainwp' ); ?>" href="<?php echo esc_url( admin_url( 'admin.php?page=CostTrackerAdd' ) ); ?>"><?php esc_html_e( 'Add Cost', 'mainwp' ); ?></a>
1309 - <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_url( admin_url( 'admin.php?page=PostBulkAdd' ) ); ?>"><?php esc_html_e( 'Create Post', 'mainwp' ); ?></a>
1310 - <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_url( admin_url( 'admin.php?page=PageBulkAdd' ) ); ?>"><?php esc_html_e( 'Create Page', 'mainwp' ); ?></a>
1311 - <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_url( admin_url( 'admin.php?page=PluginsInstall' ) ); ?>"><?php esc_html_e( 'Install Plugin', 'mainwp' ); ?></a>
1312 - <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_url( admin_url( 'admin.php?page=ThemesInstall' ) ); ?>"><?php esc_html_e( 'Install Theme', 'mainwp' ); ?></a>
1313 - <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_url( admin_url( 'admin.php?page=UserBulkAdd' ) ); ?>"><?php esc_html_e( ' Create User', 'mainwp' ); ?></a>
803 + </button>
804 + <div class="ui <?php echo ( 0 == $sites_count ? 'green' : '' ); ?> buttons" id="mainwp-add-new-buttons">
805 + <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( 'Add New', 'mainwp' ); ?></a>
806 + <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' ); ?>">
807 + <i class="dropdown icon"></i>
808 + <div class="menu">
809 + <a class="item" data-inverted="" data-position="left center" 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( 'Website', 'mainwp' ); ?></a>
810 + <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>
811 + <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>
812 + <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>
813 + <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>
814 + <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>
815 + <?php
816 + /**
817 + * Action: mainwp_add_new_menu_option
818 + *
819 + * Fires at bottom of the Add New menu options list.
820 + *
821 + * Suggested HTML markup:
822 + * <a class="item" href="your custom URL">Your custom label</a>
823 + *
824 + * @since 4.1
825 + */
826 + do_action( 'mainwp_add_new_menu_option' );
827 + ?>
828 + </div>
1314 829 </div>
1315 830 </div>
1316 -
1317 - <?php if ( isset( $_GET['dashboard'] ) || isset( $_GET['id'] ) || isset( $_GET['updateid'] ) || isset( $_GET['emailsettingsid'] ) || isset( $_GET['scanid'] ) || isset( $_GET['cacheControlId'] ) ) : ?>
1318 - <?php if ( isset( $_GET['dashboard'] ) ) : ?>
1319 - <?php $website_id = intval( $_GET['dashboard'] ); ?>
1320 - <?php elseif ( isset( $_GET['updateid'] ) ) : ?>
1321 - <?php $website_id = intval( $_GET['updateid'] ); ?>
1322 - <?php elseif ( isset( $_GET['emailsettingsid'] ) ) : ?>
1323 - <?php $website_id = intval( $_GET['emailsettingsid'] ); ?>
1324 - <?php elseif ( isset( $_GET['scanid'] ) ) : ?>
1325 - <?php $website_id = intval( $_GET['scanid'] ); ?>
1326 - <?php elseif ( isset( $_GET['cacheControlId'] ) ) : ?>
1327 - <?php $website_id = intval( $_GET['cacheControlId'] ); ?>
1328 - <?php else : ?>
1329 - <?php $website_id = intval( $_GET['id'] ); ?>
1330 - <?php endif; ?>
1331 -
831 + <?php if ( isset( $_GET['dashboard'] ) ) : ?>
832 + <?php $website_id = intval( $_GET['dashboard'] ); ?>
833 + <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>
1332 834 <?php endif; ?>
1333 - <?php if ( ( 'mainwp_tab' === $page ) || isset( $_GET['dashboard'] ) || in_array( $page, $sidebar_pages ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended ?>
1334 - <a id="mainwp-screen-options-button" class="ui button basic icon" onclick="jQuery( '#mainwp-overview-screen-options-modal' ).modal({allowMultiple:true}).modal( 'show' ); return false;" data-inverted="" data-position="bottom right" href="#" target="_blank" data-tooltip="<?php esc_html_e( 'Page Settings', 'mainwp' ); ?>">
835 + <?php if ( ( isset( $_GET['page'] ) && 'mainwp_tab' === $_GET['page'] ) || isset( $_GET['dashboard'] ) ) : ?>
836 + <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' ); ?>">
1335 837 <i class="cog icon"></i>
1336 838 </a>
1337 839 <?php endif; ?>
1338 - <?php
1339 - // phpcs:enable
1340 - /**
1341 - * Filter: mainwp_header_actions_right
1342 - *
1343 - * Filters the MainWP header element actions.
1344 - *
1345 - * @since 4.0
1346 - */
1347 - $actions = apply_filters( 'mainwp_header_actions_right', '' );
1348 - if ( ! empty( $actions ) ) {
1349 - echo $actions; // phpcs:ignore WordPress.Security.EscapeOutput
1350 - }
1351 - ?>
840 + <?php
841 + /**
842 + * Filter: mainwp_header_actions_right
843 + *
844 + * Filters the MainWP header element actions.
845 + *
846 + * @since 4.0
847 + */
848 + $actions = apply_filters( 'mainwp_header_actions_right', '' );
849 + if ( ! empty( $actions ) ) {
850 + echo $actions;
851 + }
852 + ?>
1352 853 <a class="ui button basic icon" id="mainwp-sites-sidebar" data-inverted="" data-position="bottom right" href="#" target="_blank" data-tooltip="<?php esc_attr_e( 'Quick sites shortcuts', 'mainwp' ); ?>">
1353 854 <i class="globe icon"></i>
1354 855 </a>
1355 856
1356 - <?php $custom_theme = MainWP_Settings::get_instance()->get_current_user_theme(); ?>
1357 - <div id="mainwp-select-theme-button" class="ui button icon mainwp-selecte-theme-button" custom-theme="default" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_html_e( 'Select MainWP theme', 'mainwp' ); ?>">
1358 - <i class="palette icon"></i>
1359 - </div>
857 + <a class="ui button basic icon" id="mainwp-help-sidebar" data-inverted="" data-position="bottom right" href="#" target="_blank" data-tooltip="<?php esc_attr_e( 'Need help?', 'mainwp' ); ?>">
858 + <i class="life ring icon"></i>
859 + </a>
1360 860
861 + <a class="ui button basic icon" data-inverted="" data-position="bottom right" href="https://meta.mainwp.com/" target="_blank" data-tooltip="<?php esc_attr_e( 'MainWP Community', 'mainwp' ); ?>">
862 + <i class="discourse icon"></i>
863 + </a>
864 +
865 + <a class="ui button basic icon" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Go to your MainWP Account at MainWP.com', 'mainwp' ); ?>" target="_blank" href="https://mainwp.com/my-account/">
866 + <i class="user icon"></i>
867 + </a>
868 +
1361 869 <?php
1362 - /**
1363 - * After select theme actions.
1364 - *
1365 - * @since 4.5.2
1366 - */
1367 - do_action( 'mainwp_header_actions_after_select_themes' );
1368 - ?>
1369 - <div class="ui icon top left pointing dropdown button" id="mainwp-help-menu-icon-button">
1370 - <i class="ellipsis horizontal icon"></i>
1371 - <div class="menu">
1372 - <a class="item" id="mainwp-wp-admin-menu-item" href="<?php echo esc_url( admin_url( 'admin.php?page=Settings' ) ); ?>" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Go to MainWP Settings', 'mainwp' ); ?>">
1373 - <i class="cog icon"></i> <?php esc_html_e( 'Settings', 'mainwp' ); ?></span>
1374 - </a>
1375 - <a class="item" id="mainwp-wp-admin-menu-item" href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformation' ) ); ?>" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Go to MainWP Info', 'mainwp' ); ?>">
1376 - <i class="circle info icon"></i> <?php esc_html_e( 'Info', 'mainwp' ); ?></span>
1377 - </a>
1378 - <a class="item" id="mainwp-wp-admin-menu-item" href="<?php echo esc_url( admin_url( 'index.php' ) ); ?>" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Go to WP Admin', 'mainwp' ); ?>">
1379 - <i class="wordpress icon"></i> <?php //phpcs:ignore -- ignore wordpress icon. ?> <?php esc_html_e( 'WP Admin', 'mainwp' ); ?></span>
1380 - </a>
1381 - <a class="item" href="<?php echo wp_logout_url(); // phpcs:ignore WordPress.Security.EscapeOutput ?>" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Log out of your MainWP Dashboard', 'mainwp' ); ?>">
1382 - <i class="sign out icon"></i> <?php esc_html_e( 'Log Out', 'mainwp' ); ?></span>
1383 - </a>
1384 - <a id="mainwp-help-sidebar" class="item" data-inverted="" data-position="bottom right" href="#" target="_blank" data-tooltip="<?php esc_attr_e( 'Need help?', 'mainwp' ); ?>">
1385 - <i class="life ring icon"></i> <?php esc_html_e( 'Get Support', 'mainwp' ); ?>
1386 - </a>
1387 - <a class="item" id="mainwp-community-button" data-inverted="" data-position="bottom right" href="https://managers.mainwp.com/" target="_blank" data-tooltip="<?php esc_attr_e( 'MainWP Community', 'mainwp' ); ?>">
1388 - <i class="discourse icon"></i> <?php esc_html_e( 'Managers Community', 'mainwp' ); ?>
1389 - </a>
1390 - <a class="item" id="mainwp-account-button" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Go to your MainWP Account at MainWP.com', 'mainwp' ); ?>" target="_blank" href="https://mainwp.com/my-account/">
1391 - <i class="user icon"></i> <?php esc_html_e( 'My MainWP Account', 'mainwp' ); ?>
1392 - </a>
1393 - </div>
1394 - </div>
1395 - <script>
1396 - jQuery( document ).ready( function( $ ) {
1397 - $( '#mainwp-help-menu-icon-button' ).dropdown();
1398 - } );
1399 - </script>
1400 -
1401 - <?php
1402 -
1403 870 $all_updates = wp_get_update_data();
1404 871 if ( is_array( $all_updates ) && isset( $all_updates['counts']['total'] ) && 0 < $all_updates['counts']['total'] ) {
1405 872 ?>
1406 - <a id="mainwp-available-dashboard-updates-button" class="ui red icon button" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Your MainWP Dashboard sites needs your attention. Please check the available updates', 'mainwp' ); ?>" href="update-core.php">
873 + <a class="ui red icon button" data-inverted="" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Your MainWP Dashboard sites needs your attention. Please check the available updates', 'mainwp' ); ?>" href="update-core.php">
1407 874 <i class="exclamation triangle icon"></i>
1408 875 </a>
1409 876 <?php
1410 877 }
878 + ?>
879 + <?php if ( get_option( 'mainwp_show_usersnap', false ) ) : ?>
880 + <a class="ui button black icon" id="usersnap-bug-report-button" data-position="bottom right" data-inverted="" data-tooltip="<?php esc_attr_e( 'Click here (or use Ctrl + U keyboard shortcut) to open the Bug reporting mode.', 'mainwp' ); ?>" target="_blank" href="#">
881 + <i class="bug icon"></i>
882 + </a>
883 + <?php endif; ?>
884 + <?php
1411 885 $output = ob_get_clean();
1412 886 return $output;
1413 887 }
1414 888
@@ -1431,70 +905,47 @@
1431 905 */
1432 906 $subitems = apply_filters( 'mainwp_page_navigation', $subitems, $name_caller );
1433 907 ?>
1434 908 <div id="mainwp-page-navigation-wrapper">
1435 -
1436 - <div class="ui vertical menu mainwp-page-navigation">
909 + <div class="ui secondary green pointing menu stackable mainwp-page-navigation">
1437 910 <?php
1438 911
1439 912 if ( is_array( $subitems ) ) {
1440 913 foreach ( $subitems as $item ) {
1441 914
1442 - if ( ! is_array( $item ) ) {
1443 - continue;
1444 - }
1445 -
1446 915 if ( isset( $item['access'] ) && ! $item['access'] ) {
1447 916 continue;
1448 917 }
1449 918
1450 - $class = '';
919 + $active = '';
1451 920 if ( isset( $item['active'] ) && $item['active'] ) {
1452 - $class = 'active';
921 + $active = 'active';
1453 922 }
1454 -
1455 - if ( isset( $item['class'] ) ) {
1456 - $class = $class . ' ' . $item['class'];
1457 - }
1458 -
1459 923 $style = '';
1460 924 if ( isset( $item['style'] ) ) {
1461 - $style = $item['style'];
925 + $style = 'style="' . $item['style'] . '"';
1462 926 }
1463 927
1464 928 ?>
1465 -
1466 - <a class="<?php echo esc_attr( $class ); ?> item" style="<?php echo esc_attr( $style ); ?>" href="<?php echo esc_url( $item['href'] ); ?>">
1467 - <?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 ?>
1468 - </a>
929 + <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>
1469 930 <?php
1470 931 }
1471 932 }
1472 -
1473 - do_action( 'mainwp_page_navigation_menu' );
1474 933 ?>
1475 934 </div>
1476 -
1477 935 </div>
1478 936 <?php
1479 - $is_site = MainWP_System::is_mainwp_site_page();
1480 - if ( $is_site ) {
1481 - ?>
1482 - <div id="mainwp-site-mode-wrap">
1483 - <?php } ?>
1484 -
1485 - <?php
1486 937 }
1487 938
1488 - /**
1489 - * Method render_header()
1490 - *
1491 - * Render page title.
1492 - *
1493 - * @param string $title Page title.
1494 - *
1495 - * @return void Render page title and hidden divider html.
1496 - */
939 + /**
940 + * Method render_header()
941 + *
942 + * Render page title.
943 + *
944 + * @param string $title Page title.
945 + *
946 + * @return void Render page title and hidden divider html.
947 + */
1497 948 public static function render_header( $title = '' ) {
1498 949 self::render_top_header( array( 'title' => $title ) );
1499 950 echo '<div class="ui hidden clearing fitted divider"></div>';
1500 951 echo '<div class="wrap">';
@@ -1499,37 +950,35 @@
1499 950 echo '<div class="ui hidden clearing fitted divider"></div>';
1500 951 echo '<div class="wrap">';
1501 952 }
1502 953
1503 - /**
1504 - * Method render_footer()
1505 - *
1506 - * Render page footer.
1507 - *
1508 - * @return void Render closing tags for page container.
1509 - */
954 + /**
955 + * Method render_footer()
956 + *
957 + * Render page footer.
958 + *
959 + * @return void Render closing tags for page container.
960 + */
1510 961 public static function render_footer() {
1511 - $is_site = MainWP_System::is_mainwp_site_page();
1512 - if ( $is_site ) {
1513 - echo '</div>';
1514 - }
1515 962 echo '</div>';
1516 963 echo '</div>';
1517 964 }
1518 965
1519 - /**
1520 - * Method add_widget_box()
1521 - *
1522 - * Customize WordPress add_meta_box() function.
1523 - *
1524 - * @param mixed $id Widget ID parameter.
1525 - * @param mixed $callback Callback function.
1526 - * @param null $screen Current page.
1527 - * @param array $layout widget layout.
1528 - *
1529 - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_page_id()
1530 - */
1531 - public static function add_widget_box( $id, $callback, $screen = null, $layout = array() ) {
966 + /**
967 + * Method add_widget_box()
968 + *
969 + * Customize WordPress add_meta_box() function.
970 + *
971 + * @param mixed $id Widget ID parameter.
972 + * @param mixed $callback Callback function.
973 + * @param null $screen Current page.
974 + * @param string|null $context right|null. If 3 columns then = 'middle'.
975 + * @param null $title Widget title.
976 + * @param string $priority high|core|default|low, Default: default.
977 + *
978 + * @return void Sets Global $mainwp_widget_boxes[ $page ][ $context ][ $priority ][ $id ].
979 + */
980 + public static function add_widget_box( $id, $callback, $screen = null, $context = null, $title = null, $priority = 'default' ) { // phpcs:ignore -- complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated.
1532 981 /**
1533 982 * MainWP widget boxes array.
1534 983 *
1535 984 * @global object
@@ -1541,8 +990,18 @@
1541 990 if ( empty( $page ) ) {
1542 991 return;
1543 992 }
1544 993
994 + $overviewColumns = get_option( 'mainwp_number_overview_columns', 2 );
995 + $contexts = array( 'left', 'right' );
996 + if ( 3 == $overviewColumns ) {
997 + $contexts[] = 'middle';
998 + }
999 +
1000 + if ( null === $context || ! in_array( $context, $contexts ) ) {
1001 + $context = 'right';
1002 + }
1003 +
1545 1004 if ( ! isset( $mainwp_widget_boxes ) ) {
1546 1005 $mainwp_widget_boxes = array();
1547 1006 }
1548 1007 if ( ! isset( $mainwp_widget_boxes[ $page ] ) ) {
@@ -1547,16 +1006,58 @@
1547 1006 }
1548 1007 if ( ! isset( $mainwp_widget_boxes[ $page ] ) ) {
1549 1008 $mainwp_widget_boxes[ $page ] = array();
1550 1009 }
1010 + if ( ! isset( $mainwp_widget_boxes[ $page ][ $context ] ) ) {
1011 + $mainwp_widget_boxes[ $page ][ $context ] = array();
1012 + }
1551 1013
1014 + foreach ( array_keys( $mainwp_widget_boxes[ $page ] ) as $a_context ) {
1015 + foreach ( array( 'high', 'core', 'default', 'low' ) as $a_priority ) {
1016 + if ( ! isset( $mainwp_widget_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) {
1017 + continue;
1018 + }
1019 +
1020 + // If box previously deleted, don't add.
1021 + if ( false == $mainwp_widget_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) {
1022 + return;
1023 + }
1024 +
1025 + // If no priority given and id already present, use existing priority.
1026 + if ( empty( $priority ) ) {
1027 + $priority = $a_priority;
1028 +
1029 + /*
1030 + * Else, if we're adding to the sorted priority, we don't know the title
1031 + * or callback. Grab them from the previously added context/priority.
1032 + */
1033 + } elseif ( 'sorted' == $priority ) {
1034 + $title = $mainwp_widget_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title'];
1035 + $callback = $mainwp_widget_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback'];
1036 + }
1037 +
1038 + // An id can be in only one context.
1039 + if ( $priority != $a_priority || $context != $a_context ) {
1040 + unset( $mainwp_widget_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] );
1041 + }
1042 + }
1043 + }
1044 +
1045 + if ( ! isset( $mainwp_widget_boxes[ $page ][ $context ] ) ) {
1046 + $mainwp_widget_boxes[ $page ][ $context ] = array();
1047 + }
1048 +
1049 + if ( empty( $priority ) ) {
1050 + $priority = 'default';
1051 + }
1052 +
1552 1053 if ( empty( $title ) ) {
1553 1054 $title = 'No Title';
1554 1055 }
1555 - $mainwp_widget_boxes[ $page ][ $id ] = array(
1056 + $mainwp_widget_boxes[ $page ][ $context ][ $priority ][ $id ] = array(
1556 1057 'id' => $id,
1058 + 'title' => $title,
1557 1059 'callback' => $callback,
1558 - 'layout' => $layout,
1559 1060 );
1560 1061 }
1561 1062
1562 1063 /**
@@ -1563,183 +1064,120 @@
1563 1064 * Method do_widget_boxes()
1564 1065 *
1565 1066 * Customize WordPress do_meta_boxes() function.
1566 1067 *
1567 - * @param mixed $screen_id Current page ID.
1568 - * @param array ...$args Widget callback args.
1068 + * @param mixed $screen Current page.
1069 + * @param string|null $context right|null. If 3 columns then = 'middle'.
1070 + * @param string $object Empty string.
1569 1071 *
1570 1072 * @return void Renders widget container box.
1571 - *
1572 - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_page_id()
1573 1073 */
1574 - public static function do_widget_boxes( $screen_id, ...$args ) { // phpcs:ignore -- complex.
1074 + public static function do_widget_boxes( $screen, $context = null, $object = '' ) {
1575 1075 global $mainwp_widget_boxes;
1576 - $page = MainWP_System_Utility::get_page_id( $screen_id );
1076 + static $already_sorted = false;
1077 +
1078 + $page = MainWP_System_Utility::get_page_id( $screen );
1079 +
1577 1080 if ( empty( $page ) ) {
1578 1081 return;
1579 1082 }
1580 - $wgsorted = get_user_option( 'mainwp_widgets_sorted_' . strtolower( $page ) );
1581 1083
1582 - if ( ! empty( $wgsorted ) && is_string( $wgsorted ) ) {
1583 - $wgsorted = json_decode( $wgsorted, true );
1084 + $overviewColumns = get_option( 'mainwp_number_overview_columns', 2 );
1085 + $contexts = array( 'left', 'right' );
1086 + if ( 3 == $overviewColumns ) {
1087 + $contexts[] = 'middle';
1584 1088 }
1585 1089
1586 - $client_id = 0;
1587 - if ( 'mainwp_page_manageclients' === $page ) {
1588 - $sorted_array = is_array( $wgsorted ) ? $wgsorted : array();
1589 - $wgsorted = array();
1590 - $client_id = isset( $_GET['client_id'] ) ? intval( $_GET['client_id'] ) : 0; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
1591 - if ( ! empty( $client_id ) && is_array( $sorted_array ) && isset( $sorted_array[ $client_id ] ) ) {
1592 - $wgsorted = $sorted_array[ $client_id ];
1090 + if ( null == $context || ! in_array( $context, $contexts ) ) {
1091 + $context = 'right';
1092 + }
1093 + $sorted = get_user_option( 'mainwp_widgets_sorted_' . $page );
1094 + // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose.
1095 + if ( ! $already_sorted && $sorted ) {
1096 + foreach ( explode( ',', $sorted ) as $val ) {
1097 + list( $widget_context, $id ) = explode( ':', $val );
1098 + if ( ! empty( $widget_context ) && ! empty( $id ) ) {
1099 + self::add_widget_box( $id, null, $screen, $widget_context, null, $priority = 'sorted' );
1100 + $already_sorted = true;
1101 + }
1593 1102 }
1594 1103 }
1595 1104
1596 - $wgsorted = apply_filters( 'mainwp_do_widget_boxes_sorted', $wgsorted, $page, $client_id );
1105 + $hide_widgets = get_user_option( 'mainwp_settings_hide_widgets' );
1106 + if ( ! is_array( $hide_widgets ) ) {
1107 + $hide_widgets = array();
1108 + }
1597 1109
1598 - if ( ! is_array( $wgsorted ) ) {
1599 - $wgsorted = array();
1600 - }
1110 + if ( isset( $mainwp_widget_boxes[ $page ][ $context ] ) ) {
1111 + foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
1112 + if ( isset( $mainwp_widget_boxes[ $page ][ $context ][ $priority ] ) ) {
1113 + foreach ( (array) $mainwp_widget_boxes[ $page ][ $context ][ $priority ] as $box ) {
1114 + if ( false == $box || ! isset( $box['callback'] ) ) {
1115 + continue;
1116 + }
1601 1117
1602 - if ( 'mainwp_page_manageclients' === $page ) {
1603 - $show_widgets = get_user_option( 'mainwp_clients_show_widgets' );
1604 - } elseif ( 'toplevel_page_mainwp_tab' === $page || 'mainwp_page_managesites' === $page ) {
1605 - $show_widgets = get_user_option( 'mainwp_settings_show_widgets' );
1606 - } else {
1607 - $show_widgets = apply_filters( 'mainwp_widget_boxes_show_widgets', array(), $page );
1608 - }
1118 + // to avoid hidden widgets.
1119 + if ( in_array( $box['id'], $hide_widgets ) ) {
1120 + continue;
1121 + }
1609 1122
1610 - if ( ! is_array( $show_widgets ) ) {
1611 - $show_widgets = array();
1612 - }
1123 + echo '<div class="column grid-item" id="widget-' . esc_html( $box['id'] ) . '">' . "\n";
1124 + echo '<div class="ui segment mainwp-widget" >' . "\n";
1613 1125
1614 - if ( isset( $mainwp_widget_boxes[ $page ] ) ) {
1615 - foreach ( (array) $mainwp_widget_boxes[ $page ] as $box ) {
1616 - if ( false === $box || ! isset( $box['callback'] ) ) {
1617 - continue;
1618 - }
1126 + /**
1127 + * Action: mainwp_widget_content_top
1128 + *
1129 + * Fires at the top of widget content.
1130 + *
1131 + * @since 4.1
1132 + */
1133 + do_action( 'mainwp_widget_content_top', $box, $page );
1619 1134
1620 - // to avoid hidden widgets.
1621 - if ( isset( $show_widgets[ $box['id'] ] ) && 0 === (int) $show_widgets[ $box['id'] ] ) {
1622 - continue;
1623 - }
1135 + call_user_func( $box['callback'], $object, $box );
1624 1136
1625 - $layout = array();
1626 - if ( isset( $wgsorted[ $box['id'] ] ) ) {
1627 - $val = $wgsorted[ $box['id'] ];
1628 - if ( is_array( $val ) && isset( $val['col'] ) ) {
1629 - $layout = array(
1630 - 'col' => $val['col'],
1631 - 'row' => $val['row'],
1632 - 'size_x' => $val['size_x'],
1633 - 'size_y' => $val['size_y'],
1634 - );
1137 + /**
1138 + * Action: mainwp_widget_content_bottom
1139 + *
1140 + * Fires at the bottom of widget content.
1141 + *
1142 + * @since 4.1
1143 + */
1144 + do_action( 'mainwp_widget_content_bottom', $box, $page );
1145 +
1146 + echo "</div>\n";
1147 + echo "</div>\n";
1635 1148 }
1636 1149 }
1637 - if ( ! isset( $layout['col'] ) && isset( $box['layout'][0] ) ) {
1638 - $layout = array(
1639 - 'col' => $box['layout'][0],
1640 - 'row' => $box['layout'][1],
1641 - 'size_x' => $box['layout'][2],
1642 - 'size_y' => $box['layout'][3],
1643 - );
1644 - }
1645 - $layout_attrs_escaped = ' data-row="' . ( isset( $layout['row'] ) ? esc_attr( $layout['row'] ) : '' ) . '" data-col="' . ( isset( $layout['col'] ) ? esc_attr( $layout['col'] ) : '' ) . '" data-sizex="' . ( isset( $layout['size_x'] ) ? esc_attr( $layout['size_x'] ) : '' ) . '" data-sizey="' . ( isset( $layout['size_y'] ) ? esc_attr( $layout['size_y'] ) : '' ) . '" ';
1646 - echo '<div id="widget-' . esc_html( $box['id'] ) . '" class="ui segment mainwp-widget" ' . $layout_attrs_escaped . '>' . "\n"; //phpcs:ignore -- escaped.
1647 - call_user_func( $box['callback'], $screen_id, $args );
1648 - echo '<span class="mainwp-resize-handle"></span>' . "\n";
1649 - echo "</div>\n";
1650 -
1651 1150 }
1652 1151 }
1653 - $breakpoint = apply_filters( 'mainwp_flexible_widgets_breakpoint', 1367 );
1654 - ?>
1655 - <script type="text/javascript">
1656 - var is_mobile = false;
1657 - if( jQuery( window ).width() < <?php echo intval( $breakpoint ); ?> ) {
1658 - is_mobile = true;
1659 - }
1660 - if ( ! is_mobile ) {
1661 - var page_sortablewidgets = '<?php echo esc_js( $page ); ?>';
1662 - jQuery( document ).ready( function( $ ) {
1663 - var wgIds = [];
1664 - jQuery( ".mainwp-widget" ).each( function () {
1665 - wgIds.push( jQuery( this ).attr('id') );
1666 - } );
1667 -
1668 - jQuery( '.gridster' ).gridster( {
1669 - auto_init: true,
1670 - autogenerate_stylesheet: true,
1671 - shift_larger_widgets_down: false,
1672 - shift_widgets_up: true,
1673 - widget_selector: "div.mainwp-widget",
1674 - widget_margins: [20, 20],
1675 - widget_base_dimensions: ["auto", 20],
1676 - min_cols: 1,
1677 - max_cols: 12,
1678 - max_size_x: 12,
1679 - max_rows: 500,
1680 - avoid_overlapped_widgets: true,
1681 - collision: {
1682 - wait_for_mouseup: true
1683 - },
1684 - draggable: {
1685 - handle: '.handle-drag',
1686 - stop: function (e, ui, $widget) {
1687 - mainwp_overview_gridster_reorder(this);
1688 - }
1689 - },
1690 - resize: {
1691 - enabled: true,
1692 - handle_append_to: ".mainwp-resize-handle",
1693 - stop: function (e, ui, $widget) {
1694 - mainwp_overview_gridster_reorder(this);
1695 - }
1696 - }
1697 - } ).data('gridster');
1698 -
1699 - mainwp_overview_gridster_reorder = function( $gridObj ){
1700 - var orders = $gridObj.serialize();
1701 - var postVars = {
1702 - action:'mainwp_widgets_order',
1703 - page: page_sortablewidgets,
1704 - order:JSON.stringify(orders),
1705 - wgids: JSON.stringify(wgIds),
1706 - item_id: <?php echo intval( $client_id ); ?>
1707 - };
1708 - jQuery.post( ajaxurl, mainwp_secure_data( postVars ), function ( res ) {
1709 - } );
1710 - }
1711 - });
1712 - }
1713 - </script>
1714 - <?php
1715 1152 }
1716 1153
1717 - /**
1718 - * Method render_empty_bulk_actions()
1719 - *
1720 - * Render empty bulk actions when drop down is disabled.
1721 - */
1154 + /**
1155 + * Method render_empty_bulk_actions()
1156 + *
1157 + * Render empty bulk actions when drop down is disabled.
1158 + */
1722 1159 public static function render_empty_bulk_actions() {
1723 1160 ?>
1724 - <select class="ui disabled dropdown" id="mainwp-bulk-actions">
1725 - <option value=""><?php esc_html_e( 'Bulk Actions', 'mainwp' ); ?></option>
1726 - </select>
1161 + <?php esc_html_e( 'Bulk Actions: ', 'mainwp' ); ?>
1162 + <div class="ui disabled dropdown" id="mainwp-bulk-actions">
1163 + <?php esc_html_e( 'Bulk Actions', 'mainwp' ); ?> <i class="dropdown icon"></i>
1164 + <div class="menu"></div>
1165 + </div>
1727 1166 <button class="ui tiny basic disabled button" href="javascript:void(0)" ><?php esc_html_e( 'Apply', 'mainwp' ); ?></button>
1728 - <?php
1167 + <?php
1729 1168 }
1730 1169
1731 - /**
1732 - * Method render_modal_install_plugin_theme()
1733 - *
1734 - * Render modal window for installing plugins & themes.
1735 - *
1736 - * @param string $what Which window to render, plugin|theme.
1737 - */
1170 + /**
1171 + * Method render_modal_install_plugin_theme()
1172 + *
1173 + * Render modal window for installing plugins & themes.
1174 + *
1175 + * @param string $what Which window to render, plugin|theme.
1176 + */
1738 1177 public static function render_modal_install_plugin_theme( $what = 'plugin' ) {
1739 1178 ?>
1740 1179 <div id="plugintheme-installation-progress-modal" class="ui modal">
1741 - <i class="close icon"></i>
1742 1180 <div class="header">
1743 1181 <?php
1744 1182 if ( 'plugin' === $what ) {
1745 1183 esc_html_e( 'Plugin Installation', 'mainwp' );
@@ -1747,12 +1185,8 @@
1747 1185 esc_html_e( 'Theme Installation', 'mainwp' );
1748 1186 }
1749 1187 ?>
1750 1188 </div>
1751 - <div class="ui green progress mainwp-modal-progress">
1752 - <div class="bar"><div class="progress"></div></div>
1753 - <div class="label"></div>
1754 - </div>
1755 1189 <div class="scrolling content">
1756 1190 <?php
1757 1191 /**
1758 1192 * Action: mainwp_before_plugin_theme_install_progress
@@ -1762,9 +1196,9 @@
1762 1196 * @since 4.1
1763 1197 */
1764 1198 do_action( 'mainwp_before_plugin_theme_install_progress' );
1765 1199 ?>
1766 - <div id="plugintheme-installation-queue"></div>
1200 + <div id="plugintheme-installation-queue" ></div>
1767 1201 <?php
1768 1202 /**
1769 1203 * Action: mainwp_after_plugin_theme_install_progress
1770 1204 *
@@ -1774,100 +1208,22 @@
1774 1208 */
1775 1209 do_action( 'mainwp_after_plugin_theme_install_progress' );
1776 1210 ?>
1777 1211 </div>
1778 - <div class="actions" item-type="<?php echo esc_attr( $what ); ?>">
1779 - <?php
1780 - /**
1781 - * Action: mainwp_after_plugin_theme_install_progress
1782 - *
1783 - * Fires after the progress list in the install modal element.
1784 - *
1785 - * @since 4.1
1786 - */
1787 - do_action( 'mainwp_install_plugin_theme_modal_action', $what );
1788 - ?>
1212 + <div class="actions">
1789 1213 <div class="ui cancel button"><?php esc_html_e( 'Close', 'mainwp' ); ?></div>
1790 1214 </div>
1791 1215 </div>
1792 - <?php
1216 + <?php
1793 1217 }
1794 1218
1795 - /**
1796 - * Method render_modal_upload_icon()
1797 - *
1798 - * Render modal window for upload plugins & themes icon.
1799 - */
1800 - public static function render_modal_upload_icon() {
1801 -
1802 - ?>
1803 - <div id="mainwp-upload-custom-icon-modal" class="ui modal">
1804 - <i class="close icon"></i>
1805 - <div class="header">
1806 - <?php
1807 - esc_html_e( 'Upload Icon', 'mainwp' );
1808 - ?>
1809 - </div>
1810 - <div class="content" id="mainwp-upload-custom-icon-content">
1811 - <form action="" method="post" enctype="multipart/form-data" name="uploadicon_form" id="uploadicon_form" class="">
1812 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
1813 - <div class="ui message" id="mainwp-message-zone-upload" style="display:none;"></div>
1814 - <?php
1815 - /**
1816 - * Action: mainwp_after_upload_custom_icon
1817 - *
1818 - * Fires before the modal element.
1819 - *
1820 - * @since 4.3
1821 - */
1822 - do_action( 'mainwp_before_upload_custom_icon' );
1823 - ?>
1824 - <div class="ui form">
1825 - <div class="ui grid field">
1826 - <label class="six wide column middle aligned"><?php esc_html_e( 'Custom icon', 'mainwp' ); ?></label>
1827 - <div class="six wide column" data-tooltip="<?php esc_attr_e( 'Upload a custom icon.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1828 - <div class="ui file input">
1829 - <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' ); ?>" />
1830 - </div>
1831 - </div>
1832 - </div>
1833 - <div class="ui grid field" id="mainwp_delete_image_field">
1834 - <label class="six wide column middle aligned"></label>
1835 - <div class="six wide column">
1836 - <img class="ui tiny image" src="" /><br/>
1837 - <div class="ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, delete image.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
1838 - <input type="checkbox"id="mainwp_delete_image_chk" item-icon-id="" />
1839 - <label for="mainwp_delete_image_chk"><?php esc_html_e( 'Delete Image', 'mainwp' ); ?></label>
1840 - </div>
1841 - </div>
1842 - </div>
1843 - </div>
1844 - <?php
1845 - /**
1846 - * Action: mainwp_after_upload_custom_icon
1847 - *
1848 - * Fires after the modal element.
1849 - *
1850 - * @since 4.3
1851 - */
1852 - do_action( 'mainwp_after_upload_custom_icon' );
1853 - ?>
1854 - </form>
1855 - </div>
1856 - <div class="actions">
1857 - <div class="ui green button" uploading-icon="default" id="update_custom_icon_btn"><?php esc_html_e( 'Update', 'mainwp' ); ?></div>
1858 - </div>
1859 - </div>
1860 - <?php
1861 - }
1862 -
1863 - /**
1864 - * Method render_show_all_updates_button()
1865 - *
1866 - * Render show all updates button.
1867 - *
1868 - * @return void Render Show All Updates button html.
1869 - */
1219 + /**
1220 + * Method render_show_all_updates_button()
1221 + *
1222 + * Render show all updates button.
1223 + *
1224 + * @return void Render Show All Updates button html.
1225 + */
1870 1226 public static function render_show_all_updates_button() {
1871 1227 ?>
1872 1228 <a href="javascript:void(0)" class="ui mini button trigger-all-accordion">
1873 1229 <?php
@@ -1877,42 +1233,41 @@
1877 1233 * Filters the Show All Updates button text.
1878 1234 *
1879 1235 * @since 4.1
1880 1236 */
1881 - echo esc_html( apply_filters( 'mainwp_show_all_updates_button_text', esc_html__( 'Show All Updates', 'mainwp' ) ) );
1237 + echo esc_html( apply_filters( 'mainwp_show_all_updates_button_text', __( 'Show All Updates', 'mainwp' ) ) );
1882 1238 ?>
1883 1239 </a>
1884 1240 <?php
1885 1241 }
1886 1242
1887 - /**
1888 - * Method render_sorting_icons()
1889 - *
1890 - * Render sorting up & down icons.
1891 - *
1892 - * @return void Render Sort up & down incon html.
1893 - */
1243 + /**
1244 + * Method render_sorting_icons()
1245 + *
1246 + * Render sorting up & down icons.
1247 + *
1248 + * @return void Render Sort up & down incon html.
1249 + */
1894 1250 public static function render_sorting_icons() {
1895 1251 ?>
1896 - <i class="sort icon"></i><i class="sort up icon"></i><i class="sort down icon"></i>
1252 + <i class="sort icon"></i><i class="sort up icon"></i><i class="sort down icon">
1897 1253 <?php
1898 1254 }
1899 1255
1900 - /**
1901 - * Method render_modal_edit_notes()
1902 - *
1903 - * Render modal window for edit notes.
1904 - *
1905 - * @param string $what What modal window to render. Default = site.
1906 - *
1907 - * @return void
1908 - */
1256 + /**
1257 + * Method render_modal_edit_notes()
1258 + *
1259 + * Render modal window for edit notes.
1260 + *
1261 + * @param string $what What modal window to render. Default = site.
1262 + *
1263 + * @return void
1264 + */
1909 1265 public static function render_modal_edit_notes( $what = 'site' ) {
1910 1266 ?>
1911 - <div id="mainwp-notes-modal" class="ui modal">
1267 + <div id="mainwp-notes" class="ui modal">
1912 1268 <div class="header"><?php esc_html_e( 'Notes', 'mainwp' ); ?></div>
1913 1269 <div class="content" id="mainwp-notes-content">
1914 - <div id="mainwp-notes-status" class="ui message hidden"></div>
1915 1270 <?php
1916 1271 /**
1917 1272 * Action: mainwp_before_edit_site_note
1918 1273 *
@@ -1943,655 +1298,204 @@
1943 1298 </div>
1944 1299 <div class="actions">
1945 1300 <div class="ui grid">
1946 1301 <div class="eight wide left aligned middle aligned column">
1947 - <input type="button" class="ui green button" id="mainwp-notes-save" value="<?php esc_attr_e( 'Save Note', 'mainwp' ); ?>" style="display:none;"/>
1948 - <input type="button" class="ui green button" id="mainwp-notes-edit" value="<?php esc_attr_e( 'Edit Note', 'mainwp' ); ?>"/>
1302 + <div id="mainwp-notes-status" class="left aligned"></div>
1949 1303 </div>
1950 1304 <div class="eight wide column">
1951 - <input type="button" class="ui button" id="mainwp-notes-cancel" value="<?php esc_attr_e( 'Close', 'mainwp' ); ?>"/>
1305 + <input type="button" class="ui green button" id="mainwp-notes-save" value="<?php esc_attr_e( 'Save note', 'mainwp' ); ?>" style="display:none;"/>
1306 + <input type="button" class="ui basic green button" id="mainwp-notes-edit" value="<?php esc_attr_e( 'Edit', 'mainwp' ); ?>"/>
1307 + <input type="button" class="ui red button" id="mainwp-notes-cancel" value="<?php esc_attr_e( 'Close', 'mainwp' ); ?>"/>
1952 1308 <input type="hidden" id="mainwp-notes-websiteid" value=""/>
1953 1309 <input type="hidden" id="mainwp-notes-slug" value=""/>
1954 1310 <input type="hidden" id="mainwp-which-note" value="<?php echo esc_html( $what ); ?>"/>
1955 - <input type="hidden" id="mainwp-notes-itemid" value=""/>
1956 1311 </div>
1957 1312 </div>
1958 1313 </div>
1959 1314 </div>
1960 1315
1961 - <?php
1316 + <?php
1962 1317 }
1963 1318
1964 1319 /**
1965 - * No Sites Modal
1320 + * Method usersnap_integration()
1966 1321 *
1967 - * Renders modal window for notification when there are no connected sites.
1322 + * Integrate UserSnap.
1968 1323 *
1969 - * @return void
1324 + * @return bool True, Inject UserSnap meta data. False if $showtime is false.
1970 1325 */
1971 - public static function render_modal_no_sites_note() {
1972 - if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-no-sites-modal-notice' ) ) :
1973 - ?>
1974 - <div id="mainwp-no-sites-modal" class="ui small modal">
1975 - <div class="content" id="mainwp-no-sites-modal-content" style="text-align:center">
1976 - <div class="ui hidden divider"></div>
1977 - <div class="ui hidden divider"></div>
1978 - <h4><?php esc_html_e( 'Hi MainWP Manager, there is not anything to see here before connecting your first site.', 'mainwp' ); ?></h4>
1979 - <div class="ui hidden divider"></div>
1980 - <div class="ui hidden divider"></div>
1981 - <a href="admin.php?page=managesites&do=new" class="ui big green button"><?php esc_html_e( 'Connect Your WordPress Site', 'mainwp' ); ?></a>
1982 - <div class="ui hidden fitted divider"></div>
1983 - <small><?php printf( esc_html__( 'or you can %1$sbulk import%2$s your sites.', 'mainwp' ), '<a href="admin.php?page=managesites&do=bulknew">', '</a>' ); ?></small>
1984 - </div>
1985 - <div class="actions">
1986 - <div class="ui grid">
1987 - <div class="eight wide left aligned middle aligned column">
1988 - <a href="https://kb.mainwp.com/docs/add-site-to-your-dashboard/" class="ui basic green mini button" target="_blank"><?php esc_html_e( 'See How to Connect Sites', 'mainwp' ); ?></a>
1989 - </div>
1990 - <div class="eight wide column">
1991 - <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' ); ?>"/>
1992 - </div>
1993 - </div>
1994 - </div>
1995 - </div>
1996 - <script type="text/javascript">
1997 - jQuery( '#mainwp-no-sites-modal' ).modal( {
1998 - blurring: true,
1999 - inverted: true,
2000 - closable: false
2001 - } ).modal( 'show' );
2002 - </script>
2003 - <?php
2004 - endif;
1326 + public static function usersnap_integration() {
1327 +
1328 + $showtime = get_option( 'mainwp_show_usersnap', false );
1329 +
1330 + if ( ! $showtime ) {
1331 + return false;
1332 + }
1333 +
1334 + if ( time() > ( $showtime + 24 * 60 * 60 ) ) {
1335 + MainWP_Utility::update_option( 'mainwp_show_usersnap', 0 );
1336 + return false;
1337 + }
1338 +
1339 + echo '<script type="text/javascript">
1340 + window.onUsersnapLoad = function(api) {
1341 + api.init();
1342 + window.Usersnap = api;
1343 + }
1344 + var script = document.createElement(\'script\');
1345 + script.async = 1;
1346 + script.src = \'https://api.usersnap.com/load/0e400c4c-d713-4c62-975a-4eba2a096375.js?onload=onUsersnapLoad\';
1347 + document.getElementsByTagName(\'head\')[0].appendChild(script);
1348 +
1349 + jQuery(function() {
1350 + jQuery("#usersnap-bug-report-button").click(function() {
1351 + Usersnap.open();
1352 + return false;
1353 + });
1354 + });
1355 + </script>';
1356 + return true;
2005 1357 }
2006 1358
2007 1359 /**
2008 1360 * Method render_screen_options()
2009 1361 *
2010 - * Render modal window for Page Settings.
1362 + * Render modal window for Screen Options.
2011 1363 *
2012 1364 * @param bool $setting_page Default: True. Widgets that you want to hide in the MainWP Overview page.
2013 1365 *
2014 - * @return void Render modal window for Page Settings html.
1366 + * @return void Render modal window for Screen Options html.
2015 1367 */
2016 - public static function render_screen_options( $setting_page = true ) { // phpcs:ignore -- Current complexity is the only way to achieve desired results, pull request solutions appreciated.
1368 + public static function render_screen_options( $setting_page = true ) {
2017 1369
2018 - $default_widgets = array(
2019 - 'overview' => esc_html__( 'Updates Overview', 'mainwp' ),
2020 - 'recent_posts' => esc_html__( 'Recent Posts', 'mainwp' ),
2021 - 'recent_pages' => esc_html__( 'Recent Pages', 'mainwp' ),
2022 - 'plugins' => esc_html__( 'Plugins (Individual Site Overview page)', 'mainwp' ),
2023 - 'themes' => esc_html__( 'Themes (Individual Site Overview page)', 'mainwp' ),
2024 - 'connection_status' => esc_html__( 'Connection Status', 'mainwp' ),
2025 - 'security_issues' => esc_html__( 'Security Issues', 'mainwp' ),
2026 - 'notes' => esc_html__( 'Notes (Individual Site Overview page)', 'mainwp' ),
2027 - 'clients' => esc_html__( 'Clients', 'mainwp' ),
2028 - 'child_site_info' => esc_html__( 'Child site info (Individual Site Overview page)', 'mainwp' ),
2029 - 'client_info' => esc_html__( 'Client info (Individual Site Overview page)', 'mainwp' ),
2030 - 'non_mainwp_changes' => esc_html__( 'Non-MainWP Changes', 'mainwp' ),
2031 - 'get-started' => esc_html__( 'Get Started with MainWP', 'mainwp' ),
2032 - );
1370 + $default_widgets = array(
1371 + 'overview' => __( 'Updates Overview', 'mainwp' ),
1372 + 'recent_posts' => __( 'Recent Posts', 'mainwp' ),
1373 + 'recent_pages' => __( 'Recent Pages', 'mainwp' ),
1374 + 'plugins' => __( 'Plugins (Individual Site Overview page)', 'mainwp' ),
1375 + 'themes' => __( 'Themes (Individual Site Overview page)', 'mainwp' ),
1376 + 'connection_status' => __( 'Connection Status', 'mainwp' ),
1377 + 'security_issues' => __( 'Security Issues', 'mainwp' ),
1378 + 'notes' => __( 'Notes (Individual Site Overview page)', 'mainwp' ),
1379 + 'child_site_info' => __( 'Child site info (Individual Site Overview page)', 'mainwp' ),
1380 + );
2033 1381
2034 - $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.
1382 + $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.
2035 1383
2036 - /**
2037 - * Filter: mainwp_widgets_screen_options
2038 - *
2039 - * Filters available widgets on the Overview page allowing users to unsent unwanted widgets.
2040 - *
2041 - * @since 4.0
2042 - */
2043 - $custom_opts = apply_filters( 'mainwp_widgets_screen_options', $custom_opts );
1384 + /**
1385 + * Filter: mainwp_widgets_screen_options
1386 + *
1387 + * Filters available widgets on the Overview page allowing users to unsent unwanted widgets.
1388 + *
1389 + * @since 4.0
1390 + */
1391 + $custom_opts = apply_filters( 'mainwp_widgets_screen_options', $custom_opts );
2044 1392
2045 - if ( is_array( $custom_opts ) && 0 < count( $custom_opts ) ) {
2046 - $default_widgets = array_merge( $default_widgets, $custom_opts );
2047 - }
1393 + if ( is_array( $custom_opts ) && 0 < count( $custom_opts ) ) {
1394 + $default_widgets = array_merge( $default_widgets, $custom_opts );
1395 + }
2048 1396
2049 - $show_widgets = get_user_option( 'mainwp_settings_show_widgets' );
1397 + $hide_widgets = get_user_option( 'mainwp_settings_hide_widgets' );
1398 + if ( ! is_array( $hide_widgets ) ) {
1399 + $hide_widgets = array();
1400 + }
2050 1401
2051 - if ( ! is_array( $show_widgets ) ) {
2052 - $show_widgets = array();
2053 - }
2054 -
2055 - $sidebar_pages = array( 'ManageGroups', 'PostBulkManage', 'PostBulkAdd', 'PageBulkManage', 'PageBulkAdd', 'ThemesManage', 'ThemesInstall', 'ThemesAutoUpdate', 'PluginsManage', 'PluginsInstall', 'PluginsAutoUpdate', 'UserBulkManage', 'UserBulkAdd', 'UpdateAdminPasswords', 'Extensions' );
2056 - $sidebar_pages = apply_filters( 'mainwp_sidbar_pages', $sidebar_pages ); // deprecated filter.
2057 - $sidebar_pages = apply_filters( 'mainwp_sidebar_pages', $sidebar_pages );
2058 -
2059 - /**
2060 - * Action: mainwp_screen_options_modal_top
2061 - *
2062 - * Fires at the top of the Page Settings modal element.
2063 - *
2064 - * @since 4.1
2065 - */
2066 - do_action( 'mainwp_screen_options_modal_top' );
2067 - $which_settings = 'overview_settings';
2068 - ?>
2069 - <?php if ( ! $setting_page ) : ?>
2070 - <?php if ( isset( $_GET['page'] ) && in_array( $_GET['page'], $sidebar_pages ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended ?>
2071 - <?php
2072 - $which_settings = 'sidebar_settings';
2073 - $sidebarPosition = (int) get_user_option( 'mainwp_sidebarPosition', 1 );
2074 - $manageGroupsPage = false;
2075 - if ( isset( $_GET['page'] ) && 'ManageGroups' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
2076 - $manageGroupsPage = true;
2077 - }
2078 - ?>
2079 - <div class="ui grid field">
2080 - <label tabindex="0" class="six wide column middle aligned"><?php echo $manageGroupsPage ? esc_html__( 'Tags menu position', 'mainwp' ) : esc_html__( 'Sidebar position', 'mainwp' ); ?></label>
2081 - <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">
2082 - <select name="mainwp_sidebarPosition" id="mainwp_sidebarPosition" class="ui dropdown">
2083 - <option value="1" <?php echo ( 1 === $sidebarPosition ? 'selected' : '' ); ?>><?php esc_html_e( 'Right', 'mainwp' ); ?></option>
2084 - <option value="0" <?php echo ( 0 === $sidebarPosition ? 'selected' : '' ); ?>><?php esc_html_e( 'Left', 'mainwp' ); ?></option>
2085 - </select>
2086 - </div>
1402 + /**
1403 + * Action: mainwp_screen_options_modal_top
1404 + *
1405 + * Fires at the top of the Screen Options modal element.
1406 + *
1407 + * @since 4.1
1408 + */
1409 + do_action( 'mainwp_screen_options_modal_top' );
1410 + ?>
1411 + <div class="ui grid field">
1412 + <label class="six wide column middle aligned"><?php esc_html_e( 'Hide the Update Everything button', 'mainwp' ); ?></label>
1413 + <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">
1414 + <input type="checkbox" name="hide_update_everything" <?php echo ( ( 1 == get_option( 'mainwp_hide_update_everything' ) ) ? 'checked="true"' : '' ); ?> />
2087 1415 </div>
2088 - <?php endif; ?>
2089 - <?php endif; ?>
1416 + </div>
2090 1417 <?php
2091 - if ( isset( $_GET['page'] ) && ! in_array( $_GET['page'], $sidebar_pages ) ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
2092 - $hide_up_everything = (int) get_option( 'mainwp_hide_update_everything' );
2093 - ?>
1418 + $overviewColumns = get_option( 'mainwp_number_overview_columns', 2 );
1419 + if ( 2 != $overviewColumns && 3 != $overviewColumns ) {
1420 + $overviewColumns = 2;
1421 + }
1422 +
1423 + ?>
2094 1424 <div class="ui grid field">
2095 - <label class="six wide column middle aligned">
2096 - <?php
2097 - MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_hide_update_everything', $hide_up_everything );
2098 - esc_html_e( 'Hide the Update Everything button', 'mainwp' );
2099 - ?>
2100 - </label>
2101 - <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">
2102 - <input type="checkbox" name="hide_update_everything" <?php echo ( ( 1 === $hide_up_everything ) ? 'checked="true"' : '' ); ?> />
1425 + <label class="six wide column middle aligned"><?php esc_html_e( 'Widgets columns', 'mainwp' ); ?></label>
1426 + <div class="ten wide column">
1427 + <div class="ui radio checkbox">
1428 + <input type="radio" name="number_overview_columns" required="required" <?php echo ( 2 == $overviewColumns ? 'checked="true"' : '' ); ?> value="2">
1429 + <label><?php esc_html_e( 'Show widgets in 2 columns', 'mainwp' ); ?></label>
1430 + </div>
1431 + <div class="ui fitted hidden divider"></div>
1432 + <div class="ui radio checkbox">
1433 + <input type="radio" name="number_overview_columns" required="required" <?php echo ( 3 == $overviewColumns ? 'checked="true"' : '' ); ?> value="3">
1434 + <label><?php esc_html_e( 'Show widgets in 3 columns', 'mainwp' ); ?></label>
1435 + </div>
2103 1436 </div>
2104 1437 </div>
2105 - <?php
2106 - $indi_val = 'all';
2107 - foreach ( $default_widgets as $name => $title ) {
2108 - $_selected = '';
2109 - if ( ! isset( $show_widgets[ $name ] ) || 1 === (int) $show_widgets[ $name ] ) {
2110 - $_selected = 'checked';
2111 - continue;
2112 - }
2113 - $indi_val = '';
2114 - }
2115 - ?>
1438 +
2116 1439 <div class="ui grid field">
2117 - <label class="six wide column">
2118 - <?php
2119 - if ( $setting_page ) {
2120 - MainWP_Settings_Indicator::render_not_default_indicator( 'show_default_widgets', $indi_val );
2121 - }
2122 - esc_html_e( 'Show widgets', 'mainwp' );
2123 - ?>
2124 - </label>
1440 + <label class="six wide column"><?php esc_html_e( 'Hide unwanted widgets', 'mainwp' ); ?></label>
2125 1441 <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">
2126 1442 <ul class="mainwp_hide_wpmenu_checkboxes">
2127 - <?php
2128 - foreach ( $default_widgets as $name => $title ) {
2129 - $_selected = '';
2130 - if ( ! isset( $show_widgets[ $name ] ) || 1 === (int) $show_widgets[ $name ] ) {
2131 - $_selected = 'checked';
2132 - }
2133 - ?>
2134 - <li>
2135 - <div class="ui checkbox">
2136 - <input type="checkbox" id="mainwp_show_widget_<?php echo esc_attr( $name ); ?>" name="mainwp_show_widgets[]" <?php echo esc_html( $_selected ); ?> value="<?php echo esc_attr( $name ); ?>">
2137 - <label for="mainwp_show_widget_<?php echo esc_attr( $name ); ?>" ><?php echo esc_html( $title ); ?></label>
2138 - </div>
2139 - <input type="hidden" name="mainwp_widgets_name[]" value="<?php echo esc_attr( $name ); ?>">
2140 - </li>
2141 - <?php
1443 + <?php
1444 + foreach ( $default_widgets as $name => $title ) {
1445 + $_selected = '';
1446 + if ( in_array( $name, $hide_widgets ) ) {
1447 + $_selected = 'checked';
2142 1448 }
2143 1449 ?>
1450 + <li>
1451 + <div class="ui checkbox">
1452 + <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 ); ?>">
1453 + <label for="mainwp_hide_widget_<?php echo esc_attr( $name ); ?>" ><?php echo esc_html( $title ); ?></label>
1454 + </div>
1455 + </li>
1456 + <?php
1457 + }
1458 + ?>
2144 1459 </ul>
2145 1460 </div>
2146 1461 </div>
2147 - <?php
2148 - endif;
2149 - ?>
2150 - <input type="hidden" name="reset_overview_which_settings" value="<?php echo esc_html( $which_settings ); ?>" />
2151 - <?php
2152 - /**
2153 - * Action: mainwp_screen_options_modal_bottom
2154 - *
2155 - * Fires at the bottom of the Page Settings modal element.
2156 - *
2157 - * @since 4.1
2158 - */
2159 - do_action( 'mainwp_screen_options_modal_bottom' );
2160 - }
2161 1462
2162 - /**
2163 - * Method render_select_mainwp_themes_modal()
2164 - *
2165 - * Render modal window for mainwp themes selection.
2166 - *
2167 - * @return void Render modal window for themes selection.
2168 - */
2169 - public static function render_select_mainwp_themes_modal() {
2170 - ?>
2171 - <div class="ui modal" id="mainwp-select-mainwp-themes-modal">
2172 - <i class="close icon"></i>
2173 - <div class="header"><?php esc_html_e( 'Select MainWP Theme', 'mainwp' ); ?></div>
2174 - <div class="content ui form">
2175 - <div class="ui blue message">
2176 - <div class=""><?php printf( esc_html__( 'Did you know you can create your custom theme? %1$sSee here how to do it%2$s!', '' ), '<a href="https://kb.mainwp.com/docs/how-to-change-the-theme-for-mainwp/" target="_blank">', '</a>' ); ?></div>
2177 - </div>
2178 - <form method="POST" action="" name="mainwp_select_mainwp_themes_form" id="mainwp_select_mainwp_themes_form">
2179 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
2180 - <input type="hidden" name="wp_scr_options_nonce" value="<?php echo esc_attr( wp_create_nonce( 'MainWPSelectThemes' ) ); ?>" />
2181 - <?php
2182 - /**
2183 - * Action: mainwp_select_themes_modal_top
2184 - *
2185 - * Fires at the top of the modal.
2186 - *
2187 - * @since 4.3
2188 - */
2189 - do_action( 'mainwp_select_themes_modal_top' );
2190 -
2191 - MainWP_Settings::get_instance()->render_select_custom_themes();
2192 -
2193 - /**
2194 - * Action: mainwp_select_themes_modal_bottom
2195 - *
2196 - * Fires at the bottom of the modal.
2197 - *
2198 - * @since 4.3
2199 - */
2200 - do_action( 'mainwp_select_themes_modal_bottom' );
2201 - ?>
2202 - </div>
2203 - <div class="actions">
2204 - <div class="ui two columns grid">
2205 - <div class="left aligned column">
2206 -
2207 - </div>
2208 - <div class="ui right aligned column">
2209 - <input type="submit" class="ui green button" id="submit-select-mainwp-themes" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>" />
2210 - </div>
2211 - </div>
2212 - </div>
2213 - </form>
2214 - </div>
2215 - <?php
2216 - }
2217 -
2218 - /**
2219 - * Method render_install_extensions_promo_modal()
2220 - */
2221 - public static function render_install_extensions_promo_modal() {
2222 - $mainwp_api_key = MainWP_Api_Manager_Key::instance()->get_decrypt_master_api_key();
2223 - ?>
2224 - <div class="ui small modal" id="mainwp-install-extensions-promo-modal">
2225 - <i class="close icon"></i>
2226 - <?php if ( empty( $mainwp_api_key ) ) : ?>
2227 - <div class="header"><?php esc_html_e( 'Get MainWP Pro', 'mainwp' ); ?></div>
2228 - <div class="content">
2229 - <div class="ui header"><?php esc_html_e( 'With your MainWP Pro subscription, you get access to:', 'mainwp' ); ?></div>
1463 + <div class="ui grid field">
1464 + <label class="six wide column middle aligned"></label>
1465 + <div class="ten wide column">
1466 + <div class="ui info message">
1467 + <div class="header"><?php esc_html_e( 'Privacy Notice', 'mainwp' ); ?></div>
1468 + <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>
1469 + <p><?php esc_html_e( 'Information recorded when you take a screen shot includes:', 'mainwp' ); ?></p>
2230 1470 <div class="ui bulleted list">
2231 - <div class="item"><?php esc_html_e( 'All 30+ Existing Premium Extensions', 'mainwp' ); ?></div>
2232 - <div class="item"><?php esc_html_e( 'All Future Extensions', 'mainwp' ); ?></div>
2233 - <div class="item"><?php esc_html_e( 'Critical Security & Performance Updates', 'mainwp' ); ?></div>
2234 - <div class="item"><?php esc_html_e( 'Priority Support with Subscription', 'mainwp' ); ?></div>
2235 - <div class="item"><?php esc_html_e( 'Manage Unlimited Websites', 'mainwp' ); ?></div>
1471 + <div class="item"><?php esc_html_e( 'Screenshot', 'mainwp' ); ?></div>
1472 + <div class="item"><?php esc_html_e( 'Page URL', 'mainwp' ); ?></div>
1473 + <div class="item"><?php esc_html_e( 'Browser', 'mainwp' ); ?></div>
1474 + <div class="item"><?php esc_html_e( 'Screen Size', 'mainwp' ); ?></div>
1475 + <div class="item"><?php esc_html_e( 'Operating System', 'mainwp' ); ?></div>
1476 + <div class="item"><?php esc_html_e( 'Full Console Logs', 'mainwp' ); ?></div>
2236 1477 </div>
2237 - <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>
1478 + <p>
1479 + <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>
1480 + </p>
2238 1481 </div>
2239 - <?php else : ?>
2240 - <div class="header"><?php esc_html_e( 'Install Extensions', 'mainwp' ); ?></div>
2241 - <div class="content">
2242 - <div class="ui header"><?php esc_html_e( 'Extension not activated', 'mainwp' ); ?></div>
2243 - <div><?php esc_html_e( 'Go to the ', 'mainwp' ); ?><a href="admin.php?page=Extensions">MainWP > Extensions</a><?php esc_html_e( ' page to install and activate extensions', 'mainwp' ); ?></div>
2244 - </div>
2245 - <?php endif; ?>
1482 + </div>
2246 1483 </div>
2247 - <?php
2248 - }
2249 1484
2250 - /**
2251 - * Method render_empty_element_placeholder()
2252 - *
2253 - * Renders the content for empty elements.
2254 - *
2255 - * @param string $placeholder Placelolder text.
2256 - */
2257 - public static function render_empty_element_placeholder( $placeholder = '' ) {
2258 - ?>
2259 - <div class="ui one column grid">
2260 - <div class="middle aligned center aligned column">
2261 - <img src="<?php echo esc_url( MAINWP_PLUGIN_URL ); ?>assets/images/mainwp-widget-placeholder.png" style="max-width:200px" class="mainwp-no-results-placeholder ui middle aligned image"/>
2262 - <?php if ( '' !== $placeholder ) : ?>
2263 - <p><?php echo $placeholder; //phpcs:ignore -- requires escaped. ?></p>
2264 - <?php else : ?>
2265 - <p><?php echo esc_html__( 'Nothing to show here, check back later!', 'mainwp' ); ?></p>
2266 - <?php endif; ?>
1485 + <div class="ui grid field">
1486 + <label class="six wide column middle aligned"><?php esc_html_e( 'Show Usersnap button', 'mainwp' ); ?></label>
1487 + <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">
1488 + <input type="checkbox" name="mainwp_show_usersnap" <?php echo ( ( false != get_option( 'mainwp_show_usersnap' ) ) ? 'checked="true"' : '' ); ?> />
2267 1489 </div>
2268 1490 </div>
2269 - <?php
2270 - }
2271 -
1491 + <?php
2272 1492 /**
2273 - * Method render_modal_save_segment()
1493 + * Action: mainwp_screen_options_modal_bottom
2274 1494 *
2275 - * Render modal window.
1495 + * Fires at the bottom of the Screen Options modal element.
2276 1496 *
2277 - * @return void
1497 + * @since 4.1
2278 1498 */
2279 - public static function render_modal_save_segment() {
2280 - ?>
2281 - <div id="mainwp-common-filter-segment-modal" class="ui tiny modal">
2282 - <i class="close icon" id="mainwp-common-filter-segment-cancel"></i>
2283 - <div class="header"><?php esc_html_e( 'Save Segment', 'mainwp' ); ?></div>
2284 - <div class="content" id="mainwp-common-filter-segment-content">
2285 - <div id="mainwp-common-filter-edit-segment-status" class="ui message hidden"></div>
2286 - <div id="mainwp-common-filter-segment-edit-fields" class="ui form">
2287 - <div class="field">
2288 - <label><?php esc_html_e( 'Enter the segment name', 'mainwp' ); ?></label>
2289 - </div>
2290 - <div class="field">
2291 - <input type="text" id="mainwp-common-filter-edit-segment-name" value=""/>
2292 - </div>
2293 - </div>
2294 - <div id="mainwp-common-filter-segment-select-fields" style="display:none;">
2295 - <div class="field">
2296 - <label><?php esc_html_e( 'Select a segment', 'mainwp' ); ?></label>
2297 - </div>
2298 - <div class="field">
2299 - <div id="mainwp-common-filter-segments-lists-wrapper"></div>
2300 - </div>
2301 - </div>
2302 - </div>
2303 - <div class="actions">
2304 - <div class="ui grid">
2305 - <div class="eight wide left aligned middle aligned column">
2306 - <input type="button" class="ui green button" id="mainwp-common-filter-edit-segment-save" value="<?php esc_attr_e( 'Save', 'mainwp' ); ?>"/>
2307 - <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;"/>
2308 - <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;"/>
2309 - </div>
2310 - <div class="eight wide column">
2311 -
2312 - </div>
2313 - </div>
2314 - </div>
2315 - </div>
2316 -
2317 - <?php
2318 - }
2319 -
2320 -
2321 - /**
2322 - * Method get_default_icons().
2323 - *
2324 - * @return array icons.
2325 - */
2326 - public static function get_default_icons() {
2327 - $icons = array(
2328 - 'wordpress', //phpcs:ignore -- WP icon.
2329 - 'ambulance',
2330 - 'anchor',
2331 - 'archive',
2332 - 'award',
2333 - 'baby carriage',
2334 - 'balance scale',
2335 - 'balance scale left',
2336 - 'balance scale right',
2337 - 'bath',
2338 - 'bed',
2339 - 'beer',
2340 - 'bell',
2341 - 'bell outline',
2342 - 'bicycle',
2343 - 'binoculars',
2344 - 'birthday cake',
2345 - 'blender',
2346 - 'bomb',
2347 - 'book',
2348 - 'book dead',
2349 - 'bookmark',
2350 - 'bookmark outline',
2351 - 'briefcase',
2352 - 'broadcast tower',
2353 - 'bug',
2354 - 'building',
2355 - 'building outline',
2356 - 'bullhorn',
2357 - 'bullseye',
2358 - 'bus',
2359 - 'calculator',
2360 - 'calendar',
2361 - 'calendar alternate',
2362 - 'calendar alternate outline',
2363 - 'calendar outline',
2364 - 'camera',
2365 - 'camera retro',
2366 - 'candy cane',
2367 - 'car',
2368 - 'carrot',
2369 - 'church',
2370 - 'clipboard',
2371 - 'clipboard outline',
2372 - 'cloud',
2373 - 'coffee',
2374 - 'cog',
2375 - 'cogs',
2376 - 'compass',
2377 - 'compass outline',
2378 - 'cookie',
2379 - 'cookie bite',
2380 - 'copy',
2381 - 'copy outline',
2382 - 'cube',
2383 - 'cubes',
2384 - 'cut',
2385 - 'dice',
2386 - 'dice d20',
2387 - 'dice d6',
2388 - 'dice five',
2389 - 'dice four',
2390 - 'dice one',
2391 - 'dice six',
2392 - 'dice three',
2393 - 'dice two',
2394 - 'digital tachograph',
2395 - 'door closed',
2396 - 'door open',
2397 - 'drum',
2398 - 'drum steelpan',
2399 - 'envelope',
2400 - 'envelope open',
2401 - 'envelope open outline',
2402 - 'envelope outline',
2403 - 'eraser',
2404 - 'eye',
2405 - 'eye dropper',
2406 - 'eye outline',
2407 - 'fax',
2408 - 'feather',
2409 - 'feather alternate',
2410 - 'fighter jet',
2411 - 'file',
2412 - 'file alternate',
2413 - 'file alternate outline',
2414 - 'file outline',
2415 - 'file prescription',
2416 - 'film',
2417 - 'fire',
2418 - 'fire alternate',
2419 - 'fire extinguisher',
2420 - 'flag',
2421 - 'flag checkered',
2422 - 'flag outline',
2423 - 'flask',
2424 - 'futbol',
2425 - 'futbol outline',
2426 - 'gamepad',
2427 - 'gavel',
2428 - 'gem',
2429 - 'gem outline',
2430 - 'gift',
2431 - 'gifts',
2432 - 'glass cheers',
2433 - 'glass martini',
2434 - 'glass whiskey',
2435 - 'glasses',
2436 - 'globe',
2437 - 'graduation cap',
2438 - 'guitar',
2439 - 'hat wizard',
2440 - 'hdd',
2441 - 'hdd outline',
2442 - 'headphones',
2443 - 'headphones alternate',
2444 - 'headset',
2445 - 'heart',
2446 - 'heart broken',
2447 - 'heart outline',
2448 - 'helicopter',
2449 - 'highlighter',
2450 - 'holly berry',
2451 - 'home',
2452 - 'hospital',
2453 - 'hospital outline',
2454 - 'hourglass',
2455 - 'hourglass outline',
2456 - 'igloo',
2457 - 'image',
2458 - 'image outline',
2459 - 'images',
2460 - 'images outline',
2461 - 'industry',
2462 - 'key',
2463 - 'keyboard',
2464 - 'keyboard outline',
2465 - 'laptop',
2466 - 'leaf',
2467 - 'lemon',
2468 - 'lemon outline',
2469 - 'life ring',
2470 - 'life ring outline',
2471 - 'lightbulb',
2472 - 'lightbulb outline',
2473 - 'lock',
2474 - 'lock open',
2475 - 'magic',
2476 - 'magnet',
2477 - 'map',
2478 - 'map marker',
2479 - 'map marker alternate',
2480 - 'map outline',
2481 - 'map pin',
2482 - 'map signs',
2483 - 'marker',
2484 - 'medal',
2485 - 'medkit',
2486 - 'memory',
2487 - 'microchip',
2488 - 'microphone',
2489 - 'microphone alternate',
2490 - 'mitten',
2491 - 'mobile',
2492 - 'mobile alternate',
2493 - 'money bill',
2494 - 'money bill alternate',
2495 - 'money bill alternate outline',
2496 - 'money check',
2497 - 'money check alternate',
2498 - 'moon',
2499 - 'moon outline',
2500 - 'motorcycle',
2501 - 'mug hot',
2502 - 'newspaper',
2503 - 'newspaper outline',
2504 - 'paint brush',
2505 - 'paper plane',
2506 - 'paper plane outline',
2507 - 'paperclip',
2508 - 'paste',
2509 - 'paw',
2510 - 'pen',
2511 - 'pen alternate',
2512 - 'pen fancy',
2513 - 'pen nib',
2514 - 'pencil alternate',
2515 - 'phone',
2516 - 'phone alternate',
2517 - 'plane',
2518 - 'plug',
2519 - 'print',
2520 - 'puzzle piece',
2521 - 'ring',
2522 - 'road',
2523 - 'rocket',
2524 - 'ruler combined',
2525 - 'ruler horizontal',
2526 - 'ruler vertical',
2527 - 'satellite',
2528 - 'satellite dish',
2529 - 'save',
2530 - 'save outline',
2531 - 'school',
2532 - 'screwdriver',
2533 - 'scroll',
2534 - 'sd card',
2535 - 'search',
2536 - 'shield alternate',
2537 - 'shopping bag',
2538 - 'shopping basket',
2539 - 'shopping cart',
2540 - 'shower',
2541 - 'sim card',
2542 - 'skull crossbones',
2543 - 'sleigh',
2544 - 'snowflake',
2545 - 'snowflake outline',
2546 - 'snowplow',
2547 - 'space shuttle',
2548 - 'star',
2549 - 'star outline',
2550 - 'sticky note',
2551 - 'sticky note outline',
2552 - 'stopwatch',
2553 - 'stroopwafel',
2554 - 'subway',
2555 - 'suitcase',
2556 - 'sun',
2557 - 'sun outline',
2558 - 'tablet',
2559 - 'tablet alternate',
2560 - 'tachometer alternate',
2561 - 'tag',
2562 - 'tags',
2563 - 'taxi',
2564 - 'thumbtack',
2565 - 'ticket alternate',
2566 - 'toilet',
2567 - 'toolbox',
2568 - 'tools',
2569 - 'train',
2570 - 'tram',
2571 - 'trash',
2572 - 'trash alternate',
2573 - 'trash alternate outline',
2574 - 'tree',
2575 - 'trophy',
2576 - 'truck',
2577 - 'tv',
2578 - 'umbrella',
2579 - 'university',
2580 - 'unlock',
2581 - 'unlock alternate',
2582 - 'utensil spoon',
2583 - 'utensils',
2584 - 'wallet',
2585 - 'weight',
2586 - 'wheelchair',
2587 - 'wine glass',
2588 - 'wrench',
2589 - 'folder',
2590 - 'folder open',
2591 - 'palette',
2592 - 'server',
2593 - 'tint',
2594 - );
2595 - return $icons;
1499 + do_action( 'mainwp_screen_options_modal_bottom' );
2596 1500 }
2597 1501 }