PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 1.9
Independent Analytics – WordPress Analytics Plugin v1.9
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 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 4 years ago freemius 4 years ago img 4 years ago inc 4 years ago languages 4 years ago templates 4 years ago vendor 4 years ago iawp.php 4 years ago readme.txt 4 years ago
iawp.php
169 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.9
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.9');
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/db.php');
90 require_once path_to('inc/filters.php');
91 require_once path_to('inc/freemius.php');
92 require_once path_to('inc/independent_analytics.php');
93 require_once path_to('inc/known_referrers.php');
94 require_once path_to('inc/quick_stats.php');
95 require_once path_to('inc/rest_api.php');
96 require_once path_to('inc/settings.php');
97 require_once path_to('inc/table.php');
98 require_once path_to('inc/table_geo.php');
99 require_once path_to('inc/table_referrers.php');
100 require_once path_to('inc/table_views.php');
101 require_once path_to('inc/track_resource_changes.php');
102
103 // Initialize freemius
104 function IAWP_FS()
105 {
106 return Freemius::getInstance()->fs();
107 }
108
109 IAWP_FS();
110
111 // Initialize independent analytics
112 function IAWP()
113 {
114 return Independent_Analytics::getInstance();
115 }
116
117 IAWP();
118
119 add_filter('pre_option_iawp_is_migrating', function ($default) {
120 global $wpdb;
121 $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 'iawp_is_migrating'));
122
123 if (is_object($row)) {
124 $value = $row->option_value;
125 } else {
126 $value = $default;
127 }
128
129 return apply_filters('option_iawp_is_migrating', maybe_unserialize($value), 'iawp_is_migrating');
130 });
131
132 add_filter('pre_option_iawp_db_version', function ($default) {
133 global $wpdb;
134 $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 'iawp_db_version'));
135
136 if (is_object($row)) {
137 $value = $row->option_value;
138 } else {
139 $value = $default;
140 }
141
142 return apply_filters('option_iawp_db_version', maybe_unserialize($value), 'iawp_db_version');
143 });
144
145 register_activation_hook(__FILE__, function () {
146 if (get_option('iawp_db_version', '0') === '0') {
147 // If there is no database installed, run migration on current process
148 Migration::create_or_migrate();
149 } else {
150 // If there is a database, run migration in a background process
151 Migration_Job::maybe_dispatch();
152 }
153 });
154
155 /*
156 * The admin_init hook will fire when the dashboard is loaded or an admin ajax request is made
157 */
158 add_action('admin_init', function () {
159 new Migration_Job();
160
161 if (get_option('iawp_db_version', '0') === '0') {
162 // If there is no database installed, run migration on current process
163 Migration::create_or_migrate();
164 } else {
165 // If there is a database, run migration in a background process
166 Migration_Job::maybe_dispatch();
167 }
168 });
169