dashboard-analytics.php
1 year ago
dashboard-credentials.php
4 years ago
dashboard-features.php
8 months ago
dashboard-home.php
2 years ago
dashboard-main.php
1 year ago
dashboard-pro.php
1 year ago
dashboard-widgets.php
8 months ago
edit-template-condition.php
1 year ago
edit-template.php
1 year ago
new-template.php
1 year ago
dashboard-analytics.php
150 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Dashboard analytics tab template |
| 5 | */ |
| 6 | |
| 7 | defined('ABSPATH') || die(); |
| 8 | |
| 9 | $widgets = ha_has_pro() ? self::get_widgets() : \Happy_Addons\Elementor\Classes\Widgets_Manager::get_local_widgets_map(); |
| 10 | $inactive_widgets = \Happy_Addons\Elementor\Classes\Widgets_Manager::get_inactive_widgets(); |
| 11 | $used_widget = self::get_raw_usage(); |
| 12 | $unuse_widget = self::get_un_usage(); |
| 13 | |
| 14 | $total_widgets_count = count( $widgets ); |
| 15 | $total_used_widget_count = count( $used_widget ); |
| 16 | $total_unuse_widget_count = count( $unuse_widget ); |
| 17 | |
| 18 | $disable_btn = count( $unuse_widget ) == count( array_intersect( $unuse_widget, $inactive_widgets ) ); |
| 19 | ?> |
| 20 | <div class="ha-dashboard-panel ha-dashboard-panel-analytics"> |
| 21 | |
| 22 | <?php if ( ! \Elementor\Tracker::is_allow_track() ) : ?> |
| 23 | <div class="ha-dashboard-analytics-notice"> |
| 24 | <div class="ha-dashboard-panel__header flex-content used-widgets"> |
| 25 | <div class="ha-dashboard-panel__header-content"> |
| 26 | <h2><?php esc_html_e( "Analytics Data Not Available", "happy-elementor-addons" ); ?></h2> |
| 27 | <p class="f16" style="margin: 0 0;"><?php printf( esc_html__( 'To see Analytics you need to follow these 2 steps:', 'happy-elementor-addons' ) ); ?></p> |
| 28 | </div> |
| 29 | </div> |
| 30 | <p class="f16 step"> |
| 31 | <?php |
| 32 | printf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a> %s', |
| 33 | __( 'Step - 1:', 'happy-elementor-addons' ), |
| 34 | __( 'Go to dashboard>Elementor>Settings>Experiment tab and tick "Usage Data Sharing" (last option) then save the change.', 'happy-elementor-addons' ), |
| 35 | admin_url( 'admin.php?page=elementor-settings#tab-experiments' ), |
| 36 | __( 'Click here', 'happy-elementor-addons' ), |
| 37 | __( 'to go to the page.', 'happy-elementor-addons' ) |
| 38 | ); |
| 39 | ?> |
| 40 | </p> |
| 41 | <p class="f16 step" style="margin: 0 0;"> |
| 42 | <?php |
| 43 | printf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a> %s', |
| 44 | __( 'Step - 2:', 'happy-elementor-addons' ), |
| 45 | __( 'Go to dashboard>Elementor>System Info>Elements Usage and press the "Recalculate" button.', 'happy-elementor-addons' ), |
| 46 | admin_url( 'admin.php?page=elementor-system-info' ), |
| 47 | __( 'Click here', 'happy-elementor-addons' ), |
| 48 | __( 'to go to the page.', 'happy-elementor-addons' ) |
| 49 | ); |
| 50 | ?> |
| 51 | </p> |
| 52 | </div> |
| 53 | <?php else: ?> |
| 54 | <!-- Used Widget Analytics --> |
| 55 | <div class="ha-dashboard-panel__header flex-content used-widgets"> |
| 56 | <div class="ha-dashboard-panel__header-content"> |
| 57 | <h2><?php esc_html_e( 'Used Widgets', 'happy-elementor-addons' ); ?></h2> |
| 58 | <?php if( $total_used_widget_count ): ?> |
| 59 | <p class="f16" style="margin: 0 0;"><?php printf( esc_html__( 'You are using only %s %s widgets. %s', 'happy-elementor-addons' ), '<strong>', $total_used_widget_count, '</strong>' ); ?></p> |
| 60 | <?php else: ?> |
| 61 | <p class="f16"><?php printf( esc_html__( 'No used widget found!', 'happy-elementor-addons' ) ); ?></p> |
| 62 | <?php endif; ?> |
| 63 | </div> |
| 64 | |
| 65 | <div class="ha-dashboard-panel__header-summary"> |
| 66 | <div class="data"><?php printf( esc_html__('Total Widget: %s', 'happy-elementor-addons' ), $total_widgets_count);?></div> |
| 67 | <div class="data"><?php printf( esc_html__('Used: %s', 'happy-elementor-addons' ), $total_used_widget_count);?></div> |
| 68 | <div class="data"><?php printf( esc_html__('Unused: %s', 'happy-elementor-addons' ), $total_unuse_widget_count);?></div> |
| 69 | </div> |
| 70 | </div> |
| 71 | |
| 72 | <div class="ha-dashboard-analytics" style="margin-bottom: 80px;"> |
| 73 | <?php |
| 74 | foreach ($used_widget as $key => $data) : |
| 75 | ?> |
| 76 | <div class="ha-dashboard-analytics__item"> |
| 77 | <fieldset> |
| 78 | <?php |
| 79 | if( isset( $widgets[$key]['is_pro'] ) && $widgets[$key]['is_pro'] ){ |
| 80 | printf( esc_html__('%sPRO%s', 'happy-elementor-addons' ), '<legend class="pro">', '</legend>'); |
| 81 | }else{ |
| 82 | printf( esc_html__('%sFREE%s', 'happy-elementor-addons' ), '<legend class="free">', '</legend>'); |
| 83 | } |
| 84 | ?> |
| 85 | <div class="widget_inner"> |
| 86 | <div class="widget-title"><?php echo $widgets[$key]['title'];?></div> |
| 87 | <span class="ha-dashboard-analytics__item-total-count"><?php esc_html_e('total use: ', 'happy-elementor-addons'); ?><?php echo $data;?></span> |
| 88 | </div> |
| 89 | </fieldset> |
| 90 | </div> |
| 91 | <?php |
| 92 | endforeach; |
| 93 | ?> |
| 94 | </div> |
| 95 | |
| 96 | |
| 97 | |
| 98 | <!-- Unused Widget Analytics --> |
| 99 | <div class="ha-dashboard-panel__header flex-content unused-widgets"> |
| 100 | <div class="ha-dashboard-panel__header-content"> |
| 101 | <h2><?php esc_html_e( 'Unused Widgets', 'happy-elementor-addons' ); ?></h2> |
| 102 | <?php if( $total_unuse_widget_count ): ?> |
| 103 | <p class="f16"><?php printf( esc_html__( '%s %s widgets %s are unused right now. You can disable this to make the site faster.', 'happy-elementor-addons' ), '<strong>', $total_unuse_widget_count, '</strong>' ); ?></p> |
| 104 | <?php else: ?> |
| 105 | <p class="f16"><?php printf( esc_html__( 'No unused widget found!', 'happy-elementor-addons' ) ); ?></p> |
| 106 | <?php endif; ?> |
| 107 | </div> |
| 108 | <?php if( !empty($unuse_widget) ) :?> |
| 109 | <button id="ha-dashboard-analytics-disable" class="ha-dashboard-btn ha-dashboard-analytics__unused_disable" type="submit" <?php echo $disable_btn ? 'disabled' : ''; ?>> |
| 110 | <?php echo esc_html__( 'Disable all unused widget', 'happy-elementor-addons' ); ?> |
| 111 | </button> |
| 112 | <input type="hidden" name="disable-unused-widgets" value="false"> |
| 113 | <?php endif;?> |
| 114 | </div> |
| 115 | |
| 116 | <?php if( !empty($unuse_widget) ) :?> |
| 117 | <div class="ha-dashboard-analytics"> |
| 118 | <?php |
| 119 | foreach ($unuse_widget as $key => $data) : |
| 120 | ?> |
| 121 | <div class="ha-dashboard-analytics__item"> |
| 122 | <fieldset> |
| 123 | <?php |
| 124 | if( isset( $widgets[$data]['is_pro'] ) && $widgets[$data]['is_pro'] ){ |
| 125 | printf( esc_html__('%sPRO%s', 'happy-elementor-addons' ), '<legend class="pro">', '</legend>'); |
| 126 | }else{ |
| 127 | printf( esc_html__('%sFREE%s', 'happy-elementor-addons' ), '<legend class="free">', '</legend>'); |
| 128 | } |
| 129 | ?> |
| 130 | <div class="widget_inner"> |
| 131 | <div class="widget-title"> |
| 132 | <?php echo $widgets[$data]['title'];?> |
| 133 | <?php if( in_array( $data, $inactive_widgets ) ) : ?> |
| 134 | <span class="disable" title="Disable"></span> |
| 135 | <?php else:?> |
| 136 | <span class="enabled" title="Enabled"></span> |
| 137 | <?php endif;?> |
| 138 | </div> |
| 139 | <span class="ha-dashboard-analytics__item-total-count"><?php echo esc_html('total use: 0');?></span> |
| 140 | </div> |
| 141 | </fieldset> |
| 142 | </div> |
| 143 | <?php |
| 144 | endforeach; |
| 145 | ?> |
| 146 | </div> |
| 147 | <?php endif;?> |
| 148 | <?php endif;?> |
| 149 | </div> |
| 150 |