diff --git a/src/Admin/PrivacyPolicy.php b/src/Admin/PrivacyPolicy.php new file mode 100644 index 0000000..2b5db0c --- /dev/null +++ b/src/Admin/PrivacyPolicy.php @@ -0,0 +1,55 @@ +init(); + } + + /** + * Action & filter hooks. + * + * @return void + */ + private function init() { + add_action( 'admin_init', [ $this, 'add_suggested_content' ] ); + } + + /** + * The content to add to WP's Privacy Policy page. + * + * @return void + * + * @codeCoverageIgnore + */ + public function add_suggested_content() { + if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { + return; + } + + $content = '

' . __( 'Analytics', 'plausible-analytics' ) . '

'; + $content .= '

' . '' . __( 'Suggested text:', 'plausible-analytics' ) . '

'; + $content .= sprintf( + /* translators: %s: URL to Plausible's data policy page. */ + __( "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. + +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. + +For more details, see Plausible's data policy: %s", 'plausible-analytics' ), + 'https://plausible.io/data-policy' + ); + + wp_add_privacy_policy_content( 'Plausible Analytics', wp_kses_post( wpautop( $content, false ) ) ); + } +} diff --git a/src/Plugin.php b/src/Plugin.php index 769e394..ee5aede 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -8,6 +8,57 @@ * @since 1.0.0 */ final class Plugin { + /** + * Load @see Integrations() + * + * @return void + * + * @codeCoverageIgnore + */ + public function load_integrations() { + new Integrations(); + } + + /** + * Loads the plugin's translated strings. + * + * @since 1.0.0 + * @access public + * @return void + * + * @codeCoverageIgnore + */ + public function load_plugin_textdomain() { + load_plugin_textdomain( + 'plausible-analytics', + false, + dirname( plugin_basename( PLAUSIBLE_ANALYTICS_PLUGIN_FILE ) ) . '/languages/' + ); + } + + /** + * Load @see Admin\Provisioning() + * + * @return void + * + * @codeCoverageIgnore + */ + public function load_provisioning() { + new Admin\Provisioning(); + new Admin\Provisioning\Integrations(); + } + + /** + * Load @see Admin\Settings\Page() + * + * @return void + * + * @codeCoverageIgnore + */ + public function load_settings() { + new Admin\Settings\Page(); + } + /** * Registers functionality with WordPress hooks. * @@ -51,6 +102,7 @@ public function register_services() { new Admin\Filters(); new Admin\Actions(); new Admin\Module(); + new Admin\PrivacyPolicy(); } add_action( 'init', [ $this, 'load_integrations' ] ); @@ -63,55 +115,4 @@ public function register_services() { new Proxy(); new Verification(); } - - /** - * Load @see Admin\Settings\Page() - * - * @return void - * - * @codeCoverageIgnore - */ - public function load_settings() { - new Admin\Settings\Page(); - } - - /** - * Load @see Admin\Provisioning() - * - * @return void - * - * @codeCoverageIgnore - */ - public function load_provisioning() { - new Admin\Provisioning(); - new Admin\Provisioning\Integrations(); - } - - /** - * Load @see Integrations() - * - * @return void - * - * @codeCoverageIgnore - */ - public function load_integrations() { - new Integrations(); - } - - /** - * Loads the plugin's translated strings. - * - * @since 1.0.0 - * @access public - * @return void - * - * @codeCoverageIgnore - */ - public function load_plugin_textdomain() { - load_plugin_textdomain( - 'plausible-analytics', - false, - dirname( plugin_basename( PLAUSIBLE_ANALYTICS_PLUGIN_FILE ) ) . '/languages/' - ); - } }