PluginProbe
Analytics Insights – Google Analytics Dashboard for WordPress / trunk
Analytics Insights – Google Analytics Dashboard for WordPress vtrunk
6.3.6 6.3.7 6.3.8 6.3.9 trunk 5.4.1 5.4.2 5.4.2.1 5.4.3 5.4.4 5.4.5 5.4.6 5.4.7 5.5.2 5.5.3 5.5.4 5.5.5 5.5.6 5.6 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 All 61 releases
analytics-insights / analytics-insights.php

analytics-insights.php in Analytics Insights – Google Analytics Dashboard for WordPress trunk, at analytics-insights.php

247 lines 6.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Analytics Insights
4 * Plugin URI: https://deconf.com/analytics-insights-google-analytics-dashboard-wordpress/
5 * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6 * Author: DeConf
7 * Version: 6.3.12
8 * Author URI: https://deconf.com
9 * Text Domain: analytics-insights
10 * Domain Path: /languages
11 */
12 // Exit if accessed directly
13 if ( ! defined( 'ABSPATH' ) )
14 exit();
15 // Plugin Version
16 if ( ! defined( 'AIWP_CURRENT_VERSION' ) ) {
17 define( 'AIWP_CURRENT_VERSION', '6.3.12' );
18 }
19 if ( ! defined( 'AIWP_ENDPOINT_URL' ) ) {
20 define( 'AIWP_ENDPOINT_URL', 'https://api.deconf.com/aiwp/v4/' );
21 }
22 if ( ! class_exists( 'AIWP_Manager' ) ) {
23
24 final class AIWP_Manager {
25
26 private static $instance = null;
27
28 public $config = null;
29
30 public $frontend_actions = null;
31
32 public $common_actions = null;
33
34 public $backend_actions = null;
35
36 public $tracking = null;
37
38 public $frontend_item_reports = null;
39
40 public $backend_setup = null;
41
42 public $frontend_setup = null;
43
44 public $backend_widgets = null;
45
46 public $backend_item_reports = null;
47
48 public $gapi_controller = null;
49
50 /**
51 * Construct forbidden
52 */
53 private function __construct() {
54 if ( null !== self::$instance ) {
55 _doing_it_wrong( __FUNCTION__, __( "This is not allowed, read the documentation!", 'analytics-insights' ), '4.6' );
56 }
57 }
58
59 /**
60 * Clone warning
61 */
62 private function __clone() {
63 _doing_it_wrong( __FUNCTION__, __( "This is not allowed, read the documentation!", 'analytics-insights' ), '4.6' );
64 }
65
66 /**
67 * Wakeup warning
68 */
69 public function __wakeup() {
70 _doing_it_wrong( __FUNCTION__, __( "This is not allowed, read the documentation!", 'analytics-insights' ), '4.6' );
71 }
72
73 /**
74 * Creates a single instance for AIWP and makes sure only one instance is present in memory.
75 *
76 * @return AIWP_Manager
77 */
78 public static function instance() {
79 if ( null === self::$instance ) {
80 self::$instance = new self();
81 self::$instance->setup();
82 self::$instance->config = new AIWP_Config();
83 }
84 return self::$instance;
85 }
86
87 /**
88 * Defines constants and loads required resources
89 */
90 private function setup() {
91 // Plugin Path
92 if ( ! defined( 'AIWP_DIR' ) ) {
93 define( 'AIWP_DIR', plugin_dir_path( __FILE__ ) );
94 }
95 // Plugin URL
96 if ( ! defined( 'AIWP_URL' ) ) {
97 define( 'AIWP_URL', plugin_dir_url( __FILE__ ) );
98 }
99 // Plugin main File
100 if ( ! defined( 'AIWP_FILE' ) ) {
101 define( 'AIWP_FILE', __FILE__ );
102 }
103 /*
104 * Load Tools class
105 */
106 include_once ( AIWP_DIR . 'tools/tools.php' );
107 /*
108 * Load Config class
109 */
110 include_once ( AIWP_DIR . 'config.php' );
111 /*
112 * Load GAPI Controller class
113 */
114 include_once ( AIWP_DIR . 'tools/gapi.php' );
115 /*
116 * Plugin i18n
117 */
118 add_action( 'init', array( self::$instance, 'load_i18n' ) );
119 /*
120 * Plugin Init
121 */
122 add_action( 'init', array( self::$instance, 'load' ) );
123 /*
124 * Include Install
125 */
126 include_once ( AIWP_DIR . 'install/install.php' );
127 register_activation_hook( AIWP_FILE, array( 'AIWP_Install', 'install' ) );
128 /*
129 * Include Uninstall
130 */
131 include_once ( AIWP_DIR . 'install/uninstall.php' );
132 register_uninstall_hook( AIWP_FILE, array( 'AIWP_Uninstall', 'uninstall' ) );
133 /*
134 * Load Frontend Widgets
135 * (needed during ajax)
136 */
137 include_once ( AIWP_DIR . 'front/widgets.php' );
138 /*
139 * Add Frontend Widgets
140 * (needed during ajax)
141 */
142 add_action( 'widgets_init', array( self::$instance, 'add_frontend_widget' ) );
143 }
144
145 /**
146 * Load i18n
147 */
148 public function load_i18n() {
149 load_plugin_textdomain( 'analytics-insights', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
150 }
151
152 /**
153 * Register Frontend Widgets
154 */
155 public function add_frontend_widget() {
156 register_widget( 'AIWP_Frontend_Widget' );
157 }
158
159 /**
160 * Conditional load
161 */
162 public function load() {
163 if ( is_admin() ) {
164 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
165 if ( AIWP_Tools::check_roles( self::$instance->config->options['access_back'] ) ) {
166 /*
167 * Load Backend ajax actions
168 */
169 include_once ( AIWP_DIR . 'admin/ajax-actions.php' );
170 self::$instance->backend_actions = new AIWP_Backend_Ajax();
171 }
172 /*
173 * Load Frontend ajax actions
174 */
175 include_once ( AIWP_DIR . 'front/ajax-actions.php' );
176 self::$instance->frontend_actions = new AIWP_Frontend_Ajax();
177 /*
178 * Load Common ajax actions
179 */
180 include_once ( AIWP_DIR . 'common/ajax-actions.php' );
181 self::$instance->common_actions = new AIWP_Common_Ajax();
182 if ( self::$instance->config->options['backend_item_reports'] ) {
183 /*
184 * Load Backend Item Reports for Quick Edit
185 */
186 include_once ( AIWP_DIR . 'admin/item-reports.php' );
187 self::$instance->backend_item_reports = new AIWP_Backend_Item_Reports();
188 }
189 } else if ( AIWP_Tools::check_roles( self::$instance->config->options['access_back'] ) ) {
190 /*
191 * Load Backend Setup
192 */
193 include_once ( AIWP_DIR . 'admin/setup.php' );
194 self::$instance->backend_setup = new AIWP_Backend_Setup();
195 if ( self::$instance->config->options['dashboard_widget'] ) {
196 /*
197 * Load Backend Widget
198 */
199 include_once ( AIWP_DIR . 'admin/widgets.php' );
200 self::$instance->backend_widgets = new AIWP_Backend_Widgets();
201 }
202 if ( self::$instance->config->options['backend_item_reports'] ) {
203 /*
204 * Load Backend Item Reports
205 */
206 include_once ( AIWP_DIR . 'admin/item-reports.php' );
207 self::$instance->backend_item_reports = new AIWP_Backend_Item_Reports();
208 }
209 }
210 } else {
211 if ( AIWP_Tools::check_roles( self::$instance->config->options['access_front'] ) ) {
212 /*
213 * Load Frontend Setup
214 */
215 include_once ( AIWP_DIR . 'front/setup.php' );
216 self::$instance->frontend_setup = new AIWP_Frontend_Setup();
217 if ( self::$instance->config->options['frontend_item_reports'] ) {
218 /*
219 * Load Frontend Item Reports
220 */
221 include_once ( AIWP_DIR . 'front/item-reports.php' );
222 self::$instance->frontend_item_reports = new AIWP_Frontend_Item_Reports();
223 }
224 }
225 if ( ! AIWP_Tools::check_roles( self::$instance->config->options['track_exclude'], true ) && 'disabled' != self::$instance->config->options['tracking_type'] ) {
226 /*
227 * Load tracking class
228 */
229 include_once ( AIWP_DIR . 'front/tracking.php' );
230 self::$instance->tracking = new AIWP_Tracking();
231 }
232 }
233 }
234 }
235 }
236
237 /**
238 * Returns a unique instance of AIWP
239 */
240 function AIWP() {
241 return AIWP_Manager::instance();
242 }
243 /*
244 * Start AIWP
245 */
246 AIWP();
247