access.php
6 years ago
advanced_settings.php
5 years ago
exclusion_settings.php
6 years ago
geolocation_settings.php
6 years ago
get_started.php
6 years ago
info.php
5 years ago
info_bug_report.php
6 years ago
info_help.php
5 years ago
info_high_traffic.php
6 years ago
info_multisite.php
6 years ago
info_newsletter.php
6 years ago
info_shared.php
6 years ago
marketplace.php
5 years ago
privacy_gdpr.php
5 years ago
settings.php
6 years ago
summary.php
5 years ago
systemreport.php
6 years ago
tracking.php
5 years ago
update_notice_clear_cache.php
6 years ago
summary.php
140 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 | use WpMatomo\Admin\Menu; |
| 11 | use WpMatomo\Report\Dates; |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** @var array $report_metadata */ |
| 18 | /** @var array $report_dates */ |
| 19 | /** @var array $reports_to_show */ |
| 20 | /** @var string $report_date */ |
| 21 | /** @var string $report_period_selected */ |
| 22 | /** @var string $report_date_selected */ |
| 23 | /** @var bool $matomo_pinned */ |
| 24 | /** @var bool $is_tracking */ |
| 25 | /** @var bool $matomo_is_version_pre55 */ |
| 26 | /** @var \WpMatomo\Admin\Dashboard $matomo_dashboard */ |
| 27 | global $wp; |
| 28 | |
| 29 | $matomo_dashboard_nonce = wp_create_nonce(\WpMatomo\Admin\Summary::NONCE_DASHBOARD); |
| 30 | ?> |
| 31 | <?php |
| 32 | if ($matomo_pinned) { |
| 33 | echo '<div class="notice notice-success"><p>' . esc_html__( 'Dashboard updated.', 'matomo' ) . '</p></div>'; |
| 34 | } |
| 35 | if ($matomo_is_version_pre55) { |
| 36 | echo '<style type="text/css">.handle-actions { position: absolute; right: 0;top: 0;}</style>'; |
| 37 | } |
| 38 | ?> |
| 39 | <?php if ( ! $is_tracking ) { ?> |
| 40 | <div class="notice notice-warning"><p><?php esc_html_e( 'Matomo Tracking is not enabled.', 'matomo' ); ?></p></div> |
| 41 | <?php } ?> |
| 42 | <div class="wrap"> |
| 43 | <div id="icon-plugins" class="icon32"></div> |
| 44 | <h1><?php matomo_header_icon(); ?> <?php esc_html_e( 'Summary', 'matomo' ); ?></h1> |
| 45 | <?php |
| 46 | if ( Dates::TODAY === $report_date ) { |
| 47 | echo '<div class="notice notice-info" style="padding:8px;">' . esc_html__( 'Reports for today are only refreshed approximately every hour through the WordPress cronjob.', 'matomo' ) . '</div>'; |
| 48 | } |
| 49 | ?> |
| 50 | <p><?php esc_html_e( 'Looking for all reports and advanced features like segmentation, real time reports, and more?', 'matomo' ); ?> |
| 51 | <a href="<?php echo add_query_arg( array( 'report_date' => $report_date ), menu_page_url( Menu::SLUG_REPORTING, false ) ); ?>" |
| 52 | ><?php esc_html_e( 'View full reporting', 'matomo' ); ?></a> |
| 53 | <br/><br/> |
| 54 | <?php esc_html_e( 'Change date:', 'matomo' ); ?> |
| 55 | <?php |
| 56 | foreach ( $report_dates as $matomo_report_date_key => $matomo_report_name ) { |
| 57 | $matomo_button_class = 'button'; |
| 58 | if ( $report_date === $matomo_report_date_key ) { |
| 59 | $matomo_button_class = 'button-primary'; |
| 60 | } |
| 61 | echo '<a href="' . esc_url( add_query_arg( array( 'report_date' => $matomo_report_date_key ), menu_page_url( Menu::SLUG_REPORT_SUMMARY, false ) ) ) . '" class="' . $matomo_button_class . '">' . esc_html( $matomo_report_name ) . '</a> '; |
| 62 | } |
| 63 | ?> |
| 64 | |
| 65 | <div id="dashboard-widgets" class="metabox-holder has-right-sidebar matomo-dashboard-container"> |
| 66 | <?php |
| 67 | $matomo_columns = array( 1, 0 ); |
| 68 | foreach ( $matomo_columns as $matomo_column_index => $matomo_column_modulo ) { |
| 69 | ?> |
| 70 | <div id="postbox-container-<?php echo( $matomo_column_index + 1 ); ?>" class="postbox-container"> |
| 71 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
| 72 | <?php |
| 73 | foreach ( $reports_to_show as $matomo_index => $matomo_report_meta ) { |
| 74 | if ( $matomo_index % 2 === $matomo_column_modulo ) { |
| 75 | continue; |
| 76 | } |
| 77 | $shortcode = sprintf( '[matomo_report unique_id=%s report_date=%s limit=10]', $matomo_report_meta['uniqueId'], $report_date ); |
| 78 | ?> |
| 79 | <div class="postbox "> |
| 80 | <div class="postbox-header"> |
| 81 | <h2 class="hndle ui-sortable-handle" |
| 82 | style="cursor: help;" |
| 83 | title="<?php echo ! empty( $matomo_report_meta['documentation'] ) ? ( wp_strip_all_tags( $matomo_report_meta['documentation'] ) . ' ' ) : null; ?><?php esc_html_e( 'You can embed this report on any page using the shortcode:', 'matomo' ); ?> <?php echo esc_attr( $shortcode ); ?>" |
| 84 | > |
| 85 | <?php echo esc_html( $matomo_report_meta['name'] ); ?></h2> |
| 86 | <div class="handle-actions hide-if-no-js"> |
| 87 | <?php if ( ! empty( $matomo_report_meta['page'] ) ) { ?> |
| 88 | <button type="button" class="handlediv" aria-expanded="true" |
| 89 | title="<?php esc_html_e( 'Click to view the report in detail', 'matomo' ); ?>"><a |
| 90 | href=" |
| 91 | <?php |
| 92 | |
| 93 | echo Menu::get_matomo_reporting_url( |
| 94 | $matomo_report_meta['page']['category'], |
| 95 | $matomo_report_meta['page']['subcategory'], |
| 96 | array( |
| 97 | 'period' => $report_period_selected, |
| 98 | 'date' => $report_date_selected, |
| 99 | ) |
| 100 | ); |
| 101 | ?> |
| 102 | " style="color: inherit;text-decoration: none;" target="_blank" rel="noreferrer noopener" |
| 103 | class="dashicons-before dashicons-external" aria-hidden="true"></a></button> |
| 104 | <?php } ?> |
| 105 | |
| 106 | <?php |
| 107 | $matomo_is_dashboard_widget = $matomo_dashboard->has_widget($matomo_report_meta['uniqueId'], $report_date); |
| 108 | ?> |
| 109 | <button type="button" class="handlediv" aria-expanded="true" |
| 110 | title="<?php if ($matomo_is_dashboard_widget) { esc_html_e( 'Click to remove this report from the WordPress admin dashboard', 'matomo' ); } else { esc_html_e( 'Click to add this report to the WordPress admin dashboard', 'matomo' ); } ?>"><a |
| 111 | href=" |
| 112 | <?php |
| 113 | echo esc_url(add_query_arg(array( |
| 114 | 'pin' => true, |
| 115 | '_wpnonce' => $matomo_dashboard_nonce, |
| 116 | 'report_uniqueid' => $matomo_report_meta['uniqueId'], |
| 117 | 'report_date' => $report_date, |
| 118 | ), menu_page_url(Menu::SLUG_REPORT_SUMMARY, false))); |
| 119 | ?> |
| 120 | " style="color: inherit;text-decoration: none;<?php if ($matomo_is_dashboard_widget) { echo 'opacity: 0.4 !important'; } ?>" |
| 121 | class="dashicons-before dashicons-admin-post" aria-hidden="true"></a></button> |
| 122 | |
| 123 | </div></div> |
| 124 | <div> |
| 125 | <?php echo do_shortcode( $shortcode ); ?> |
| 126 | </div> |
| 127 | </div> |
| 128 | <?php } ?> |
| 129 | </div> |
| 130 | </div> |
| 131 | <?php } ?> |
| 132 | </div> |
| 133 | |
| 134 | <p style="clear:both;"> |
| 135 | <?php esc_html_e( 'Did you know? You can embed any report into any page or post using a shortcode. Simply hover the title to find the correct shortcode.', 'matomo' ); ?> |
| 136 | <?php esc_html_e( 'Only users with view access will be able to view the content of the report.', 'matomo' ); ?> |
| 137 | <?php esc_html_e( 'Note: Embedding report data can be tricky if you are using caching plugins that cache the entire HTML of your page or post. In case you are using such a plugin, we recommend you disable the caching for these pages.', 'matomo' ); ?> |
| 138 | </p> |
| 139 | </div> |
| 140 |