settings = $settings; } /** * Register hooks. * * @return void */ public function boot(): void { add_action( 'admin_init', array( $this, 'add_policy_content' ) ); } /** * Add the suggested privacy policy text. * * @return void */ public function add_policy_content(): void { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } $collector = $this->settings->load()->collector_url(); $host = '' !== $collector ? wp_parse_url( $collector, PHP_URL_HOST ) : ''; $host = is_string( $host ) && '' !== $host ? $host : __( 'your AdPix collector', 'adpix-analytics' ); $content = '
' . esc_html__( 'This site uses AdPix Analytics to measure how visitors find it and what they do once they arrive.', 'adpix-analytics' ) . '
'; $content .= '' . esc_html( sprintf( /* translators: %s: hostname of the AdPix collector the site sends data to. */ __( 'A first-party script stores identifiers in cookies on this site so that repeat visits can be recognised, and records which campaign, search or link brought you here. When you place an order, register an account or submit a form, this site also sends the details of that action to %s from its own server. That may include your email address, your phone number, your IP address and the contents of your order.', 'adpix-analytics' ), $host ) ) . '
'; $content .= '' . esc_html__( 'If you decline statistics cookies, or opt out of measurement, no such data is sent.', 'adpix-analytics' ) . '
'; wp_add_privacy_policy_content( __( 'AdPix Analytics', 'adpix-analytics' ), wp_kses_post( $content ) ); } }