PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.0.0
Independent Analytics – WordPress Analytics Plugin v2.0.0
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 / Independent_Analytics.php
independent-analytics / IAWP Last commit date
AJAX 2 years ago Date_Range 2 years ago Interval 3 years ago Menu_Bar_Stats 2 years ago Migrations 2 years ago Models 2 years ago Queries 2 years ago Statistics 2 years ago Tables 2 years ago Utils 2 years ago Campaign_Builder.php 2 years ago Capability_Manager.php 3 years ago Chart.php 2 years ago Chart_Geo.php 2 years ago Chart_SVG.php 3 years ago City_To_Country_Converter.php 3 years ago Dashboard_Options.php 2 years ago Dashboard_Widget.php 2 years ago Database_Manager.php 2 years ago Email_Chart.php 2 years ago Email_Reports.php 2 years ago Empty_Report_Option.php 2 years ago Env.php 2 years ago Filters.php 3 years ago Geo_Database_Background_Job.php 2 years ago Geo_Database_Manager.php 2 years ago Geoposition.php 2 years ago Icon_Directory.php 2 years ago Icon_Directory_Factory.php 2 years ago Illuminate_Builder.php 3 years ago Independent_Analytics.php 2 years ago Interrupt.php 2 years ago Known_Referrers.php 2 years ago Plugin_Conflict_Detector.php 2 years ago Query.php 2 years ago Quick_Stats.php 2 years ago REST_API.php 2 years ago Real_Time.php 2 years ago Report.php 2 years ago Report_Finder.php 2 years ago Report_Options_Parser.php 2 years ago Resource_Identifier.php 3 years ago Settings.php 2 years ago Sort_Configuration.php 3 years ago Track_Resource_Changes.php 3 years ago View.php 2 years ago View_Counter.php 2 years ago WP_Option_Cache_Bust.php 2 years ago WooCommerce_Order.php 2 years ago
Independent_Analytics.php
411 lines
1 <?php
2
3 namespace IAWP_SCOPED\IAWP;
4
5 use IAWP_SCOPED\IAWP\AJAX\AJAX_Manager;
6 use IAWP_SCOPED\IAWP\Menu_Bar_Stats\Menu_Bar_Stats;
7 use IAWP_SCOPED\IAWP\Migrations\Migration;
8 use IAWP_SCOPED\IAWP\Statistics\Campaign_Statistics;
9 use IAWP_SCOPED\IAWP\Statistics\Country_Statistics;
10 use IAWP_SCOPED\IAWP\Statistics\Device_Statistics;
11 use IAWP_SCOPED\IAWP\Statistics\Page_Statistics;
12 use IAWP_SCOPED\IAWP\Statistics\Referrer_Statistics;
13 use IAWP_SCOPED\IAWP\Tables\Table;
14 use IAWP_SCOPED\IAWP\Tables\Table_Campaigns;
15 use IAWP_SCOPED\IAWP\Tables\Table_Devices;
16 use IAWP_SCOPED\IAWP\Tables\Table_Geo;
17 use IAWP_SCOPED\IAWP\Tables\Table_Pages;
18 use IAWP_SCOPED\IAWP\Tables\Table_Referrers;
19 use IAWP_SCOPED\IAWP\Utils\Security;
20 use IAWP_SCOPED\IAWP\Utils\Singleton;
21 class Independent_Analytics
22 {
23 use Singleton;
24 public $settings;
25 public $email_reports;
26 // This is where we attach functions to WP hooks
27 private function __construct()
28 {
29 $this->settings = new Settings();
30 new REST_API();
31 new Dashboard_Widget();
32 new View_Counter();
33 AJAX_Manager::getInstance();
34 new Track_Resource_Changes();
35 Menu_Bar_Stats::register();
36 WooCommerce_Order::initialize_order_tracker();
37 if (\IAWP_SCOPED\iawp_is_pro()) {
38 $this->email_reports = new Email_Reports();
39 new Campaign_Builder();
40 }
41 \add_filter('admin_body_class', function ($classes) {
42 if (\get_option('iawp_dark_mode')) {
43 $classes .= ' iawp-dark-mode ';
44 }
45 return $classes;
46 });
47 \add_action('admin_menu', [$this, 'add_admin_menu_pages']);
48 \add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']);
49 \add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']);
50 \add_filter('plugin_action_links_independent-analytics/iawp.php', [$this, 'plugin_action_links']);
51 \add_filter('admin_footer_text', [$this, 'ip_db_attribution'], 1, 1);
52 \add_filter('admin_head', [$this, 'style_premium_menu_item']);
53 \add_action('init', [$this, 'polylang_translations']);
54 \add_action('init', [$this, 'load_textdomain']);
55 IAWP_FS()->add_filter('connect_message_on_update', [$this, 'filter_connect_message_on_update'], 10, 6);
56 IAWP_FS()->add_filter('connect_message', [$this, 'filter_connect_message_on_update'], 10, 6);
57 IAWP_FS()->add_filter('is_submenu_visible', [$this, 'hide_freemius_sub_menus'], 10, 2);
58 IAWP_FS()->add_filter('pricing_url', [$this, 'change_freemius_pricing_url'], 10);
59 IAWP_FS()->add_filter('show_deactivation_feedback_form', function () {
60 return \false;
61 });
62 }
63 public function load_textdomain()
64 {
65 \load_plugin_textdomain('independent-analytics', \false, \IAWP_LANGUAGES_DIRECTORY);
66 }
67 public function polylang_translations()
68 {
69 if (\function_exists('IAWP_SCOPED\\pll_register_string')) {
70 pll_register_string('view_counter', 'Views:', 'Independent Analytics');
71 }
72 }
73 // Settings page where the analytics will appear
74 public function add_admin_menu_pages()
75 {
76 $title = Capability_Manager::white_labeled() ? \esc_html__('Analytics', 'independent-analytics') : 'Independent Analytics';
77 \add_menu_page($title, \esc_html__('Analytics', 'independent-analytics'), Capability_Manager::can_view_string(), 'independent-analytics', [$this, 'render_analytics_page'], 'dashicons-analytics', 3);
78 if (!Capability_Manager::white_labeled()) {
79 \add_submenu_page('independent-analytics', \esc_html__('Feedback', 'independent-analytics'), \esc_html__('Feedback', 'independent-analytics'), Capability_Manager::can_view_string(), \esc_url('https://feedback.independentwp.com/boards/feature-requests'));
80 }
81 if (\IAWP_SCOPED\iawp_is_free() && !Capability_Manager::white_labeled()) {
82 \add_submenu_page('independent-analytics', \esc_html__('Upgrade to Pro &rarr;', 'independent-analytics'), \esc_html__('Upgrade to Pro &rarr;', 'independent-analytics'), Capability_Manager::can_view_string(), \esc_url('https://independentwp.com/pricing/?utm_source=User+Dashboard&utm_medium=WP+Admin&utm_campaign=Upgrade+to+Pro&utm_content=Sidebar'));
83 }
84 }
85 public function hide_freemius_sub_menus($is_visible, $menu_id)
86 {
87 if ('pricing' == $menu_id) {
88 return \false;
89 } elseif ('support' == $menu_id && Capability_Manager::white_labeled()) {
90 return \false;
91 } else {
92 return \true;
93 }
94 }
95 public function change_freemius_pricing_url()
96 {
97 return 'https://independentwp.com/pricing/?utm_source=User+Dashboard&utm_medium=WP+Admin&utm_campaign=Upgrade+to+Pro&utm_content=Account';
98 }
99 // The submenu item needs to be styled on all admin pages, and we only load stylesheets on our page
100 public function style_premium_menu_item()
101 {
102 if (\IAWP_SCOPED\iawp_is_free()) {
103 echo '<style>#toplevel_page_independent-analytics .wp-submenu li:nth-child(4) a { color: #F69D0A; }</style>';
104 }
105 }
106 public function render_analytics_page()
107 {
108 if (!Capability_Manager::can_view()) {
109 return;
110 }
111 if (Migration::is_migrating()) {
112 $interrupt = new Interrupt('interrupt.migration-is-running');
113 $interrupt->render();
114 return;
115 }
116 $options = new Dashboard_Options();
117 $tab = $this->get_current_tab();
118 ?>
119 <div id="iawp-parent" class="iawp-parent <?php
120 \esc_attr_e($tab);
121 ?>">
122 <div id="iawp-layout" class="iawp-layout <?php
123 echo $options->is_sidebar_collapsed() ? 'collapsed' : '';
124 ?>">
125 <?php
126 echo \IAWP_SCOPED\iawp_blade()->run('partials.sidebar', ['favorite_report' => Report_Finder::get_favorite(), 'report_finder' => new Report_Finder(), 'is_white_labeled' => Capability_Manager::white_labeled(), 'can_edit_settings' => Capability_Manager::can_edit(), 'is_dark_mode' => \get_option('iawp_dark_mode')]);
127 ?>
128 <div class="iawp-layout-main">
129 <div class="iawp-tab-content"><?php
130 $date_rage = $options->get_date_range();
131 $date_label = $date_rage->label();
132 $columns = $options->columns();
133 if ($tab == 'views') {
134 $table = new Table_Pages($columns);
135 $statistics = new Page_Statistics($date_rage, null, $options->chart_interval());
136 $stats = new Quick_Stats(null, $statistics);
137 $chart = new Chart($statistics, $date_label);
138 $this->interface($table, $stats, $chart);
139 } elseif ($tab == 'referrers') {
140 $table = new Table_Referrers($columns);
141 $statistics = new Referrer_Statistics($date_rage, null, $options->chart_interval());
142 $stats = new Quick_Stats(null, $statistics);
143 $chart = new Chart($statistics, $date_label);
144 $this->interface($table, $stats, $chart);
145 } elseif ($tab == 'geo') {
146 $table = new Table_Geo($columns, $options->group());
147 $statistics = new Country_Statistics($date_rage);
148 $stats = new Quick_Stats(null, $statistics);
149 $table_data_class = $table->group()->table_data_class();
150 $geo_data = new $table_data_class($date_rage);
151 if ($options->group() === 'city') {
152 $country_rows = City_To_Country_Converter::convert($geo_data->rows());
153 $chart = new Chart_Geo($country_rows, $date_label);
154 } else {
155 $chart = new Chart_Geo($geo_data->rows(), $date_label);
156 }
157 $this->interface($table, $stats, $chart);
158 } elseif ($tab === 'campaigns') {
159 $table = new Table_Campaigns($columns);
160 $statistics = new Campaign_Statistics($date_rage, null, $options->chart_interval());
161 $stats = new Quick_Stats(null, $statistics);
162 $chart = new Chart($statistics, $date_label);
163 $this->interface($table, $stats, $chart);
164 } elseif ($tab == 'campaign-builder') {
165 (new Campaign_Builder())->render_campaign_builder();
166 } elseif ($tab == 'devices') {
167 $table = new Table_Devices($columns, $options->group());
168 $statistics = new Device_Statistics($date_rage);
169 $stats = new Quick_Stats(null, $statistics);
170 $chart = new Chart($statistics, $date_label);
171 $this->interface($table, $stats, $chart);
172 } elseif ($tab === 'real-time') {
173 (new Real_Time())->render_real_time_analytics();
174 } elseif ($tab == 'settings') {
175 echo '<div id="iawp-dashboard" class="iawp-dashboard">';
176 if (Capability_Manager::can_edit()) {
177 $this->settings->render_settings();
178 } else {
179 echo '<p class="permission-blocked">' . \esc_html__('You do not have permission to edit the settings.', 'independent-analytics') . '</p>';
180 }
181 echo '</div>';
182 } elseif ($tab == 'learn') {
183 echo '<div id="iawp-dashboard" class="iawp-dashboard">';
184 echo \IAWP_SCOPED\iawp_blade()->run('learn.learn');
185 echo '</div>';
186 }
187 ?>
188 </div>
189 <div id="loading-icon" class="loading-icon"><img
190 src="<?php
191 echo \esc_url(\IAWP_SCOPED\iawp_url_to('img/loading.svg'));
192 ?>"/>
193 </div>
194 <button id="scroll-to-top" class="scroll-to-top"><span
195 class="dashicons dashicons-arrow-up-alt"></span>
196 </button>
197 </div>
198 </div>
199 </div>
200 <?php
201 }
202 public function interface(Table $table, $stats, $chart)
203 {
204 $options = new Dashboard_Options();
205 // Todo - Silly that I use table to get the params just to pass them back into table
206 $sort_configuration = $table->sanitize_sort_parameters($options->sort_column(), $options->sort_direction());
207 ?>
208 <div id="iawp-dashboard"
209 class="iawp-dashboard"
210 data-controller="report"
211 data-report-relative-range-id-value="<?php
212 echo Security::attr($options->relative_range_id());
213 ?>"
214 data-report-exact-start-value="<?php
215 echo Security::attr($options->start());
216 ?>"
217 data-report-exact-end-value="<?php
218 echo Security::attr($options->end());
219 ?>"
220 data-report-group-value="<?php
221 echo Security::attr($options->group());
222 ?>"
223 data-report-filters-value="<?php
224 \esc_attr_e(Security::json_encode($options->filters()));
225 ?>"
226 data-report-chart-interval-value="<?php
227 echo Security::attr($options->chart_interval()->id());
228 ?>"
229 data-report-sort-column-value="<?php
230 echo Security::attr($options->sort_column());
231 ?>"
232 data-report-sort-direction-value="<?php
233 echo Security::attr($options->sort_direction());
234 ?>"
235 data-report-columns-value="<?php
236 \esc_attr_e(Security::json_encode($table->visible_column_ids()));
237 ?>"
238 data-report-visible-datasets-value="<?php
239 \esc_attr_e(Security::json_encode($options->visible_datasets()));
240 ?>"
241 >
242 <div class="report-header-container">
243 <?php
244 echo \IAWP_SCOPED\iawp_blade()->run('partials.report-header', ['report' => (new Report_Finder())->current(), 'can_edit' => Capability_Manager::can_edit()]);
245 ?>
246 <?php
247 $table->output_toolbar();
248 ?>
249 </div>
250 <?php
251 echo $stats->get_html();
252 ?>
253 <?php
254 echo $chart->get_html($options->visible_datasets());
255 ?>
256 <?php
257 echo $table->get_table_markup($sort_configuration->column(), $sort_configuration->is_ascending() ? 'asc' : 'desc');
258 ?>
259 </div>
260 <div class="iawp-notices"><?php
261 $plugin_conflict_detector = new Plugin_Conflict_Detector();
262 if (!$plugin_conflict_detector->has_conflict()) {
263 echo \IAWP_SCOPED\iawp_blade()->run('settings.notice', ['notice_text' => $plugin_conflict_detector->get_error(), 'button_text' => \false, 'notice' => 'iawp-error', 'url' => 'https://independentwp.com/knowledgebase/common-questions/views-not-recording/']);
264 }
265 if (\get_option('iawp_need_clear_cache')) {
266 echo \IAWP_SCOPED\iawp_blade()->run('settings.notice', ['notice_text' => \__('Please clear your cache to ensure tracking works properly.', 'independent-analytics'), 'button_text' => \__('I\'ve cleared the cache', 'independent-analytics'), 'notice' => 'iawp-warning', 'url' => 'https://independentwp.com/knowledgebase/common-questions/views-not-recording/']);
267 }
268 ?>
269 </div><?php
270 }
271 public function enqueue_admin_scripts($hook)
272 {
273 $this->enqueue_translations();
274 $this->enqueue_nonces();
275 if ($hook == 'toplevel_page_independent-analytics') {
276 $tab = $this->get_current_tab();
277 \wp_register_style('iawp-style', \IAWP_SCOPED\iawp_url_to('dist/styles/style.css'), [], \IAWP_VERSION);
278 \wp_enqueue_style('iawp-style');
279 \wp_register_script('iawp-js', \IAWP_SCOPED\iawp_url_to('dist/js/index.js'), [], \IAWP_VERSION);
280 \wp_enqueue_script('iawp-js');
281 if ($tab === 'views' || $tab === 'referrers' || $tab === 'geo' || $tab === 'campaigns' || $tab === 'campaign-builder' || $tab === 'devices' || $tab === 'real-time') {
282 \wp_register_script('iawp-data-table', \IAWP_SCOPED\iawp_url_to('dist/js/data-table.js'), [], \IAWP_VERSION);
283 \wp_enqueue_script('iawp-data-table');
284 } elseif ($tab == 'settings') {
285 \wp_enqueue_style('wp-color-picker');
286 \wp_register_script('iawp-settings', \IAWP_SCOPED\iawp_url_to('dist/js/settings.js'), ['wp-color-picker'], \IAWP_VERSION);
287 \wp_enqueue_script('iawp-settings');
288 } elseif ($tab == 'learn') {
289 \wp_register_script('iawp-learn', \IAWP_SCOPED\iawp_url_to('dist/js/learn.js'), [], \IAWP_VERSION);
290 \wp_enqueue_script('iawp-learn');
291 }
292 } elseif ($hook == 'index.php') {
293 \wp_register_script('iawp-dashboard-widget', \IAWP_SCOPED\iawp_url_to('dist/js/dashboard_widget.js'), [], \IAWP_VERSION);
294 \wp_enqueue_script('iawp-dashboard-widget');
295 \wp_register_style('iawp-dashboard-widget-css', \IAWP_SCOPED\iawp_url_to('dist/styles/dashboard_widget.css'), [], \IAWP_VERSION);
296 \wp_enqueue_style('iawp-dashboard-widget-css');
297 }
298 $this->maybe_enqueue_menu_bar_stats_styles();
299 \wp_register_style('iawp-freemius-notice-styles', \IAWP_SCOPED\iawp_url_to('dist/styles/freemius_notice_styles.css'), [], \IAWP_VERSION);
300 \wp_enqueue_style('iawp-freemius-notice-styles');
301 }
302 public function enqueue_scripts($hook)
303 {
304 $this->maybe_enqueue_menu_bar_stats_styles();
305 }
306 public function enqueue_translations()
307 {
308 \wp_register_script('iawp-translations', '');
309 \wp_enqueue_script('iawp-translations');
310 \wp_add_inline_script('iawp-translations', 'const iawpText = ' . \json_encode(['visitors' => \__('Visitors', 'independent-analytics'), 'views' => \__('Views', 'independent-analytics'), 'sessions' => \__('Sessions', 'independent-analytics'), 'orders' => \__('Orders', 'independent-analytics'), 'netSales' => \__('Net Sales', 'independent-analytics'), 'country' => \__('country', 'independent-analytics'), 'exactDates' => \__('Apply Exact Dates', 'independent-analytics'), 'relativeDates' => \__('Apply Relative Dates', 'independent-analytics'), 'copied' => \esc_html__('Copied', 'independent-analytics'), 'exportingPages' => \esc_html__('Exporting Pages...', 'independent-analytics'), 'exportPages' => \esc_html__('Export Pages', 'independent-analytics'), 'exportingReferrers' => \esc_html__('Exporting Referrers...', 'independent-analytics'), 'exportReferrers' => \esc_html__('Export Referrers', 'independent-analytics'), 'exportingGeolocations' => \esc_html__('Exporting Geolocations...', 'independent-analytics'), 'exportGeolocations' => \esc_html__('Export Geolocations', 'independent-analytics'), 'exportingDevices' => \esc_html__('Exporting Devices...', 'independent-analytics'), 'exportDevices' => \esc_html__('Export Devices', 'independent-analytics'), 'exportingCampaigns' => \esc_html__('Exporting Campaigns...', 'independent-analytics'), 'exportCampaigns' => \esc_html__('Export Campaigns', 'independent-analytics'), 'invalidReportArchive' => \esc_html__('This report archive is invalid. Please export your reports and try again.', 'independent-analytics'), 'openMobileMenu' => \esc_html__('Open menu', 'independent-analytics'), 'closeMobileMenu' => \esc_html__('Close menu', 'independent-analytics')]), 'before');
311 }
312 public function enqueue_nonces()
313 {
314 \wp_register_script('iawp-nonces', '');
315 \wp_enqueue_script('iawp-nonces');
316 \wp_add_inline_script('iawp-nonces', 'const iawpActions = ' . \json_encode(AJAX_Manager::getInstance()->get_action_signatures()), 'before');
317 }
318 public function maybe_enqueue_menu_bar_stats_styles()
319 {
320 if (Menu_Bar_Stats::is_option_enabled()) {
321 \wp_register_style('iawp-front-end-css', \IAWP_SCOPED\iawp_url_to('dist/styles/menu_bar_stats.css'), [], \IAWP_VERSION);
322 \wp_enqueue_style('iawp-front-end-css');
323 }
324 }
325 public function get_option($name, $default)
326 {
327 $option = \get_option($name, $default);
328 return $option === '' ? $default : $option;
329 }
330 public function get_authors()
331 {
332 $roles = [];
333 foreach (\wp_roles()->roles as $role_name => $role_obj) {
334 if (!empty($role_obj['capabilities']['edit_posts'])) {
335 $roles[] = $role_name;
336 }
337 }
338 $users = \get_users(['role__in' => $roles]);
339 return $users;
340 }
341 public function get_custom_types(bool $tax = \false)
342 {
343 $args = ['public' => \true, '_builtin' => \false];
344 if ($tax) {
345 return \get_taxonomies($args);
346 } else {
347 return \get_post_types($args);
348 }
349 }
350 public function filter_connect_message_on_update($message, $user_first_name, $product_title, $user_login, $site_link, $freemius_link)
351 {
352 // Add the heading HTML.
353 $plugin_name = 'Independent Analytics';
354 $title = '<h3>' . \sprintf(\esc_html__('We hope you love %1$s', 'independent-analytics'), $plugin_name) . '</h3>';
355 $html = '';
356 // Add the introduction HTML.
357 $html .= '<p>';
358 $html .= \sprintf(\esc_html__('Hi, %1$s! This is an invitation to help the %2$s community.', 'independent-analytics'), $user_first_name, $plugin_name);
359 $html .= '<strong>';
360 $html .= \sprintf(\esc_html__('If you opt-in, some data about your usage of %2$s will be shared with us', 'independent-analytics'), $user_first_name, $plugin_name);
361 $html .= '</strong>';
362 $html .= \sprintf(\esc_html__(' so we can improve %2$s. We will also share some helpful info on using the plugin so you can get the most out of your sites analytics.', 'independent-analytics'), $user_first_name, $plugin_name);
363 $html .= '</p>';
364 $html .= '<p>';
365 $html .= \sprintf(\esc_html__('And if you skip this, that\'s okay! %1$s will still work just fine.', 'independent-analytics'), $plugin_name);
366 $html .= '</p>';
367 return $title . $html;
368 }
369 public function plugin_action_links($links)
370 {
371 // Create the link
372 $settings_link = '<a class="calendar-link" href="' . \esc_url(\IAWP_SCOPED\iawp_dashboard_url()) . '">' . \esc_html__('Analytics Dashboard', 'independent-analytics') . '</a>';
373 // Add the link to the start of the array
374 \array_unshift($links, $settings_link);
375 return $links;
376 }
377 public function set_time_limit($limit = 0)
378 {
379 if (!\function_exists('set_time_limit') && \false !== \strpos(\ini_get('disable_functions'), 'set_time_limit') && \ini_get('safe_mode')) {
380 return \false;
381 }
382 return @\set_time_limit($limit);
383 }
384 public function ip_db_attribution($text)
385 {
386 if ($this->get_current_tab() === 'geo') {
387 $text = $text . ' ' . \esc_html_x('Geolocation data powered by', 'Following text is a noun: DB-IP', 'independent-analytics') . ' ' . '<a href="https://db-ip.com" class="geo-message" target="_blank">DB-IP</a>.';
388 }
389 return $text;
390 }
391 public function pagination_page_size()
392 {
393 return 50;
394 }
395 public function get_current_tab() : string
396 {
397 if (\IAWP_SCOPED\iawp_is_pro()) {
398 $valid_tabs = ['views', 'referrers', 'geo', 'devices', 'campaigns', 'campaign-builder', 'real-time', 'settings', 'learn'];
399 } else {
400 $valid_tabs = ['views', 'referrers', 'geo', 'devices', 'settings', 'learn'];
401 }
402 $default_tab = $valid_tabs[0];
403 $tab = \array_key_exists('tab', $_GET) ? \sanitize_text_field($_GET['tab']) : \false;
404 $is_valid = \array_search($tab, $valid_tabs) != \false;
405 if (!$tab || !$is_valid) {
406 $tab = $default_tab;
407 }
408 return $tab;
409 }
410 }
411