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