PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
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-php-widget.php +52 -46 5.1 → 6.2.2 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_Php_Widget
18 24 *
19 25 * Displays the Logs info.
@@ -60,45 +66,50 @@
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( 'PHP Version Distribution', 'mainwp' ); ?>
68 75 <div class="sub header">
69 76 <?php esc_html_e( 'Distribution of PHP versions across the sites. Track which PHP versions are most prevalent in your network.', 'mainwp' ); ?>
70 77 </div>
71 - </h3>
78 + </h2>
72 79 </div>
73 80
74 - <div class="mainwp-widget-insights-card">
75 - <?php
76 - /**
77 - * Action: mainwp_logs_widget_top
78 - *
79 - * Fires at the top of the widget.
80 - *
81 - * @since 4.6
82 - */
83 - do_action( 'mainwp_logs_widget_top', 'php' );
84 - ?>
85 - <div id="mainwp-message-zone" style="display:none;" class="ui message"></div>
86 - <?php
87 - wp_nonce_field( 'mainwp-admin-nonce' );
81 + <div class="mainwp-widget-insights-card mainwp-scrolly-overflow">
82 + <?php
83 + /**
84 + * Action: mainwp_logs_widget_top
85 + *
86 + * Fires at the top of the widget.
87 + *
88 + * @since 4.6
89 + */
90 + do_action( 'mainwp_logs_widget_top', 'php' );
91 + ?>
92 + <div id="mainwp-message-zone" style="display:none;" class="ui message"></div>
93 + <?php
94 + MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' );
95 + if ( 0 < intval( $sites_count ) ) {
88 96 $this->render_widget_content();
89 - ?>
90 - <?php
91 - /**
92 - * Action: mainwp_logs_widget_bottom
93 - *
94 - * Fires at the bottom of the widget.
95 - *
96 - * @since 4.6
97 - */
98 - do_action( 'mainwp_logs_widget_bottom', 'php' );
99 - ?>
100 - </div>
97 + } else {
98 + MainWP_UI::render_empty_element_placeholder( __( 'No PHP Version 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 + }
100 + ?>
101 + <?php
102 + /**
103 + * Action: mainwp_logs_widget_bottom
104 + *
105 + * Fires at the bottom of the widget.
106 + *
107 + * @since 4.6
108 + */
109 + do_action( 'mainwp_logs_widget_bottom', 'php' );
110 + ?>
111 + </div>
101 112 <div class="mainwp-widget-footer ui four columns stackable grid">
102 113 <div class="column">
103 114 </div>
104 115 <div class="column">
@@ -132,10 +143,22 @@
132 143 <script type="text/javascript">
133 144 jQuery( document ).ready( function() {
134 145 let options = {
135 146 chart: {
136 - type: 'bar'
147 + type: 'pie',
148 + height: 290,
137 149 },
150 + tooltip: {
151 + theme: 'dark'
152 + },
153 + legend: {
154 + labels: {
155 + colors: '#999'
156 + }
157 + },
158 + stroke: {
159 + width: 0
160 + },
138 161 series: [ {
139 162 name: 'Sites',
140 163 data: [
141 164 <?php foreach ( $versions as $version => $count ) : ?>
@@ -146,25 +169,8 @@
146 169 },
147 170 <?php endforeach; ?>
148 171 ]
149 172 } ],
150 - xaxis: {
151 - labels: {
152 - style: {
153 - colors: '#999999',
154 - }
155 - }
156 - },
157 - yaxis: {
158 - labels: {
159 - style: {
160 - colors: '#999999',
161 - }
162 - }
163 - },
164 - tooltip: {
165 - theme: 'dark'
166 - },
167 173 }
168 174 let php = new ApexCharts(document.querySelector("#mainwp-module-log-chart-php-wrapper"), options);
169 175 setTimeout(() => {
170 176 php.render();