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
Summary.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\Report\Dates; |
| 13 | use WpMatomo\Report\Metadata; |
| 14 | use WpMatomo\Settings; |
| 15 | |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit; // if accessed directly |
| 18 | } |
| 19 | |
| 20 | class Summary { |
| 21 | |
| 22 | /** |
| 23 | * @var Settings |
| 24 | */ |
| 25 | private $settings; |
| 26 | |
| 27 | /** |
| 28 | * @param Settings $settings |
| 29 | */ |
| 30 | public function __construct( $settings ) { |
| 31 | $this->settings = $settings; |
| 32 | } |
| 33 | |
| 34 | public function show() { |
| 35 | $settings = $this->settings; |
| 36 | |
| 37 | $reports_to_show = $this->get_reports_to_show(); |
| 38 | $filter_limit = apply_filters( 'matomo_report_summary_filter_limit', 10 ); |
| 39 | |
| 40 | $report_dates_obj = new Dates(); |
| 41 | $report_dates = $report_dates_obj->get_supported_dates(); |
| 42 | |
| 43 | $report_date = Dates::YESTERDAY; |
| 44 | if ( isset( $_GET['report_date'] ) && isset( $report_dates[ $_GET['report_date'] ] ) ) { |
| 45 | $report_date = $_GET['report_date']; |
| 46 | } |
| 47 | |
| 48 | list( $report_period_selected, $report_date_selected ) = $report_dates_obj->detect_period_and_date( $report_date ); |
| 49 | |
| 50 | $is_tracking = $this->settings->is_tracking_enabled(); |
| 51 | |
| 52 | include dirname( __FILE__ ) . '/views/summary.php'; |
| 53 | } |
| 54 | |
| 55 | private function get_reports_to_show() { |
| 56 | $reports_to_show = array( |
| 57 | 'VisitsSummary_get', |
| 58 | 'UserCountry_getCountry', |
| 59 | 'DevicesDetection_getType', |
| 60 | 'Resolution_getResolution', |
| 61 | 'DevicesDetection_getOsFamilies', |
| 62 | 'DevicesDetection_getBrowsers', |
| 63 | 'VisitTime_getVisitInformationPerServerTime', |
| 64 | 'Actions_get', |
| 65 | 'Actions_getPageTitles', |
| 66 | 'Actions_getEntryPageTitles', |
| 67 | 'Actions_getExitPageTitles', |
| 68 | 'Actions_getDownloads', |
| 69 | 'Actions_getOutlinks', |
| 70 | 'Referrers_getAll', |
| 71 | 'Referrers_getSocials', |
| 72 | 'Referrers_getCampaigns', |
| 73 | 'Goals_get', |
| 74 | ); |
| 75 | |
| 76 | if ( $this->settings->get_global_option( 'track_ecommerce' ) ) { |
| 77 | $reports_to_show[] = 'Goals_get_idGoal--ecommerceOrder'; |
| 78 | $reports_to_show[] = 'Goals_getItemsName'; |
| 79 | } |
| 80 | |
| 81 | $reports_to_show = apply_filters( 'matomo_report_summary_report_ids', $reports_to_show ); |
| 82 | |
| 83 | $report_metadata = array(); |
| 84 | $metadata = new Metadata(); |
| 85 | foreach ( $reports_to_show as $report_unique_id ) { |
| 86 | $report = $metadata->find_report_by_unique_id( $report_unique_id ); |
| 87 | if ( $report ) { |
| 88 | $report_page = $metadata->find_report_page_params_by_report_metadata( $report ); |
| 89 | if ( $report_page ) { |
| 90 | $report['page'] = $report_page; |
| 91 | } |
| 92 | $report_metadata[] = $report; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | return $report_metadata; |
| 97 | } |
| 98 | |
| 99 | } |
| 100 |