PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 4.14.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v4.14.2
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / classes / WpMatomo / Admin / AdminSettings.php
matomo / classes / WpMatomo / Admin Last commit date
TrackingSettings 4 years ago views 3 years ago AccessSettings.php 4 years ago Admin.php 4 years ago AdminSettings.php 4 years ago AdminSettingsInterface.php 6 years ago AdvancedSettings.php 4 years ago Chart.php 4 years ago CookieConsent.php 4 years ago Dashboard.php 4 years ago ExclusionSettings.php 4 years ago GeolocationSettings.php 4 years ago GetStarted.php 4 years ago ImportWpStatistics.php 4 years ago Info.php 4 years ago InvalidIpException.php 4 years ago Marketplace.php 4 years ago Menu.php 3 years ago PrivacySettings.php 4 years ago SafeModeMenu.php 4 years ago Summary.php 4 years ago SystemReport.php 3 years ago TrackingSettings.php 4 years ago
AdminSettings.php
100 lines
1 <?php
2 /**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 * @package matomo
8 */
9
10 namespace WpMatomo\Admin;
11
12 use WpMatomo\Access;
13 use WpMatomo\Settings;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit; // if accessed directly
17 }
18
19 class AdminSettings {
20 const TAB_TRACKING = 'tracking';
21 const TAB_ACCESS = 'access';
22 const TAB_EXCLUSIONS = 'exlusions';
23 const TAB_PRIVACY = 'privacy';
24 const TAB_GEOLOCATION = 'geolocation';
25 const TAB_ADVANCED = 'advanced';
26
27 /**
28 * @var Settings
29 */
30 private $settings;
31
32 public function __construct( Settings $settings ) {
33 $this->settings = $settings;
34 }
35
36 public static function make_url( $tab ) {
37 global $_parent_pages;
38 $menu_slug = Menu::SLUG_SETTINGS;
39
40 if ( is_multisite() && is_network_admin() ) {
41 if ( isset( $_parent_pages[ $menu_slug ] ) ) {
42 $parent_slug = $_parent_pages[ $menu_slug ];
43 if ( $parent_slug && ! isset( $_parent_pages[ $parent_slug ] ) ) {
44 $url = network_admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) );
45 } else {
46 $url = network_admin_url( 'admin.php?page=' . $menu_slug );
47 }
48 } else {
49 $url = '';
50 }
51 } else {
52 $url = menu_page_url( $menu_slug, false );
53 }
54
55 return add_query_arg( [ 'tab' => $tab ], $url );
56 }
57
58 public function show() {
59 $access = new Access( $this->settings );
60 $access_settings = new AccessSettings( $access, $this->settings );
61 $tracking = new TrackingSettings( $this->settings );
62 $exclusions = new ExclusionSettings( $this->settings );
63 $geolocation = new GeolocationSettings( $this->settings );
64 $privacy = new PrivacySettings( $this->settings );
65 $advanced = new AdvancedSettings( $this->settings );
66 $setting_tabs = [
67 self::TAB_TRACKING => $tracking,
68 self::TAB_ACCESS => $access_settings,
69 self::TAB_PRIVACY => $privacy,
70 self::TAB_EXCLUSIONS => $exclusions,
71 self::TAB_GEOLOCATION => $geolocation,
72 self::TAB_ADVANCED => $advanced,
73 ];
74
75 $active_tab = self::TAB_TRACKING;
76
77 if ( $this->settings->is_network_enabled() && ! is_network_admin() ) {
78 $active_tab = self::TAB_EXCLUSIONS;
79 $setting_tabs = [
80 self::TAB_EXCLUSIONS => $exclusions,
81 self::TAB_PRIVACY => $privacy,
82 ];
83 }
84
85 $setting_tabs = apply_filters( 'matomo_setting_tabs', $setting_tabs, $this->settings );
86
87 if ( ! empty( $_GET['tab'] ) ) {
88 $tab = sanitize_text_field( wp_unslash( $_GET['tab'] ) );
89 if ( isset( $setting_tabs[ $tab ] ) ) {
90 $active_tab = $tab;
91 }
92 }
93
94 $content_tab = $setting_tabs[ $active_tab ];
95 $matomo_settings = $this->settings;
96
97 include dirname( __FILE__ ) . '/views/settings.php';
98 }
99 }
100