← All changes
|
modules/logs/widgets/widget-log-graph-themes-widget.php
+18
-6
5.2
→
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_Themes_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( 'Active Themes Overview', 'mainwp' ); ?> |
| 68 | 75 | <div class="sub header"> |
| 69 | 76 | <?php esc_html_e( 'Number of sites using each theme. The bar height indicates the prevalence of a theme across your network.', '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', 'themes' ); |
| 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 Themes 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 |
| @@ -130,9 +141,10 @@ | ||
| 130 | 141 | <script type="text/javascript"> |
| 131 | 142 | jQuery( document ).ready( function() { |
| 132 | 143 | let options = { |
| 133 | 144 | chart: { |
| 134 | - type: 'bar' | |
| 145 | + type: 'bar', | |
| 146 | + height: 350, | |
| 135 | 147 | }, |
| 136 | 148 | series: [ { |
| 137 | 149 | name: 'Sites', |
| 138 | 150 | data: [ |