Admin
3 years ago
Commands
4 years ago
Db
4 years ago
Ecommerce
3 years ago
Report
4 years ago
Site
4 years ago
TrackingCode
4 years ago
Updater
4 years ago
User
3 years ago
WpStatistics
4 years ago
views
4 years ago
API.php
4 years ago
Access.php
4 years ago
AjaxTracker.php
5 years ago
Annotations.php
4 years ago
Bootstrap.php
4 years ago
Capabilities.php
4 years ago
Compatibility.php
4 years ago
Email.php
4 years ago
Installer.php
4 years ago
Logger.php
4 years ago
OptOut.php
4 years ago
Paths.php
4 years ago
PrivacyBadge.php
4 years ago
RedirectOnActivation.php
4 years ago
Referral.php
4 years ago
Roles.php
4 years ago
ScheduledTasks.php
4 years ago
Settings.php
4 years ago
Site.php
3 years ago
TrackingCode.php
4 years ago
Uninstaller.php
4 years ago
Updater.php
4 years ago
User.php
4 years ago
PrivacyBadge.php
43 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; |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; // if accessed directly |
| 14 | } |
| 15 | |
| 16 | class PrivacyBadge { |
| 17 | public function register_hooks() { |
| 18 | add_shortcode( 'matomo_privacy_badge', [ $this, 'show_privacy_page' ] ); |
| 19 | } |
| 20 | |
| 21 | public function show_privacy_page( $atts ) { |
| 22 | $a = shortcode_atts( |
| 23 | [ |
| 24 | 'size' => '120', |
| 25 | 'align' => '', |
| 26 | ], |
| 27 | $atts |
| 28 | ); |
| 29 | |
| 30 | $option = sprintf( ' width="%s" height="%s"', esc_attr( $a['size'] ), esc_attr( $a['size'] ) ); |
| 31 | |
| 32 | if ( ! empty( $a['align'] ) ) { |
| 33 | $option .= sprintf( ' align="%s"', esc_attr( $a['align'] ) ); |
| 34 | } |
| 35 | |
| 36 | $url = plugins_url( 'assets/img/privacybadge.png', MATOMO_ANALYTICS_FILE ); |
| 37 | |
| 38 | $title = __( 'Your privacy protected! This website uses Matomo.', 'matomo' ); |
| 39 | |
| 40 | return sprintf( '<img alt="%s" src="%s" %s>', $title, esc_attr( $url ), $option ); |
| 41 | } |
| 42 | } |
| 43 |