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 | modules/logs/widgets/widget-log-graph-plugins-widget.php +21 -8 5.2.1 → 6.2.1 View file →
@@ -11,9 +11,15 @@
11 11 namespace MainWP\Dashboard\Module\Log;
12 12
13 13 use MainWP\Dashboard\MainWP_DB;
14 14 use MainWP\Dashboard\MainWP_Utility;
15 +use MainWP\Dashboard\MainWP_UI;
15 16
17 +// Exit if accessed directly.
18 +if ( ! defined( 'ABSPATH' ) ) {
19 + exit;
20 +}
21 +
16 22 /**
17 23 * Class Log_Graph_Plugins_Widget
18 24 *
19 25 * Displays the Logs info.
@@ -60,19 +66,20 @@
60 66 /**
61 67 * Render client overview Info.
62 68 */
63 69 public function render_widget() {
70 + $sites_count = MainWP_DB::instance()->get_websites_count();
64 71 ?>
65 72 <div class="mainwp-widget-header">
66 - <h3 class="ui header handle-drag">
73 + <h2 class="ui header handle-drag">
67 74 <?php esc_html_e( 'Site Plugin Status Breakdown', 'mainwp' ); ?>
68 75 <div class="sub header">
69 76 <?php esc_html_e( 'Total number of plugins per site, differentiated by active (blue) and inactive (green) status for quick assessment.', 'mainwp' ); ?>
70 77 </div>
71 - </h3>
78 + </h2>
72 79 </div>
73 80
74 - <div class="mainwp-widget-insights-card">
81 + <div class="mainwp-widget-insights-card mainwp-scrolly-overflow">
75 82 <?php
76 83 /**
77 84 * Action: mainwp_logs_widget_top
78 85 *
@@ -83,10 +90,14 @@
83 90 do_action( 'mainwp_logs_widget_top', 'status' );
84 91 ?>
85 92 <div id="mainwp-message-zone" style="display:none;" class="ui message"></div>
86 93 <?php
87 - wp_nonce_field( 'mainwp-admin-nonce' );
88 - $this->render_widget_content();
94 + MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' );
95 + if ( 0 < intval( $sites_count ) ) {
96 + $this->render_widget_content();
97 + } else {
98 + MainWP_UI::render_empty_element_placeholder( __( 'No Plugin Data', 'mainwp' ), '<a href="admin.php?page=managesites&do=new">' . __( 'Start connecting your sites now', 'mainwp' ) . '</a>', '<em data-emoji=":bar_chart:" class="medium"></em>' );
99 + }
89 100 ?>
90 101 <?php
91 102 /**
92 103 * Action: mainwp_logs_widget_bottom
@@ -110,10 +121,11 @@
110 121 /**
111 122 * Method render_widget_content()
112 123 */
113 124 public function render_widget_content() {
114 - $wp_plugins = array();
115 - $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user() );
125 + $wp_plugins = array();
126 + $wpsite_fields = array( 'id', 'name', 'plugins' );
127 + $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user_by_params( array( 'select_wp_fields' => $wpsite_fields ) ) );
116 128 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
117 129 $plugins = ! empty( $website->plugins ) ? json_decode( $website->plugins, 1 ) : array();
118 130 if ( ! is_array( $plugins ) ) {
119 131 $plugins = array();
@@ -138,9 +150,10 @@
138 150 jQuery( document ).ready( function() {
139 151 let options = {
140 152 chart: {
141 153 type: 'bar',
142 - stacked: true
154 + stacked: true,
155 + height: '100%',
143 156 },
144 157 plotOptions: {
145 158 bar: {
146 159 horizontal: true