TrackingSettings
6 years ago
views
6 years ago
AccessSettings.php
6 years ago
Admin.php
6 years ago
AdminSettings.php
6 years ago
AdminSettingsInterface.php
6 years ago
AdvancedSettings.php
6 years ago
ExclusionSettings.php
6 years ago
GeolocationSettings.php
6 years ago
GetStarted.php
6 years ago
Info.php
6 years ago
Marketplace.php
6 years ago
Menu.php
6 years ago
PrivacySettings.php
6 years ago
SafeModeMenu.php
6 years ago
Summary.php
6 years ago
SystemReport.php
6 years ago
TrackingSettings.php
6 years ago
AdminSettings.php
71 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 | return add_query_arg( array( 'tab' => $tab ), menu_page_url( Menu::SLUG_SETTINGS, false ) ); |
| 38 | } |
| 39 | |
| 40 | public function show() { |
| 41 | $access = new Access( $this->settings ); |
| 42 | $access_settings = new AccessSettings( $access, $this->settings ); |
| 43 | $tracking = new TrackingSettings( $this->settings ); |
| 44 | $exclusions = new ExclusionSettings( $this->settings ); |
| 45 | $geolocation = new GeolocationSettings( $this->settings ); |
| 46 | $privacy = new PrivacySettings(); |
| 47 | $advanced = new AdvancedSettings(); |
| 48 | $setting_tabs = array( |
| 49 | self::TAB_TRACKING => $tracking, |
| 50 | self::TAB_ACCESS => $access_settings, |
| 51 | self::TAB_PRIVACY => $privacy, |
| 52 | self::TAB_EXCLUSIONS => $exclusions, |
| 53 | self::TAB_GEOLOCATION => $geolocation, |
| 54 | self::TAB_ADVANCED => $advanced, |
| 55 | ); |
| 56 | |
| 57 | $setting_tabs = apply_filters( 'matomo_setting_tabs', $setting_tabs, $this->settings ); |
| 58 | |
| 59 | if ( ! empty( $_GET['tab'] ) && isset( $setting_tabs[ $_GET['tab'] ] ) ) { |
| 60 | $active_tab = $_GET['tab']; |
| 61 | } else { |
| 62 | $active_tab = self::TAB_TRACKING; |
| 63 | } |
| 64 | |
| 65 | $content_tab = $setting_tabs[ $active_tab ]; |
| 66 | |
| 67 | include dirname( __FILE__ ) . '/views/settings.php'; |
| 68 | } |
| 69 | |
| 70 | } |
| 71 |