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