access.php
2 years ago
advanced_settings.php
2 years ago
exclusion_settings.php
4 years ago
geolocation_settings.php
2 years ago
get_started.php
4 years ago
import_wp_statistics.php
4 years ago
info.php
4 years ago
info_bug_report.php
2 years ago
info_help.php
4 years ago
info_high_traffic.php
2 years ago
info_multisite.php
2 years ago
info_newsletter.php
4 years ago
info_shared.php
4 years ago
marketplace.php
2 years ago
marketplace_setup_wizard.php
2 years ago
measurable_settings.php
2 years ago
privacy_gdpr.php
4 years ago
scheduled_tasks_failures.php
2 years ago
settings.php
4 years ago
settings_errors.php
4 years ago
summary.php
4 years ago
systemreport.php
2 years ago
tracking.php
3 years ago
update_notice_clear_cache.php
5 years ago
exclusion_settings.php
168 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 | * Code Based on |
| 9 | * @author André Bräkling |
| 10 | * https://github.com/braekling/matomo |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | use Piwik\Piwik; |
| 15 | use WpMatomo\Admin\ExclusionSettings; |
| 16 | use WpMatomo\Settings; |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; |
| 20 | } |
| 21 | /** @var bool $was_updated */ |
| 22 | /** @var bool $exclude_visits_cookie */ |
| 23 | /** @var string $current_ip */ |
| 24 | /** @var string $excluded_ips */ |
| 25 | /** @var string $excluded_user_agents */ |
| 26 | /** @var string $excluded_query_params */ |
| 27 | /** @var bool|string|int $keep_url_fragments */ |
| 28 | /** @var Settings $settings */ |
| 29 | /** @var string[] $settings_errors */ |
| 30 | ?> |
| 31 | |
| 32 | <?php |
| 33 | if ( $was_updated ) { |
| 34 | include 'update_notice_clear_cache.php'; |
| 35 | } |
| 36 | if ( count( $settings_errors ) ) { |
| 37 | include 'settings_errors.php'; |
| 38 | } |
| 39 | ?> |
| 40 | <?php if ( $settings->is_network_enabled() && is_network_admin() ) { ?> |
| 41 | <h2>Exclusion settings</h2> |
| 42 | <p> |
| 43 | Exclusion settings have to be configured on a per blog basis. |
| 44 | Should you wish to change any setting, please go to the Matomo exclusion settings within each blog. |
| 45 | We are hoping to improve this in the future. |
| 46 | </p> |
| 47 | <?php } else { ?> |
| 48 | |
| 49 | <form method="post"> |
| 50 | <?php wp_nonce_field( ExclusionSettings::NONCE_NAME ); ?> |
| 51 | |
| 52 | <p><?php esc_html_e( 'Configure exclusions.', 'matomo' ); ?></p> |
| 53 | <table class="matomo-tracking-form widefat"> |
| 54 | <tbody> |
| 55 | |
| 56 | <tr> |
| 57 | <th width="20%" scope="row"><label><?php esc_html_e( 'Tracking filter', 'matomo' ); ?></label>: |
| 58 | </th> |
| 59 | <td> |
| 60 | <?php |
| 61 | $matomo_tracking_caps = Settings::OPTION_KEY_STEALTH; |
| 62 | $matomo_filter = $settings->get_global_option( $matomo_tracking_caps ); |
| 63 | foreach ( $wp_roles->role_names as $matomo_key => $matomo_name ) { |
| 64 | echo '<input type="checkbox" ' . ( isset( $matomo_filter [ $matomo_key ] ) && $matomo_filter [ $matomo_key ] ? 'checked="checked" ' : '' ) . 'value="1" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[' . esc_attr( $matomo_tracking_caps ) . '][' . esc_attr( $matomo_key ) . ']" /> ' . esc_html( $matomo_name ) . ' <br />'; |
| 65 | } |
| 66 | ?> |
| 67 | </td> |
| 68 | <td width="50%"> |
| 69 | <?php echo sprintf( esc_html__( 'Choose users by user role you do %1$snot%2$s want to track.', 'matomo' ), '<strong>', '</strong>' ); ?> |
| 70 | <?php if ( $settings->is_network_enabled() ) { ?> |
| 71 | <br><p><strong>This setting will be applied to all blogs. Changing it here also changes it for |
| 72 | other blogs.</strong></p> |
| 73 | <?php } ?> |
| 74 | </td> |
| 75 | </tr> |
| 76 | <tr> |
| 77 | <th width="20%" scope="row"> |
| 78 | <label><?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedIps' ) ); ?></label>: |
| 79 | </th> |
| 80 | <td width="30%"> |
| 81 | <?php echo sprintf( '<textarea cols="40" rows="4" id="%1$s" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">%2$s</textarea>', 'excluded_ips', esc_html( $excluded_ips ) ); ?> |
| 82 | </td> |
| 83 | <td width="50%"> |
| 84 | <?php |
| 85 | echo esc_html( |
| 86 | Piwik::translate( |
| 87 | 'SitesManager_HelpExcludedIpAddresses', |
| 88 | [ |
| 89 | '1.2.3.4/24', |
| 90 | '1.2.3.*', |
| 91 | '1.2.*.*', |
| 92 | ] |
| 93 | ) |
| 94 | ) |
| 95 | ?> |
| 96 | <br/> |
| 97 | <?php echo esc_html( Piwik::translate( 'SitesManager_YourCurrentIpAddressIs', esc_html( $current_ip ) ) ); ?> |
| 98 | </td> |
| 99 | </tr> |
| 100 | <tr> |
| 101 | <th scope="row"> |
| 102 | <label><?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedQueryParameters' ) ); ?></label>: |
| 103 | </th> |
| 104 | <td> |
| 105 | <?php echo sprintf( '<textarea cols="40" rows="4" id="%1$s" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">%2$s</textarea>', 'excluded_query_parameters', esc_html( $excluded_query_params ) ); ?> |
| 106 | </td> |
| 107 | <td> |
| 108 | <?php echo esc_html( Piwik::translate( 'SitesManager_ListOfQueryParametersToExclude', '/^sess.*|.*[dD]ate$/' ) ); ?> |
| 109 | <?php echo esc_html( Piwik::translate( 'SitesManager_PiwikWillAutomaticallyExcludeCommonSessionParameters', 'phpsessid, sessionid, ...' ) ); ?> |
| 110 | </td> |
| 111 | </tr> |
| 112 | <tr> |
| 113 | <th scope="row"> |
| 114 | <label><?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedUserAgents' ) ); ?></label>: |
| 115 | </th> |
| 116 | <td> |
| 117 | <?php echo sprintf( '<textarea cols="40" rows="4" id="%1$s" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">%2$s</textarea>', 'excluded_user_agents', esc_html( $excluded_user_agents ) ); ?> |
| 118 | </td> |
| 119 | <td> |
| 120 | |
| 121 | <?php echo esc_html( Piwik::translate( 'SitesManager_GlobalExcludedUserAgentHelp1' ) ); ?> |
| 122 | <br/> |
| 123 | <?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedUserAgents_Desc' ) ); ?> |
| 124 | <?php echo esc_html( Piwik::translate( 'SitesManager_GlobalExcludedUserAgentHelp2' ) ); ?> |
| 125 | <?php echo esc_html( Piwik::translate( 'SitesManager_GlobalExcludedUserAgentHelp3', '/bot|spider|crawl|scanner/i' ) ); ?> |
| 126 | </td> |
| 127 | </tr> |
| 128 | <tr> |
| 129 | <th scope="row"> |
| 130 | <label><?php echo esc_html( Piwik::translate( 'SitesManager_KeepURLFragmentsLong' ) ); ?></label>: |
| 131 | </th> |
| 132 | <td> |
| 133 | <?php |
| 134 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 135 | echo sprintf( '<input type="checkbox" value="1" %2$s name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">', 'keep_url_fragments', $keep_url_fragments ? ' checked="checked"' : '' ); |
| 136 | ?> |
| 137 | </td> |
| 138 | <td> |
| 139 | |
| 140 | <?php |
| 141 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 142 | echo Piwik::translate( |
| 143 | 'SitesManager_KeepURLFragmentsHelp', |
| 144 | [ |
| 145 | '<em>#</em>', |
| 146 | '<em>example.org/index.html#first_section</em>', |
| 147 | '<em>example.org/index.html</em>', |
| 148 | ] |
| 149 | ) |
| 150 | ?> |
| 151 | <br/> |
| 152 | <?php echo esc_html( Piwik::translate( 'SitesManager_KeepURLFragmentsHelp2' ) ); ?> |
| 153 | |
| 154 | </td> |
| 155 | </tr> |
| 156 | <tr> |
| 157 | <td colspan="3"> |
| 158 | <p class="submit"><input name="Submit" type="submit" class="button-primary" |
| 159 | value="<?php echo esc_attr__( 'Save Changes', 'matomo' ); ?>"/></p> |
| 160 | </td> |
| 161 | </tr> |
| 162 | |
| 163 | </tbody> |
| 164 | </table> |
| 165 | </form> |
| 166 | |
| 167 | <?php } ?> |
| 168 |