PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.0.3.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.0.3.2
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / widgets / widget-mainwp-connection-status.php

widget-mainwp-connection-status.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.0.3.2, at widgets/widget-mainwp-connection-status.php

581 lines 23.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MainWP Connection Status
4 *
5 * Build the MainWP Overview page Connection Status Widget.
6 *
7 * @package MainWP/Dashboard
8 */
9
10 namespace MainWP\Dashboard;
11
12 /**
13 * Class MainWP_Connection_Status
14 *
15 * Build the Connection Status Widget.
16 */
17 class MainWP_Connection_Status {
18
19 /**
20 * Method get_class_name()
21 *
22 * @return string __CLASS__ Class Name
23 */
24 public static function get_class_name() {
25 return __CLASS__;
26 }
27
28 /**
29 * Method render()
30 *
31 * @return mixed render_sites()
32 */
33 public static function render() {
34 self::render_sites();
35 }
36
37 /**
38 * Method render_sites()
39 *
40 * Build the Connection Status Widget
41 * Displays $SYNCERRORS|$UP|$ALL.
42 *
43 * @uses \MainWP\Dashboard\MainWP_DB::query()
44 * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_by_id()
45 * @uses \MainWP\Dashboard\MainWP_DB::get_websites_by_id()
46 * @uses \MainWP\Dashboard\MainWP_DB::get_sql_search_websites_for_current_user()
47 * @uses \MainWP\Dashboard\MainWP_DB::fetch_object()
48 * @uses \MainWP\Dashboard\MainWP_DB::data_seek()
49 * @uses \MainWP\Dashboard\MainWP_DB::free_result()
50 * @uses \MainWP\Dashboard\MainWP_System_Utility::get_current_wpid()
51 * @uses \MainWP\Dashboard\MainWP_Utility::format_timestamp()
52 * @uses \MainWP\Dashboard\MainWP_Utility::get_timestamp()
53 */
54 public static function render_sites() { // phpcs:ignore -- current complexity required to achieve desired results. Pull request solutions appreciated.
55 $current_wpid = MainWP_System_Utility::get_current_wpid();
56
57 if ( $current_wpid ) {
58 $sql = MainWP_DB::instance()->get_sql_website_by_id( $current_wpid );
59 } else {
60 $sql = MainWP_DB::instance()->get_sql_websites_for_current_user();
61 }
62
63 $websites = MainWP_DB::instance()->query( $sql );
64
65 $count_connected = 0;
66 $count_disconnected = 0;
67
68 // Loop 3 times.
69 $SYNCERRORS = 0;
70 $UP = 1;
71 $ALL = 2;
72
73 $html_online_sites = '';
74 $html_other_sites = '';
75 $html_all_sites = '';
76
77 $disconnect_site_ids = array();
78
79 for ( $j = 0; $j < 3; $j++ ) {
80 MainWP_DB::data_seek( $websites, 0 );
81 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
82 if ( empty( $website ) ) {
83 continue;
84 }
85
86 $hasSyncErrors = ( '' !== $website->sync_errors );
87 $isUp = ! $hasSyncErrors;
88
89 if ( $j !== $ALL ) {
90 if ( $j === $SYNCERRORS ) {
91 if ( ! $hasSyncErrors ) {
92 continue;
93 }
94 }
95 if ( $j === $UP ) {
96 if ( ! $isUp ) {
97 continue;
98 }
99 }
100 }
101
102 $lastSyncTime = ! empty( $website->dtsSync ) ? MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $website->dtsSync ) ) : '';
103
104 ob_start();
105
106 if ( $j === $ALL ) {
107 self::render_all_item( $website, $lastSyncTime, $hasSyncErrors );
108 } elseif ( $j === $UP ) {
109 self::render_up_item( $website, $lastSyncTime );
110 } else {
111 self::render_down_item( $website, $lastSyncTime );
112 }
113
114 /**
115 * Action: mainwp_connection_status_widget_bottom
116 *
117 * Fires at the bottom of the Connection Status widget.
118 *
119 * @since 4.1
120 */
121 do_action( 'mainwp_connection_status_widget_bottom' );
122
123 $output = ob_get_clean();
124
125 if ( $j === $ALL ) {
126 $html_all_sites .= $output;
127 } elseif ( $j === $UP ) {
128 $html_online_sites .= $output;
129 ++$count_connected;
130 } elseif ( ! in_array( $website->id, $disconnect_site_ids ) ) {
131 $disconnect_site_ids[] = $website->id;
132 $html_other_sites .= $output;
133 ++$count_disconnected;
134 }
135 }
136 }
137
138 MainWP_DB::free_result( $websites );
139
140 self::render_status( $current_wpid );
141
142 if ( empty( $current_wpid ) ) {
143
144 self::render_multi_status( $count_connected, $count_disconnected );
145 } else {
146 // Get site by ID $current_wpid.
147 $site = MainWP_DB::instance()->get_website_by_id( $current_wpid );
148 self::render_current_status( $site, $count_connected );
149 }
150
151 self::render_details( $html_all_sites, $html_online_sites, $html_other_sites );
152 }
153
154 /**
155 * The renders the MainWP Overview page Connection Status Widget Header and Drop down Box.
156 *
157 * @param mixed $current_wpid Current Website ID.
158 */
159 public static function render_status( $current_wpid ) {
160 ?>
161 <div class="ui grid mainwp-widget-header">
162 <div class="twelve wide column">
163 <h3 class="ui header handle-drag">
164 <?php
165 /**
166 * Filter: mainwp_connection_status_widget_title
167 *
168 * Filters the Connection Status widget title text.
169 *
170 * @since 4.1
171 */
172 echo esc_html( apply_filters( 'mainwp_connection_status_widget_title', esc_html__( 'Connection Status', 'mainwp' ) ) );
173 ?>
174 <div class="sub header"><?php esc_html_e( 'Child sites connection status', 'mainwp' ); ?></div>
175 </h3>
176 </div>
177 <?php if ( empty( $current_wpid ) ) { ?>
178 <div class="four wide column right aligned">
179 <div id="widget-connect-status-dropdown-selector" class="ui dropdown top right pointing not-auto-init mainwp-dropdown-tab">
180 <div class="text"><?php esc_html_e( 'All Sites', 'mainwp' ); ?></div>
181 <i class="dropdown icon"></i>
182 <div class="menu">
183 <a class="item" data-tab="all-sites" data-value="all-sites" data-position="left center" data-inverted="" data-tooltip="<?php esc_attr_e( 'See all child sites', 'mainwp' ); ?>" href="#"><?php esc_html_e( 'All Sites', 'mainwp' ); ?></a>
184 <a class="item" data-tab="connected" data-value="connected" data-position="left center" data-inverted="" data-tooltip="<?php esc_attr_e( 'See all connected child sites', 'mainwp' ); ?>" href="#"><?php esc_html_e( 'Connected', 'mainwp' ); ?></a>
185 <a class="item" data-tab="disconnected" data-value="disconnected" data-position="left center" data-inverted="" data-tooltip="<?php esc_attr_e( 'See all disconnected child sites', 'mainwp' ); ?>" href="#"><?php esc_html_e( 'Disconnected', 'mainwp' ); ?></a>
186 <a class="item" data-tab="no-sites" data-value="no-sites" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Hide the child sites list', 'mainwp' ); ?>" href="#"><?php esc_html_e( 'Hide Details', 'mainwp' ); ?></a>
187 </div>
188 </div>
189 </div>
190
191 <script type="text/javascript">
192 jQuery( document ).ready( function () {
193 jQuery( '#widget-connect-status-dropdown-selector' ).dropdown( {
194 onChange: function( val ) {
195 if ( typeof( Storage ) !== 'undefined' ) {
196 localStorage.setItem( 'lsWidgetConnectStatusDropdownVal', val );
197 }
198 }
199 } );
200 if ( typeof( Storage ) !== "undefined" ) {
201 if ( val = localStorage.getItem( 'lsWidgetConnectStatusDropdownVal' ) ) {
202 jQuery( '#widget-connect-status-dropdown-selector' ).dropdown( 'set selected',val );
203 jQuery( '#widget-connect-status-dropdown-selector' ).closest( '.mainwp-widget' ).find( 'div[data-tab="' + val + '"]' ).addClass( 'active' );
204 }
205 }
206 } );
207 </script>
208
209 <?php } ?>
210 </div>
211 <?php
212 /**
213 * Action: mainwp_connection_status_widget_top
214 *
215 * Fires at the top of the Connection Status widget.
216 *
217 * @since 4.1
218 */
219 do_action( 'mainwp_connection_status_widget_top' );
220 }
221
222 /**
223 * Render the MainWP Overview page Conection Status Widget Content.
224 *
225 * @param mixed $site Site list.
226 * @param mixed $count_connected Connection Count.
227 */
228 public static function render_current_status( $site, $count_connected ) {
229 /**
230 * Action: mainwp_connection_status_widget_single_top
231 *
232 * Fires at the top of the Connection Status widget.
233 *
234 * @param object $site Object containing the child site info.
235 *
236 * @since 4.1
237 */
238 do_action( 'mainwp_connection_status_widget_single_top', $site );
239 if ( $count_connected > 0 ) :
240 ?>
241 <div class="ui grid stackable">
242 <div class="fourteen wide column">
243 <h2 class="ui header">
244 <?php if ( '1' === $site->suspended ) { ?>
245 <i class="pause yellow circle icon"></i>
246 <div class="content"><?php esc_html_e( 'Suspended', 'mainwp' ); ?></div>
247 <?php } else { ?>
248 <i class="green check icon"></i>
249 <div class="content"><?php esc_html_e( 'Connected', 'mainwp' ); ?></div>
250 <?php } ?>
251 </h2>
252 </div>
253 <div class="column two wide center aligned">
254 <div class="ui mini icon buttons">
255 <a href="<?php echo esc_url( $site->url ); ?>" class="ui mini button" target="_blank" data-tooltip="<?php esc_html_e( 'Go to the site front page', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Go to Site', 'mainwp' ); ?></a>
256 <a href="<?php echo 'admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $site->id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" class="ui mini button" target="_blank" data-tooltip="<?php esc_html_e( 'Go to the site WP Admin', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( ' Go to WP Admin', 'mainwp' ); ?></a>
257 <a href="javascript:void(0)" class="ui button mini green" siteid="<?php echo intval( $site->id ); ?>" onClick="updatesoverview_wp_sync( '<?php echo intval( $site->id ); ?>' )" data-tooltip="Sync <?php echo esc_attr( stripslashes( $site->name ) ); ?> data." data-inverted=""><?php esc_html_e( 'Sync Data', 'mainwp' ); ?></a>
258 </div>
259 </div>
260 </div>
261 <?php else : ?>
262 <div class="ui grid stackable mainwp_wp_sync" site_id="<?php echo intval( $site->id ); ?>">
263 <div class="fourteen wide column">
264 <h2 class="ui header">
265 <i class="red unlink icon"></i>
266 <div class="content"><?php esc_html_e( 'Disconnected', 'mainwp' ); ?></div>
267 </h2>
268 </div>
269 <div class="column two wide center aligned ">
270 <div class="ui mini icon buttons">
271 <a href="<?php echo esc_url( $site->url ); ?>" class="ui mini button" target="_blank" data-tooltip="<?php esc_html_e( 'Go to the site front page', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'Go to Site', 'mainwp' ); ?></a>
272 <a href="#" class="mainwp-updates-overview-reconnect-site ui mini green basic button" siteid="<?php echo intval( $site->id ); ?>" data-tooltip="Reconnect <?php echo esc_attr( stripslashes( $site->name ) ); ?>" data-inverted=""><?php esc_html_e( 'Reconnect', 'mainwp' ); ?></a>
273 </div>
274 </div>
275 </div>
276 <?php
277 endif;
278 /**
279 * Action: mainwp_connection_status_widget_single_bottom
280 *
281 * Fires at the bottom of the Connection Status widget.
282 *
283 * @param object $site Object containing the child site info.
284 *
285 * @since 4.1
286 */
287 do_action( 'mainwp_connection_status_widget_single_bottom', $site );
288 }
289
290 /**
291 * Render connection status summary section.
292 *
293 * @param int $count_connected Connected Count.
294 * @param int $count_disconnected Disconnected Count.
295 */
296 public static function render_multi_status( $count_connected, $count_disconnected ) {
297 $count_total = $count_connected + $count_disconnected;
298 ?>
299 <div class="ui two column stackable grid mainwp-widget-header">
300 <div class="ui multiple progress" id="mainwp-site-status-progress" style="width:100%" data-total="<?php echo esc_attr( $count_total ); ?>" data-value="<?php echo esc_attr( $count_connected ) . ',' . esc_attr( $count_disconnected ); ?>">
301 <div class="green bar"><div class="centered progress"></div></div>
302 <div class="red bar"><div class="centered progress"></div></div>
303 <div class="label">
304 <a href="javascript:void(0);" onclick="jQuery( '#widget-connect-status-dropdown-selector' ).dropdown( 'set selected','connected' );jQuery( '#widget-connect-status-dropdown-selector' ).closest( '.mainwp-widget' ).find( 'div[data-tab=connected]' ).addClass( 'active' );jQuery( '#widget-connect-status-dropdown-selector' ).closest( '.mainwp-widget' ).find( 'div[data-tab=disconnected]' ).removeClass( 'active' );"><?php echo esc_html( $count_connected ) . ' Connected'; ?></a> - <a href="javascript:void(0);" onclick="jQuery( '#widget-connect-status-dropdown-selector' ).dropdown( 'set selected','disconnected' );jQuery( '#widget-connect-status-dropdown-selector' ).closest( '.mainwp-widget' ).find( 'div[data-tab=disconnected]' ).addClass( 'active' );jQuery( '#widget-connect-status-dropdown-selector' ).closest( '.mainwp-widget' ).find( 'div[data-tab=connected]' ).removeClass( 'active' );"><?php echo esc_html( $count_disconnected ) . ' Disconnected'; ?></a>
305 </div>
306 </div>
307 </div>
308 <script type="text/javascript">
309 jQuery('#mainwp-site-status-progress').progress();
310 </script>
311 <?php
312 }
313
314 /**
315 * Render See All Sites List.
316 *
317 * @param mixed $html_all_sites All sites html.
318 * @param mixed $html_online_sites Online sites html.
319 * @param mixed $html_other_sites Other sites html.
320 */
321 public static function render_details( $html_all_sites, $html_online_sites, $html_other_sites ) {
322 ?>
323 <div class="mainwp-scrolly-overflow">
324 <div class="ui tab" data-tab="all-sites">
325 <?php
326 /**
327 * Action: mainwp_connection_status_before_all_sites_list
328 *
329 * Fires before the list of all sites in the connection status widgets
330 *
331 * @since 4.1
332 */
333 do_action( 'mainwp_connection_status_before_all_sites_list' )
334 ?>
335 <div class="ui middle aligned divided selection list">
336 <?php echo $html_all_sites; // phpcs:ignore WordPress.Security.EscapeOutput ?>
337 </div>
338 <?php
339 /**
340 * Action: mainwp_connection_status_after_all_sites_list
341 *
342 * Fires after the list of all sites in the connection status widgets
343 *
344 * @since 4.1
345 */
346 do_action( 'mainwp_connection_status_after_all_sites_list' )
347 ?>
348 </div>
349
350 <div class="ui tab" data-tab="connected">
351 <?php
352 /**
353 * Action: mainwp_connection_status_before_connected_sites_list
354 *
355 * Fires before the list of connected sites in the connection status widgets
356 *
357 * @since 4.1
358 */
359 do_action( 'mainwp_connection_status_before_connected_sites_list' )
360 ?>
361 <div class="ui middle aligned divided selection list">
362 <?php echo $html_online_sites; // phpcs:ignore WordPress.Security.EscapeOutput ?>
363 </div>
364 <?php
365 /**
366 * Action: mainwp_connection_status_after_connected_sites_list
367 *
368 * Fires after the list of connected sites in the connection status widgets
369 *
370 * @since 4.1
371 */
372 do_action( 'mainwp_connection_status_after_connected_sites_list' )
373 ?>
374 </div>
375
376 <div class="ui tab" data-tab="disconnected">
377 <?php
378 /**
379 * Action: mainwp_connection_status_before_disconnected_sites_list
380 *
381 * Fires before the list of disconnected sites in the connection status widgets
382 *
383 * @since 4.1
384 */
385 do_action( 'mainwp_connection_status_before_disconnected_sites_list' )
386 ?>
387 <div class="ui middle aligned divided selection list">
388 <?php echo $html_other_sites; // phpcs:ignore WordPress.Security.EscapeOutput ?>
389 </div>
390 <?php
391 /**
392 * Action: mainwp_connection_status_after_disconnected_sites_list
393 *
394 * Fires after the list of disconnected sites in the connection status widgets
395 *
396 * @since 4.1
397 */
398 do_action( 'mainwp_connection_status_after_disconnected_sites_list' )
399 ?>
400 </div>
401 <div class="ui tab" data-tab="no-sites"></div>
402 </div>
403 <?php
404 }
405
406
407 /**
408 * Render all items list.
409 *
410 * @param mixed $website Website Info.
411 * @param mixed $lastSyncTime Last time the Child Site was synced to.
412 * @param mixed $hasSyncErrors Collected errors.
413 */
414 public static function render_all_item( $website, $lastSyncTime, $hasSyncErrors ) {
415 $is_demo = MainWP_Demo_Handle::is_demo_mode();
416 ?>
417 <div class="item mainwp_wp_sync" site_id="<?php echo intval( $website->id ); ?>" site_name="<?php echo esc_attr( rawurlencode( $website->name ) ); ?>">
418 <div class="ui stackable grid">
419 <div class="twelve wide column middle aligned">
420 <div>
421 <a href="
422 <?php
423 /**
424 * Filter: mainwp_connection_status_list_item_title_url
425 *
426 * Filters the Connection Status widget list item title URL.
427 *
428 * @since 4.1
429 */
430 echo esc_url( apply_filters( 'mainwp_connection_status_list_item_title_url', 'admin.php?page=managesites&dashboard=' . $website->id, $website ) );
431 ?>
432 ">
433 <?php
434 /**
435 * Filter: mainwp_connection_status_list_item_title
436 *
437 * Filters the Connection Status widget list item title text.
438 *
439 * @since 4.1
440 */
441 echo esc_html( stripslashes( apply_filters( 'mainwp_connection_status_list_item_title', $website->name, $website ) ) );
442 ?>
443 </a>
444 </div>
445 <span class="ui small text"><?php esc_html_e( 'Last Synced: ', 'mainwp' ); ?> <?php echo esc_html( $lastSyncTime ); ?></span>
446 </div>
447 <div class="four wide middle aligned column reconnect-wrapper">
448 <div class="ui mini icon fluid buttons">
449 <?php if ( $is_demo ) : ?>
450 <a class="ui button" href="<?php echo esc_html( $website->url ) . 'wp-admin.html'; ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site WP Admin', 'mainwp' ); ?>" data-inverted=""><i class="sign in alternate icon"></i></a>
451 <?php else : ?>
452 <a class="ui button" href="<?php echo 'admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $website->id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site WP Admin', 'mainwp' ); ?>" data-inverted="" data-position="left center"><i class="sign in alternate icon"></i></a>
453 <?php endif; ?>
454 <a class="ui button" href="<?php echo esc_html( $website->url ); ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site front page', 'mainwp' ); ?>" data-inverted="" data-position="left center"><i class="external alternate icon"></i></a>
455 <?php if ( $hasSyncErrors ) : ?>
456 <a href="javascript:void(0)" class="mainwp-updates-overview-reconnect-site ui button green basic" siteid="<?php echo intval( $website->id ); ?>" data-tooltip="Reconnect <?php echo esc_html( stripslashes( $website->name ) ); ?>" data-inverted="" data-position="left center"><i class="linkify icon"></i></a>
457 <?php else : ?>
458 <a href="javascript:void(0)" class="ui button green" siteid="<?php echo intval( $website->id ); ?>" onClick="updatesoverview_wp_sync( '<?php echo intval( $website->id ); ?>' )" data-tooltip="Sync <?php echo esc_html( stripslashes( $website->name ) ); ?> data" data-inverted="" data-position="left center"><i class="sync alternate icon"></i></a>
459 <?php endif; ?>
460 </div>
461 </div>
462 </div>
463 </div>
464 <?php
465 }
466
467 /**
468 * Render Connected Sites List.
469 *
470 * @param object $website Object containing the child site info.
471 * @param string $lastSyncTime Last time the Child Site was synced to.
472 */
473 public static function render_up_item( $website, $lastSyncTime ) {
474 $is_demo = MainWP_Demo_Handle::is_demo_mode();
475 ?>
476 <div class="item mainwp_wp_sync" site_id="<?php echo intval( $website->id ); ?>" site_name="<?php echo esc_attr( rawurlencode( $website->name ) ); ?>">
477 <div class="ui stackable grid">
478 <div class="six wide column middle aligned">
479 <a href="
480 <?php
481 /**
482 * Filter: mainwp_connection_status_list_item_title_url
483 *
484 * Filters the Connection Status widget list item title URL.
485 *
486 * @since 4.1
487 */
488 echo esc_url( apply_filters( 'mainwp_connection_status_list_item_title_url', 'admin.php?page=managesites&dashboard=' . $website->id, $website ) );
489 ?>
490 ">
491 <?php
492 /**
493 * Filter: mainwp_connection_status_list_item_title
494 *
495 * Filters the Connection Status widget list item title text.
496 *
497 * @since 4.1
498 */
499 echo esc_html( stripslashes( apply_filters( 'mainwp_connection_status_list_item_title', $website->name, $website ) ) );
500 ?>
501 </a>
502 </div>
503 <div class="one wide column middle aligned">
504 <?php if ( $is_demo ) : ?>
505 <a class="ui button" href="<?php echo esc_html( $website->url ) . 'wp-admin.html'; ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site WP Admin', 'mainwp' ); ?>" data-inverted=""><i class="sign in alternate icon"></i></a>
506 <?php else : ?>
507 <a href="<?php echo 'admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $website->id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site WP Admin', 'mainwp' ); ?>" data-inverted=""><i class="sign in alternate icon"></i></a>
508 <?php endif; ?>
509 </div>
510 <div class="one wide column middle aligned">
511 <a href="<?php echo esc_html( $website->url ); ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site front page', 'mainwp' ); ?>" data-inverted=""><i class="external alternate icon"></i></a>
512 </div>
513 <div class="four wide column middle aligned">
514 <span><?php echo esc_attr( $lastSyncTime ); ?></span>
515 </div>
516 <div class="four wide column middle aligned">
517 <a href="javascript:void(0)" class="ui button mini green" siteid="<?php echo intval( $website->id ); ?>" onClick="updatesoverview_wp_sync( '<?php echo intval( $website->id ); ?>' )" data-tooltip="Sync <?php echo esc_html( stripslashes( $website->name ) ); ?> data." data-inverted=""><?php esc_html_e( 'Sync Data', 'mainwp' ); ?></a>
518 </div>
519 </div>
520 </div>
521 <?php
522 }
523
524 /**
525 * Render Disconected Sites List.
526 *
527 * @param object $website Object containing the child site info.
528 * @param string $lastSyncTime Last time the Child Site was synced to.
529 */
530 public static function render_down_item( $website, $lastSyncTime ) {
531 $is_demo = MainWP_Demo_Handle::is_demo_mode();
532 ?>
533 <div class="item mainwp_wp_sync" site_id="<?php echo intval( $website->id ); ?>" site_name="<?php echo esc_attr( rawurlencode( $website->name ) ); ?>">
534 <div class="ui stackable grid">
535 <div class="six wide column middle aligned">
536 <a href="
537 <?php
538 /**
539 * Filter: mainwp_connection_status_list_item_title_url
540 *
541 * Filters the Connection Status widget list item title URL.
542 *
543 * @since 4.1
544 */
545 echo esc_url( apply_filters( 'mainwp_connection_status_list_item_title_url', 'admin.php?page=managesites&dashboard=' . $website->id, $website ) );
546 ?>
547 ">
548 <?php
549 /**
550 * Filter: mainwp_connection_status_list_item_title
551 *
552 * Filters the Connection Status widget list item title text.
553 *
554 * @since 4.1
555 */
556 echo esc_attr( stripslashes( apply_filters( 'mainwp_connection_status_list_item_title', $website->name, $website ) ) );
557 ?>
558 </a>
559 </div>
560 <div class="one wide column middle aligned">
561 <?php if ( $is_demo ) : ?>
562 <a class="ui button" href="<?php echo esc_html( $website->url ) . 'wp-admin.html'; ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site WP Admin', 'mainwp' ); ?>" data-inverted=""><i class="sign in alternate icon"></i></a>
563 <?php else : ?>
564 <a href="<?php echo 'admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $website->id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site WP Admin', 'mainwp' ); ?>" data-inverted=""><i class="sign in alternate icon"></i></a>
565 <?php endif; ?>
566 </div>
567 <div class="one wide column middle aligned">
568 <a href="<?php echo esc_html( $website->url ); ?>" target="_blank" data-tooltip="<?php esc_attr_e( 'Go to the site front page', 'mainwp' ); ?>" data-inverted=""><i class="external alternate icon"></i></a>
569 </div>
570 <div class="four wide column middle aligned">
571 <span><?php echo esc_attr( $lastSyncTime ); ?></span>
572 </div>
573 <div class="four wide column middle aligned reconnect-wrapper">
574 <a href="#" class="mainwp-updates-overview-reconnect-site" siteid="<?php echo intval( $website->id ); ?>" data-tooltip="Reconnect <?php echo esc_html( stripslashes( $website->name ) ); ?>" data-inverted=""><?php esc_html_e( 'Reconnect', 'mainwp' ); ?></a>
575 </div>
576 </div>
577 </div>
578 <?php
579 }
580 }
581