PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | pages/page-mainwp-overview.php +122 -112 5.2 → 6.2.1 View file →
@@ -1,13 +1,18 @@
1 1 <?php
2 2 /**
3 3 * MainWP Overview Page.
4 4 *
5 - * @package MainWP/Dashboard
5 + * @package MainWP/Dashboard
6 6 */
7 7
8 8 namespace MainWP\Dashboard;
9 9
10 +// Exit if accessed directly.
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
14 +
10 15 /**
11 16 * Class MainWP_Overview
12 17 *
13 18 * @package MainWP\Dashboard
@@ -42,17 +47,18 @@
42 47 *
43 48 * @var array $enable_widgets
44 49 */
45 50 private static $enable_widgets = array(
46 - 'overview' => true,
47 - 'connection_status' => true,
48 - 'recent_posts' => true,
49 - 'recent_pages' => true,
50 - 'security_issues' => true,
51 - 'backup_tasks' => true,
52 - 'non_mainwp_changes' => true,
53 - 'clients' => true,
54 - 'get-started' => true,
51 + 'overview' => true,
52 + 'connection_status' => true,
53 + 'uptime_monitoring_status' => true,
54 + 'recent_posts' => true,
55 + 'recent_pages' => true,
56 + 'security_issues' => true,
57 + 'backup_tasks' => true,
58 + 'non_mainwp_changes' => true,
59 + 'clients' => true,
60 + 'get-started' => true,
55 61 );
56 62
57 63 /**
58 64 * Check if there is a session,
@@ -136,9 +142,9 @@
136 142
137 143 add_submenu_page(
138 144 'mainwp_tab',
139 145 'MainWP',
140 - __( 'Overview', 'mainwp' ),
146 + __( 'Operations', 'mainwp' ),
141 147 'read',
142 148 'mainwp_tab',
143 149 array(
144 150 $this,
@@ -163,9 +169,9 @@
163 169 */
164 170 public static function init_left_menu() {
165 171 MainWP_Menu::add_left_menu(
166 172 array(
167 - 'title' => esc_html__( 'Overview', 'mainwp' ),
173 + 'title' => esc_html__( 'Operations', 'mainwp' ),
168 174 'parent_key' => 'mainwp_tab',
169 175 'slug' => 'mainwp_tab',
170 176 'href' => 'admin.php?page=mainwp_tab',
171 177 'icon' => '<i class="th large icon"></i>',
@@ -209,9 +215,9 @@
209 215
210 216 /**
211 217 * Get getmetaboxes
212 218 *
213 - * Adds metaboxes (widgets) to the Overview page.
219 + * Adds metaboxes (widgets) to the Operations page.
214 220 *
215 221 * @since Unknown
216 222 */
217 223 $extMetaBoxs = MainWP_System_Handler::instance()->apply_filters( 'mainwp-getmetaboxes', array() );
@@ -238,68 +244,66 @@
238 244 */
239 245 $values = apply_filters( 'mainwp_overview_enabled_widgets', $values, null );
240 246 static::$enable_widgets = array_merge( static::$enable_widgets, $values );
241 247
242 - $i = 1;
243 - foreach ( $extMetaBoxs as $metaBox ) {
244 - $enabled = true;
245 - if ( isset( $metaBox['plugin'] ) ) {
246 - $name = basename( $metaBox['plugin'], '.php' );
247 - if ( isset( static::$enable_widgets[ $name ] ) && ! static::$enable_widgets[ $name ] ) {
248 - $enabled = false;
249 - }
250 - }
248 + // Load the Updates Overview widget.
249 + if ( static::$enable_widgets['overview'] ) {
250 + MainWP_UI::add_widget_box( 'overview', array( MainWP_Updates_Overview::get_class_name(), 'render' ), $page, array( 0, 0, 12, 20 ) );
251 + }
251 252
252 - $id = isset( $metaBox['id'] ) ? $metaBox['id'] : $i++;
253 - $id = 'advanced-' . $id;
254 -
255 - if ( $enabled ) {
256 - if ( 'google-widget' === $id || 'matomo' === $id ) {
257 - MainWP_UI::add_widget_box( $id, $metaBox['callback'], $page, array( 1, 1, 4, 18 ) );
258 - } else {
259 - MainWP_UI::add_widget_box( $id, $metaBox['callback'], $page, array( 1, 1, 4, 11 ) );
260 - }
261 - }
253 + // Load the Clients widget.
254 + if ( static::$enable_widgets['clients'] && \mainwp_current_user_can( 'dashboard', 'manage_clients' ) ) {
255 + MainWP_UI::add_widget_box( 'clients', array( MainWP_Clients::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) );
262 256 }
263 257
264 - // Load the Updates Overview widget.
265 - if ( static::$enable_widgets['get-started'] ) {
266 - MainWP_UI::add_widget_box( 'get-started', array( MainWP_Get_Started::get_class_name(), 'render' ), $page, array( 1, 1, 4, 11 ) );
258 + // Load the Non-MainWP Changes widget.
259 + if ( static::$enable_widgets['non_mainwp_changes'] ) {
260 + MainWP_UI::add_widget_box( 'non_mainwp_changes', array( MainWP_Site_Actions::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) );
267 261 }
268 262
269 - // Load the Recent Posts widget.
270 - if ( mainwp_current_user_have_right( 'dashboard', 'manage_posts' ) && static::$enable_widgets['recent_posts'] ) {
271 - MainWP_UI::add_widget_box( 'recent_posts', array( MainWP_Recent_Posts::get_class_name(), 'render' ), $page, array( 1, 1, 6, 11 ) );
263 + // Load the Connection Status widget.
264 + if ( ! MainWP_System_Utility::get_current_wpid() && static::$enable_widgets['connection_status'] ) {
265 + MainWP_UI::add_widget_box( 'connection_status', array( MainWP_Connection_Status::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) );
272 266 }
273 267
274 - // Load the Recent Pages widget.
275 - if ( mainwp_current_user_have_right( 'dashboard', 'manage_pages' ) && static::$enable_widgets['recent_pages'] ) {
276 - MainWP_UI::add_widget_box( 'recent_pages', array( MainWP_Recent_Pages::get_class_name(), 'render' ), $page, array( 1, 1, 6, 11 ) );
268 + // Load the Connection Status widget.
269 + if ( MainWP_Uptime_Monitoring_Edit::is_enable_global_monitoring() && ! MainWP_System_Utility::get_current_wpid() && static::$enable_widgets['uptime_monitoring_status'] ) {
270 + MainWP_UI::add_widget_box( 'uptime_monitoring_status', array( MainWP_Uptime_Monitoring_Status::get_class_name(), 'render_status' ), $page, array( -1, -1, 4, 30 ) );
277 271 }
278 272
279 273 // Load the Security Issues widget.
280 - if ( mainwp_current_user_have_right( 'dashboard', 'manage_security_issues' ) && static::$enable_widgets['security_issues'] ) {
281 - MainWP_UI::add_widget_box( 'security_issues', array( MainWP_Security_Issues_Widget::get_class_name(), 'render_widget' ), $page, array( 1, 1, 4, 4 ) );
274 + if ( \mainwp_current_user_can( 'dashboard', 'manage_security_issues' ) && static::$enable_widgets['security_issues'] ) {
275 + MainWP_UI::add_widget_box( 'security_issues', array( MainWP_Security_Issues_Widget::get_class_name(), 'render_widget' ), $page, array( -1, -1, 4, 30 ) );
282 276 }
283 277
284 - // Load the Connection Status widget.
285 - if ( ! MainWP_System_Utility::get_current_wpid() && static::$enable_widgets['connection_status'] ) {
286 - MainWP_UI::add_widget_box( 'connection_status', array( MainWP_Connection_Status::get_class_name(), 'render' ), $page, array( 1, 1, 4, 5 ) );
278 + // Load the Recent Pages widget.
279 + if ( \mainwp_current_user_can( 'dashboard', 'manage_pages' ) && static::$enable_widgets['recent_pages'] ) {
280 + MainWP_UI::add_widget_box( 'recent_pages', array( MainWP_Recent_Pages::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) );
287 281 }
288 282
289 - // Load the Non-MainWP Changes widget.
290 - if ( static::$enable_widgets['non_mainwp_changes'] ) {
291 - MainWP_UI::add_widget_box( 'non_mainwp_changes', array( MainWP_Site_Actions::get_class_name(), 'render' ), $page, array( 1, 1, 4, 18 ) );
283 + // Load the Recent Posts widget.
284 + if ( \mainwp_current_user_can( 'dashboard', 'manage_posts' ) && static::$enable_widgets['recent_posts'] ) {
285 + MainWP_UI::add_widget_box( 'recent_posts', array( MainWP_Recent_Posts::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) );
292 286 }
293 287
294 - // Load the Clients widget.
295 - if ( static::$enable_widgets['clients'] ) {
296 - MainWP_UI::add_widget_box( 'clients', array( MainWP_Clients::get_class_name(), 'render' ), $page, array( 1, 1, 4, 9 ) );
297 - }
288 + $i = 1;
289 + foreach ( $extMetaBoxs as $metaBox ) {
290 + $enabled = true;
291 + if ( isset( $metaBox['plugin'] ) ) {
292 + $name = basename( $metaBox['plugin'], '.php' );
293 + if ( isset( static::$enable_widgets[ $name ] ) && ! static::$enable_widgets[ $name ] ) {
294 + $enabled = false;
295 + }
296 + }
298 297
299 - // Load the Updates Overview widget.
300 - if ( static::$enable_widgets['overview'] ) {
301 - MainWP_UI::add_widget_box( 'overview', array( MainWP_Updates_Overview::get_class_name(), 'render' ), $page, array( 1, 1, 4, 18 ) );
298 + $id = isset( $metaBox['id'] ) ? $metaBox['id'] : $i++;
299 + $id = 'advanced-' . $id;
300 +
301 + $wg_layout = isset( $metaBox['layout'] ) && is_array( $metaBox['layout'] ) ? $metaBox['layout'] : array( -1, -1, 6, 30 );
302 +
303 + if ( $enabled ) {
304 + MainWP_UI::add_widget_box( $id, $metaBox['callback'], $page, $wg_layout );
305 + }
302 306 }
303 307 }
304 308
305 309 /**
@@ -310,10 +314,10 @@
310 314 * @uses \MainWP\Dashboard\MainWP_UI::render_top_header()
311 315 * @uses \MainWP\Dashboard\MainWP_UI::render_second_top_header()
312 316 */
313 317 public function on_show_page() {
314 - if ( ! mainwp_current_user_have_right( 'dashboard', 'access_global_dashboard' ) ) {
315 - mainwp_do_not_have_permissions( esc_html__( 'global dashboard', 'mainwp' ) );
318 + if ( ! \mainwp_current_user_can( 'dashboard', 'access_global_dashboard' ) ) {
319 + \mainwp_do_not_have_permissions( esc_html__( 'global dashboard', 'mainwp' ) );
316 320 return;
317 321 }
318 322
319 323 /**
@@ -323,9 +327,9 @@
323 327 */
324 328 global $screen_layout_columns;
325 329
326 330 $params = array(
327 - 'title' => esc_html__( 'Overview', 'mainwp' ),
331 + 'title' => esc_html__( 'Operations', 'mainwp' ),
328 332 );
329 333
330 334 MainWP_UI::render_top_header( $params );
331 335
@@ -356,63 +360,69 @@
356 360 if ( ! empty( $current_wp_id ) ) {
357 361 $website = $websites[0];
358 362 }
359 363 $screen = get_current_screen();
360 -
361 - MainWP_Demo_Handle::get_instance()->init_data_demo();
362 364 ?>
363 365 <div class="mainwp-primary-content-wrap">
364 - <div class="ui segment" style="padding-top:0px;padding-bottom:0px;margin-bottom:0px;">
365 - <div id="mainwp-dashboard-info-box"></div>
366 - <?php
367 - if ( ! empty( $current_wp_id ) && ! empty( $website->sync_errors ) ) {
366 + <div class="ui segment">
367 + <?php if ( ! empty( $current_wp_id ) && ! empty( $website->sync_errors ) ) : ?>
368 + <div class="ui red message" style="margin: 1em;">
369 + <?php echo '<strong>' . esc_html( stripslashes( $website->name ) ) . '</strong>' . esc_html__( ' is Disconnected. Click the Reconnect button to establish the connection again.', 'mainwp' ); ?>
370 + </div>
371 + <?php endif; ?>
372 + <div id="mainwp-message-zone" class="ui message" style="display:none;"></div>
373 + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'widgets' ) ) : ?>
374 + <div class="ui message" style="margin: 1em;">
375 + <i class="close icon mainwp-notice-dismiss" notice-id="widgets"></i>
376 + <?php /* translators: 1: bulb emoji, 2: cog icon, 3: layout icon */ printf( esc_html__( '%1$s Tip: You can drag and drop widgets to reorder your dashboard, use Page Settings (%2$s) to show or hide widgets, and use Layout (%3$s) in the header to save and load your widget layouts.', 'mainwp' ), '<em data-emoji=":bulb:" class="small"></em>', '<i class="cog fitted icon"></i>', '<i class="all border fitted icon"></i>' ); ?>
377 + </div>
378 + <?php endif; ?>
379 + <?php do_action( 'mainwp_module_log_render_db_update_notice' ); ?>
380 + <?php do_action( 'mainwp_module_log_render_db_size_notice', 300, 'overview' ); ?>
381 +
382 + <?php
383 + /**
384 + * Action: mainwp_before_overview_widgets
385 + *
386 + * Fires at the top of the Operations page (before first widget).
387 + *
388 + * @since 4.1
389 + */
390 + do_action( 'mainwp_before_overview_widgets', 'dashboard', $current_wp_id, $website );
368 391 ?>
369 - <div class="ui red message">
370 - <p><?php echo '<strong>' . esc_html( stripslashes( $website->name ) ) . '</strong>' . esc_html__( ' is Disconnected. Click the Reconnect button to establish the connection again.', 'mainwp' ); ?></p>
392 + <div id="mainwp-grid-wrapper" class="gridster">
393 + <div id="mainwp-widgets-placeholder" class="ui page dimmer">
394 + <div class="ui double text loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div>
395 + </div>
396 + <script>
397 + jQuery( document ).ready( function () {
398 + jQuery('#mainwp-widgets-placeholder').dimmer('show');
399 + });
400 + </script>
401 + <?php MainWP_UI::do_widget_boxes( $screen->id ); ?>
371 402 </div>
372 403 <?php
373 - }
374 - ?>
375 - <div id="mainwp-message-zone" class="ui message" style="display:none;"></div>
376 - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'widgets' ) ) : ?>
377 - <div class="ui info message">
378 - <i class="close icon mainwp-notice-dismiss" notice-id="widgets"></i>
379 - <?php printf( esc_html__( 'To hide or show a widget, click the Cog (%1$s) icon.', 'mainwp' ), '<i class="cog icon"></i>' ); ?>
380 - </div>
381 - <?php endif; ?>
404 + /**
405 + * Action: 'mainwp_after_overview_widgets'
406 + *
407 + * Fires at the bottom of the Operations page (after the last widget).
408 + *
409 + * @since 4.1
410 + */
411 + do_action( 'mainwp_after_overview_widgets', 'dashboard' );
412 + ?>
382 413 </div>
383 - <?php
384 - /**
385 - * Action: mainwp_before_overview_widgets
386 - *
387 - * Fires at the top of the Overview page (before first widget).
388 - *
389 - * @since 4.1
390 - */
391 - do_action( 'mainwp_before_overview_widgets', 'dashboard' );
392 - ?>
393 - <div id="mainwp-grid-wrapper" class="gridster">
394 - <?php MainWP_UI::do_widget_boxes( $screen->id ); ?>
395 - </div>
396 - <?php
397 - /**
398 - * Action: 'mainwp_after_overview_widgets'
399 - *
400 - * Fires at the bottom of the Overview page (after the last widget).
401 - *
402 - * @since 4.1
403 - */
404 - do_action( 'mainwp_after_overview_widgets', 'dashboard' );
405 - ?>
406 - <script type="text/javascript">
407 - jQuery( document ).ready( function( $ ) {
408 - jQuery( '.mainwp-widget .mainwp-dropdown-tab .item' ).tab();
409 - mainwp_get_icon_start();
410 - } );
411 - </script>
414 + <script type="text/javascript">
415 + jQuery( document ).ready( function( $ ) {
416 + jQuery( '.mainwp-widget .mainwp-dropdown-tab .item' ).tab();
417 + mainwp_get_icon_start();
418 + } );
419 + </script>
412 420 <?php
421 + MainWP_Ui_Manage_Widgets_Layout::render_modal_save_layout();
413 422 MainWP_UI::render_modal_upload_icon();
414 423 MainWP_Updates::render_plugin_details_modal();
424 + MainWP_Updates::render_changes_history_modal();
415 425 }
416 426
417 427 /**
418 428 * Method mainwp_help_content()
@@ -423,19 +433,19 @@
423 433 if ( isset( $_GET['page'] ) && 'mainwp_tab' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
424 434 ?>
425 435 <p><?php esc_html_e( 'If you need help with your MainWP Dashboard, please review following help documents', 'mainwp' ); ?></p>
426 436 <div class="ui list">
427 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/mainwp-user-interface/" target="_blank">Understanding MainWP Dashboard UI</a></div>
428 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/mainwp-user-interface/#navigation" target="_blank">MainWP Navigation</a></div>
429 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/mainwp-user-interface/#page-settings" target="_blank">Page Settings</a></div>
430 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/mainwp-user-interface/#widgetized-page-layout" target="_blank">Widgetized Page Layout</a></div>
431 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/mainwp-user-interface/#tables" target="_blank">MainWP Tables</a></div>
432 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/mainwp-user-interface/#individual-site-mode" target="_blank">Individual Child Site Mode</a></div>
437 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface" target="_blank">Understanding MainWP Dashboard UI</a></div>
438 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#navigation" target="_blank">MainWP Navigation</a></div>
439 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#page-settings" target="_blank">Page Settings</a></div>
440 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#widgetized-pages" target="_blank">Widgetized Page Layout</a></div>
441 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#tables" target="_blank">MainWP Tables</a></div>
442 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#individual-site-mode" target="_blank">Individual Child Site Mode</a></div>
433 443 <?php
434 444 /**
435 445 * Action: mainwp_overview_help_item
436 446 *
437 - * Fires at the bottom of the help articles list in the Help sidebar on the Overview page.
447 + * Fires at the bottom of the help articles list in the Help sidebar on the Operations page.
438 448 *
439 449 * Suggested HTML markup:
440 450 *
441 451 * <div class="item"><a href="Your custom URL">Your custom text</a></div>