TrackingSettings
5 years ago
views
5 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
Dashboard.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
5 years ago
PrivacySettings.php
5 years ago
SafeModeMenu.php
6 years ago
Summary.php
5 years ago
SystemReport.php
5 years ago
TrackingSettings.php
5 years ago
SafeModeMenu.php
58 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\Settings; |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // if accessed directly |
| 16 | } |
| 17 | |
| 18 | class SafeModeMenu { |
| 19 | /** |
| 20 | * @var Settings |
| 21 | */ |
| 22 | private $settings; |
| 23 | |
| 24 | private $parent_slug = 'matomo'; |
| 25 | |
| 26 | /** |
| 27 | * @param Settings $settings |
| 28 | */ |
| 29 | public function __construct( $settings ) { |
| 30 | $this->settings = $settings; |
| 31 | add_action( 'admin_menu', array( $this, 'add_menu' ) ); |
| 32 | add_action( 'network_admin_menu', array( $this, 'add_menu' ) ); |
| 33 | } |
| 34 | |
| 35 | public function add_menu() { |
| 36 | if ( ! \WpMatomo::is_admin_user() ) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | $system_report = new SystemReport( $this->settings ); |
| 41 | |
| 42 | add_menu_page( 'Matomo Analytics', 'Matomo Analytics', Menu::CAP_NOT_EXISTS, 'matomo', null, 'dashicons-analytics' ); |
| 43 | |
| 44 | add_submenu_page( |
| 45 | $this->parent_slug, |
| 46 | __( 'System Report', 'matomo' ), |
| 47 | __( 'System Report', 'matomo' ), |
| 48 | 'administrator', |
| 49 | Menu::SLUG_SYSTEM_REPORT, |
| 50 | array( |
| 51 | $system_report, |
| 52 | 'show', |
| 53 | ) |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | } |
| 58 |