PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 1.10
Independent Analytics – WordPress Analytics Plugin v1.10
2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / iawp.php
independent-analytics Last commit date
dist 3 years ago freemius 3 years ago img 3 years ago inc 3 years ago languages 3 years ago templates 3 years ago vendor 3 years ago iawp.php 3 years ago readme.txt 3 years ago
iawp.php
171 lines
1 <?php
2 /**
3 * Plugin Name: Independent Analytics
4 * Plugin URI: https://independentwp.com/
5 * Description: User-friendly website analytics built for WordPress
6 * Version: 1.10
7 * Requires at least: 5.5
8 * Tested up to: 6.0
9 * Requires PHP: 7.3.29
10 * Author: Independent Analytics
11 * Author URI: https://independentwp.com/
12 * License: GPL v2 or later
13 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
14 * Text Domain: iawp
15 * Domain Path: /languages
16 */
17
18 namespace IAWP;
19
20 define('IAWP_DIRECTORY', rtrim(plugin_dir_path(__FILE__), DIRECTORY_SEPARATOR));
21 define('IAWP_URL', rtrim(plugin_dir_url(__FILE__), '/'));
22 define('IAWP_VERSION', '1.10');
23
24 function path_to($path)
25 {
26 $path = trim($path, DIRECTORY_SEPARATOR);
27
28 return implode(DIRECTORY_SEPARATOR, [IAWP_DIRECTORY, $path]);
29 }
30
31 function url_to($path)
32 {
33 $path = trim($path, '/');
34
35 return implode('/', [IAWP_URL, $path]);
36 }
37
38 // Load scoped composer autoloader
39 require_once path_to('vendor/scoper-autoload.php');
40 // Load utils
41 require_once path_to('inc/utils/singleton.php');
42 require_once path_to('inc/utils/array_to_csv.php');
43 require_once path_to('inc/utils/date_format.php');
44 require_once path_to('inc/utils/exact_range.php');
45 require_once path_to('inc/models/visitor.php');
46 require_once path_to('inc/utils/request.php');
47 require_once path_to('inc/utils/salt.php');
48 require_once path_to('inc/utils/security.php');
49 require_once path_to('inc/utils/timezone.php');
50 require_once path_to('inc/utils/relative_range.php');
51 require_once path_to('inc/utils/url.php');
52 require_once path_to('inc/utils/wp-async-request.php');
53 // Load ajax
54 require_once path_to('inc/ajax/ajax.php');
55 require_once path_to('inc/ajax/delete_data_ajax.php');
56 require_once path_to('inc/ajax/export_geo_ajax.php');
57 require_once path_to('inc/ajax/export_referrers_ajax.php');
58 require_once path_to('inc/ajax/export_views_ajax.php');
59 require_once path_to('inc/ajax/filters_ajax.php');
60 require_once path_to('inc/ajax/migration_status_ajax.php');
61 // Load migrations
62 require_once path_to('inc/migrations/migration.php');
63 require_once path_to('inc/migrations/migration_job.php');
64 require_once path_to('inc/migrations/versions/migration_1_0.php');
65 require_once path_to('inc/migrations/versions/migration_1_6.php');
66 require_once path_to('inc/migrations/versions/migration_1_8.php');
67 require_once path_to('inc/migrations/versions/migration_1_9.php');
68 // Load models
69 require_once path_to('inc/models/page.php');
70 require_once path_to('inc/models/page_author_archive.php');
71 require_once path_to('inc/models/page_date_archive.php');
72 require_once path_to('inc/models/page_home.php');
73 require_once path_to('inc/models/page_not_found.php');
74 require_once path_to('inc/models/page_post_type_archive.php');
75 require_once path_to('inc/models/page_search.php');
76 require_once path_to('inc/models/page_singular.php');
77 require_once path_to('inc/models/page_term_archive.php');
78 require_once path_to('inc/models/geo.php');
79 require_once path_to('inc/models/referrer.php');
80 // Load queries
81 require_once path_to('inc/queries/range_query.php');
82 require_once path_to('inc/queries/geos.php');
83 require_once path_to('inc/queries/referrers.php');
84 require_once path_to('inc/queries/resources.php');
85 require_once path_to('inc/queries/views.php');
86 // Load root files
87 require_once path_to('inc/chart.php');
88 require_once path_to('inc/chart_geo.php');
89 require_once path_to('inc/dashboard_widget.php');
90 require_once path_to('inc/db.php');
91 require_once path_to('inc/filters.php');
92 require_once path_to('inc/freemius.php');
93 require_once path_to('inc/independent_analytics.php');
94 require_once path_to('inc/known_referrers.php');
95 require_once path_to('inc/quick_stats.php');
96 require_once path_to('inc/rest_api.php');
97 require_once path_to('inc/settings.php');
98 require_once path_to('inc/table.php');
99 require_once path_to('inc/table_geo.php');
100 require_once path_to('inc/table_referrers.php');
101 require_once path_to('inc/table_views.php');
102 require_once path_to('inc/track_resource_changes.php');
103 require_once path_to('inc/view_counter.php');
104
105 // Initialize freemius
106 function IAWP_FS()
107 {
108 return Freemius::getInstance()->fs();
109 }
110
111 IAWP_FS();
112
113 // Initialize independent analytics
114 function IAWP()
115 {
116 return Independent_Analytics::getInstance();
117 }
118
119 IAWP();
120
121 add_filter('pre_option_iawp_is_migrating', function ($default) {
122 global $wpdb;
123 $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 'iawp_is_migrating'));
124
125 if (is_object($row)) {
126 $value = $row->option_value;
127 } else {
128 $value = $default;
129 }
130
131 return apply_filters('option_iawp_is_migrating', maybe_unserialize($value), 'iawp_is_migrating');
132 });
133
134 add_filter('pre_option_iawp_db_version', function ($default) {
135 global $wpdb;
136 $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 'iawp_db_version'));
137
138 if (is_object($row)) {
139 $value = $row->option_value;
140 } else {
141 $value = $default;
142 }
143
144 return apply_filters('option_iawp_db_version', maybe_unserialize($value), 'iawp_db_version');
145 });
146
147 register_activation_hook(__FILE__, function () {
148 if (get_option('iawp_db_version', '0') === '0') {
149 // If there is no database installed, run migration on current process
150 Migration::create_or_migrate();
151 } else {
152 // If there is a database, run migration in a background process
153 Migration_Job::maybe_dispatch();
154 }
155 });
156
157 /*
158 * The admin_init hook will fire when the dashboard is loaded or an admin ajax request is made
159 */
160 add_action('admin_init', function () {
161 new Migration_Job();
162
163 if (get_option('iawp_db_version', '0') === '0') {
164 // If there is no database installed, run migration on current process
165 Migration::create_or_migrate();
166 } else {
167 // If there is a database, run migration in a background process
168 Migration_Job::maybe_dispatch();
169 }
170 });
171