| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plausible Analytics | Admin Actions. |
| 4 |
* |
| 5 |
* @since 2.5.8 |
| 6 |
* @package WordPress |
| 7 |
* @subpackage Plausible Analytics |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace Plausible\Analytics\WP\Admin; |
| 11 |
|
| 12 |
class PrivacyPolicy { |
| 13 |
/** |
| 14 |
* Constructor. |
| 15 |
*/ |
| 16 |
public function __construct() { |
| 17 |
$this->init(); |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Action & filter hooks. |
| 22 |
* |
| 23 |
* @return void |
| 24 |
*/ |
| 25 |
private function init() { |
| 26 |
add_action( 'admin_init', [ $this, 'add_suggested_content' ] ); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* The content to add to WP's Privacy Policy page. |
| 31 |
* |
| 32 |
* @return void |
| 33 |
* |
| 34 |
* @codeCoverageIgnore |
| 35 |
*/ |
| 36 |
public function add_suggested_content() { |
| 37 |
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { |
| 38 |
return; |
| 39 |
} |
| 40 |
|
| 41 |
$content = '<h2 class="wp-block-heading">' . __( 'Analytics', 'plausible-analytics' ) . '</h2>'; |
| 42 |
$content .= '<p>' . '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:', 'plausible-analytics' ) . '</strong></p>'; |
| 43 |
$content .= sprintf( |
| 44 |
/* translators: %s: URL to Plausible's data policy page. */ |
| 45 |
__( "We use Plausible Analytics to collect usage statistics about our website. Plausible is a privacy-focused analytics provider that does not use cookies or other persistent identifiers. |
| 46 |
|
| 47 |
The data collected includes information such as page URLs, referrer, device type, browser and country. The data is processed by Plausible Analytics on servers located in the European Union. |
| 48 |
|
| 49 |
For more details, see Plausible's data policy: %s", 'plausible-analytics' ), |
| 50 |
'<a href="https://plausible.io/data-policy" target="_blank" rel="noopener noreferrer">https://plausible.io/data-policy</a>' |
| 51 |
); |
| 52 |
|
| 53 |
wp_add_privacy_policy_content( 'Plausible Analytics', wp_kses_post( wpautop( $content, false ) ) ); |
| 54 |
} |
| 55 |
} |
| 56 |
|