PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.5.1
Independent Analytics – WordPress Analytics Plugin v2.5.1
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 / Admin_Page / Analytics_Page.php
independent-analytics / IAWP / Admin_Page Last commit date
Admin_Page.php 2 years ago Analytics_Page.php 2 years ago Campaign_Builder_Page.php 2 years ago Settings_Page.php 2 years ago Support_Page.php 2 years ago Updates_Page.php 2 years ago
Analytics_Page.php
153 lines
1 <?php
2
3 namespace IAWP\Admin_Page;
4
5 use IAWP\Capability_Manager;
6 use IAWP\Chart;
7 use IAWP\Chart_Geo;
8 use IAWP\Dashboard_Options;
9 use IAWP\Database;
10 use IAWP\Env;
11 use IAWP\Plugin_Conflict_Detector;
12 use IAWP\Quick_Stats;
13 use IAWP\Real_Time;
14 use IAWP\Report_Finder;
15 use IAWP\Tables\Table;
16 use IAWP\Tables\Table_Campaigns;
17 use IAWP\Tables\Table_Devices;
18 use IAWP\Tables\Table_Geo;
19 use IAWP\Tables\Table_Pages;
20 use IAWP\Tables\Table_Referrers;
21 use IAWP\Utils\Security;
22 /** @internal */
23 class Analytics_Page extends \IAWP\Admin_Page\Admin_Page
24 {
25 protected function render_page()
26 {
27 $options = Dashboard_Options::getInstance();
28 $date_rage = $options->get_date_range();
29 $date_label = $date_rage->label();
30 $tab = (new Env())->get_tab();
31 if ($tab === 'views') {
32 $table = new Table_Pages();
33 $statistics_class = $table->group()->statistics_class();
34 $statistics = new $statistics_class($date_rage, null, $options->chart_interval());
35 $stats = new Quick_Stats($statistics);
36 $chart = new Chart($statistics, $date_label);
37 $this->interface($table, $stats, $chart);
38 } elseif ($tab === 'referrers') {
39 $table = new Table_Referrers();
40 $statistics_class = $table->group()->statistics_class();
41 $statistics = new $statistics_class($date_rage, null, $options->chart_interval());
42 $stats = new Quick_Stats($statistics);
43 $chart = new Chart($statistics, $date_label);
44 $this->interface($table, $stats, $chart);
45 } elseif ($tab === 'geo') {
46 $table = new Table_Geo($options->group());
47 $statistics_class = $table->group()->statistics_class();
48 $statistics = new $statistics_class($date_rage, null, $options->chart_interval());
49 $stats = new Quick_Stats($statistics);
50 $table_data_class = $table->group()->rows_class();
51 $geo_data = new $table_data_class($date_rage);
52 $chart = new Chart_Geo($geo_data->rows(), $date_label);
53 $this->interface($table, $stats, $chart);
54 } elseif ($tab === 'campaigns') {
55 $table = new Table_Campaigns();
56 $statistics_class = $table->group()->statistics_class();
57 $statistics = new $statistics_class($date_rage, null, $options->chart_interval());
58 $stats = new Quick_Stats($statistics);
59 $chart = new Chart($statistics, $date_label);
60 $this->interface($table, $stats, $chart);
61 } elseif ($tab === 'devices') {
62 $table = new Table_Devices($options->group());
63 $statistics_class = $table->group()->statistics_class();
64 $statistics = new $statistics_class($date_rage, null, $options->chart_interval());
65 $stats = new Quick_Stats($statistics);
66 $chart = new Chart($statistics, $date_label);
67 $this->interface($table, $stats, $chart);
68 } elseif ($tab === 'real-time') {
69 (new Real_Time())->render_real_time_analytics();
70 }
71 }
72 private function interface(Table $table, $stats, $chart)
73 {
74 $options = Dashboard_Options::getInstance();
75 $sort_configuration = $table->sanitize_sort_parameters($options->sort_column(), $options->sort_direction());
76 ?>
77 <div data-controller="report"
78 data-report-name-value="<?php
79 echo Security::string($options->report_name());
80 ?>"
81 data-report-relative-range-id-value="<?php
82 echo Security::attr($options->relative_range_id());
83 ?>"
84 data-report-exact-start-value="<?php
85 echo Security::attr($options->start());
86 ?>"
87 data-report-exact-end-value="<?php
88 echo Security::attr($options->end());
89 ?>"
90 data-report-group-value="<?php
91 echo Security::attr($options->group());
92 ?>"
93 data-report-filters-value="<?php
94 echo \esc_attr(Security::json_encode($options->filters()));
95 ?>"
96 data-report-chart-interval-value="<?php
97 echo Security::attr($options->chart_interval()->id());
98 ?>"
99 data-report-sort-column-value="<?php
100 echo Security::attr($options->sort_column());
101 ?>"
102 data-report-sort-direction-value="<?php
103 echo Security::attr($options->sort_direction());
104 ?>"
105 data-report-columns-value="<?php
106 echo \esc_attr(Security::json_encode($table->visible_column_ids()));
107 ?>"
108 data-report-quick-stats-value="<?php
109 echo \esc_attr(Security::json_encode($options->visible_quick_stats()));
110 ?>"
111 data-report-visible-datasets-value="<?php
112 echo \esc_attr(Security::json_encode($options->visible_datasets()));
113 ?>"
114 >
115 <div id="report-header-container" class="report-header-container">
116 <?php
117 echo \IAWPSCOPED\iawp_blade()->run('partials.report-header', ['report' => (new Report_Finder())->current(), 'can_edit' => Capability_Manager::can_edit()]);
118 ?>
119 <?php
120 $table->output_report_toolbar();
121 ?>
122 <div class="modal-background"></div>
123 </div>
124 <?php
125 echo $stats->get_html();
126 ?>
127 <?php
128 echo $chart->get_html($options->visible_datasets());
129 ?>
130 <?php
131 echo $table->get_table_toolbar_markup();
132 ?>
133 <?php
134 echo $table->get_table_markup($sort_configuration->column(), $sort_configuration->direction());
135 ?>
136 </div>
137 <div class="iawp-notices">
138 <?php
139 $plugin_conflict_detector = new Plugin_Conflict_Detector();
140 if (!$plugin_conflict_detector->has_conflict()) {
141 echo \IAWPSCOPED\iawp_blade()->run('settings.notice', ['notice_text' => $plugin_conflict_detector->get_error(), 'button_text' => \false, 'notice' => 'iawp-error', 'url' => 'https://independentwp.com/knowledgebase/tracking/secure-rest-api/']);
142 }
143 if (\get_option('iawp_need_clear_cache')) {
144 echo \IAWPSCOPED\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/']);
145 }
146 if (\IAWPSCOPED\iawp_db_version() > 0 && !Database::has_correct_database_privileges()) {
147 echo \IAWPSCOPED\iawp_blade()->run('settings.notice', ['notice_text' => \__('Your site is missing the following critical database permissions:', 'independent-analytics') . ' ' . \implode(', ', Database::missing_database_privileges()) . '. ' . \__('There is no issue at this time, but you will need to enable the missing permissions before updating the plugin to a newer version to ensure an error is avoided. Please click this link to read our tutorial:', 'independent-analytics'), 'button_text' => \false, 'notice' => 'iawp-error', 'url' => 'https://independentwp.com/knowledgebase/common-questions/missing-database-permissions/']);
148 }
149 ?>
150 </div><?php
151 }
152 }
153