%s
';
- $content .= esc_html__( 'Review and edit this suggested text before publishing it. Confirm the configured collector, purposes, legal basis, recipients, and retention period for your site.', 'basicrum' );
+ $content .= esc_html__( 'Review and edit this suggested text before publishing it. Confirm the configured collector, purposes, legal basis, recipients, and retention period for your site.', 'basicrum-real-user-monitoring' );
if ( ! $is_configured ) {
$content .= '
';
- $content .= esc_html__( 'Basicrum monitoring is currently inactive. Use the suggested text only if monitoring is enabled and fully configured.', 'basicrum' );
+ $content .= esc_html__( 'Basicrum monitoring is currently inactive. Use the suggested text only if monitoring is enabled and fully configured.', 'basicrum-real-user-monitoring' );
$content .= '';
}
$content .= '
' . esc_html__( 'Suggested text:', 'basicrum' ) . '
'; + $content .= '' . esc_html__( 'Suggested text:', 'basicrum-real-user-monitoring' ) . '
'; $content .= ''; - $content .= esc_html__( 'This site uses Basicrum to measure real-user performance. When monitoring runs, a visitor\'s browser sends page and resource URLs, performance and interaction timing metrics, page type, the configured site identifier, and technical browser, device, and network information to a performance collector. The collector also receives request information such as the IP address and user agent. Boomerang stores measurement state in a first-party cookie named RT, which contains a random session identifier that links page views, uses SameSite=Strict, is marked Secure on HTTPS sites, and expires seven days after the last monitored page view. Opting out removes the RT cookie and any legacy BA cookie.', 'basicrum' ); + $content .= esc_html__( 'This site uses Basicrum to measure real-user performance. When monitoring runs, a visitor\'s browser sends page and resource URLs, performance and interaction timing metrics, page type, the configured site identifier, and technical browser, device, and network information to a performance collector. The collector also receives request information such as the IP address and user agent. Boomerang stores measurement state in a first-party cookie named RT, which contains a random session identifier that links page views, uses SameSite=Strict, is marked Secure on HTTPS sites, and expires seven days after the last monitored page view. Opting out removes the RT cookie and any legacy BA cookie.', 'basicrum-real-user-monitoring' ); $content .= '
'; $content .= ''; if ( '1' === $settings['strip_query_string'] ) { - $content .= esc_html__( 'Basicrum is configured to replace complete query strings in page, navigation, referrer, and resource URLs with the marker ?qs-redacted before sending beacons. URL paths are still collected.', 'basicrum' ); + $content .= esc_html__( 'Basicrum is configured to replace complete query strings in page, navigation, referrer, and resource URLs with the marker ?qs-redacted before sending beacons. URL paths are still collected.', 'basicrum-real-user-monitoring' ); } else { - $content .= esc_html__( 'Query-string stripping is disabled, so page, navigation, referrer, and resource URLs may include complete query strings. Review whether your URLs can contain personal or sensitive information before using this configuration.', 'basicrum' ); + $content .= esc_html__( 'Query-string stripping is disabled, so page, navigation, referrer, and resource URLs may include complete query strings. Review whether your URLs can contain personal or sensitive information before using this configuration.', 'basicrum-real-user-monitoring' ); } $content .= '
'; if ( $beacon_url ) { $content .= '';
/* translators: %s: Configured Basicrum beacon URL. */
- $content .= sprintf( esc_html__( 'When monitoring runs, performance data is sent to the collector configured at %s.', 'basicrum' ), '' . esc_html( $beacon_url ) . '' );
+ $content .= sprintf( esc_html__( 'When monitoring runs, performance data is sent to the collector configured at %s.', 'basicrum-real-user-monitoring' ), '' . esc_html( $beacon_url ) . '' );
$content .= '
'; } if ( $is_configured && '1' === $settings['consent_enabled'] ) { - $content .= esc_html__( 'Monitoring is configured to follow the site\'s consent tool on every page. Basicrum does not persist consent across page loads or in its own cookie or server-side record. The consent tool may report monitoring as allowed before visitor interaction where an opt-out policy applies. Signaling denial, expiry, or withdrawal stops future browser collection but does not retract data already sent.', 'basicrum' ); + $content .= esc_html__( 'Monitoring is configured to follow the site\'s consent tool on every page. Basicrum does not persist consent across page loads or in its own cookie or server-side record. The consent tool may report monitoring as allowed before visitor interaction where an opt-out policy applies. Signaling denial, expiry, or withdrawal stops future browser collection but does not retract data already sent.', 'basicrum-real-user-monitoring' ); } elseif ( $is_configured ) { - $content .= esc_html__( 'Monitoring is configured to start immediately on frontend pages, without waiting for a consent signal. Logged-in administrators are excluded unless Track Admin Users is enabled.', 'basicrum' ); + $content .= esc_html__( 'Monitoring is configured to start immediately on frontend pages, without waiting for a consent signal. Logged-in administrators are excluded unless Track Admin Users is enabled.', 'basicrum-real-user-monitoring' ); } if ( $is_configured ) { $content .= '
'; } wp_add_privacy_policy_content( - esc_html__( 'Basicrum - Real User Monitoring', 'basicrum' ), + esc_html__( 'Basicrum - Real User Monitoring', 'basicrum-real-user-monitoring' ), wp_kses_post( $content ) ); } diff --git a/plugins/basicrum/src/Admin/Settings/Page.php b/plugins/basicrum/src/Admin/Settings/Page.php index 2e54f6a..031e8c0 100644 --- a/plugins/basicrum/src/Admin/Settings/Page.php +++ b/plugins/basicrum/src/Admin/Settings/Page.php @@ -53,7 +53,6 @@ class Page { public function __construct() { add_action( 'admin_menu', array( $this, 'add_menu_page' ) ); add_action( 'admin_init', array( $this, 'register_settings' ) ); - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) ); } @@ -112,8 +111,8 @@ private function get_admin_asset_version( $asset ) { */ public function add_menu_page() { add_menu_page( - esc_html__( 'Basicrum Settings', 'basicrum' ), - esc_html__( 'Basicrum', 'basicrum' ), + esc_html__( 'Basicrum Settings', 'basicrum-real-user-monitoring' ), + esc_html__( 'Basicrum', 'basicrum-real-user-monitoring' ), 'manage_options', self::SLUG, array( $this, 'render_settings_page' ), @@ -159,6 +158,8 @@ public function register_settings() { self::GROUP, Helpers::OPTION_KEY, array( + 'type' => 'array', + 'default' => Helpers::get_defaults(), 'sanitize_callback' => array( new Validate(), 'sanitize' ), ) ); @@ -179,72 +180,72 @@ private function add_general_section() { add_settings_section( 'basicrum_section_general', - esc_html__( 'General Settings', 'basicrum' ), + esc_html__( 'General Settings', 'basicrum-real-user-monitoring' ), '__return_empty_string', self::SLUG ); add_settings_field( 'enabled', - esc_html__( 'Enable Basicrum', 'basicrum' ), + esc_html__( 'Enable Basicrum', 'basicrum-real-user-monitoring' ), array( $this, 'render_checkbox_field' ), self::SLUG, 'basicrum_section_general', array( 'id' => 'enabled', - 'label' => __( 'Enable real user monitoring on your site.', 'basicrum' ), + 'label' => __( 'Enable real user monitoring on your site.', 'basicrum-real-user-monitoring' ), ) ); add_settings_field( 'beacon_url', - esc_html__( 'Beacon URL', 'basicrum' ), + esc_html__( 'Beacon URL', 'basicrum-real-user-monitoring' ), array( $this, 'render_text_field' ), self::SLUG, 'basicrum_section_general', array( 'id' => 'beacon_url', 'label_for' => 'basicrum_beacon_url', - 'label' => __( 'URL where Boomerang beacons are sent. Example: https://www.example.com/beacon/catcher. Required when Basicrum is enabled.', 'basicrum' ), + 'label' => __( 'URL where Boomerang beacons are sent. Example: https://www.example.com/beacon/catcher. Required when Basicrum is enabled.', 'basicrum-real-user-monitoring' ), 'size' => 60, 'class' => $this->get_required_field_row_class( $settings, 'beacon_url' ), 'required_when_enabled' => true, - 'required_message' => __( 'Beacon URL is required when Basicrum is enabled.', 'basicrum' ), + 'required_message' => __( 'Beacon URL is required when Basicrum is enabled.', 'basicrum-real-user-monitoring' ), ) ); add_settings_field( 'brum_site_id', - esc_html__( 'Brum Site ID', 'basicrum' ), + esc_html__( 'Brum Site ID', 'basicrum-real-user-monitoring' ), array( $this, 'render_text_field' ), self::SLUG, 'basicrum_section_general', array( 'id' => 'brum_site_id', 'label_for' => 'basicrum_brum_site_id', - 'label' => __( 'Copy the Brum Site ID from the Basicrum backoffice. Required when Basicrum is enabled.', 'basicrum' ), + 'label' => __( 'Copy the Brum Site ID from the Basicrum backoffice. Required when Basicrum is enabled.', 'basicrum-real-user-monitoring' ), 'size' => 40, 'class' => $this->get_required_field_row_class( $settings, 'brum_site_id' ), 'required_when_enabled' => true, - 'required_message' => __( 'Brum Site ID is required when Basicrum is enabled.', 'basicrum' ), + 'required_message' => __( 'Brum Site ID is required when Basicrum is enabled.', 'basicrum-real-user-monitoring' ), ) ); add_settings_field( 'track_admins', - esc_html__( 'Track Admin Users', 'basicrum' ), + esc_html__( 'Track Admin Users', 'basicrum-real-user-monitoring' ), array( $this, 'render_checkbox_field' ), self::SLUG, 'basicrum_section_general', array( 'id' => 'track_admins', - 'label' => __( 'Track logged-in administrators (users with manage_options capability).', 'basicrum' ), + 'label' => __( 'Track logged-in administrators (users with manage_options capability).', 'basicrum-real-user-monitoring' ), ) ); add_settings_field( 'boomerang_version', - esc_html__( 'Boomerang Version', 'basicrum' ), + esc_html__( 'Boomerang Version', 'basicrum-real-user-monitoring' ), array( $this, 'render_boomerang_version' ), self::SLUG, 'basicrum_section_general' @@ -330,46 +331,46 @@ private function add_privacy_section() { add_settings_section( 'basicrum_section_privacy', - esc_html__( 'Visitor Privacy', 'basicrum' ), + esc_html__( 'Visitor Privacy', 'basicrum-real-user-monitoring' ), array( $this, 'render_privacy_section_intro' ), self::SLUG ); add_settings_field( 'strip_query_string', - esc_html__( 'Strip Query Strings', 'basicrum' ), + esc_html__( 'Strip Query Strings', 'basicrum-real-user-monitoring' ), array( $this, 'render_checkbox_field' ), self::SLUG, 'basicrum_section_privacy', array( 'id' => 'strip_query_string', - 'label' => __( 'When enabled, replace complete query strings in page, navigation, referrer, and resource URLs with ?qs-redacted before sending beacons. URL paths are still collected.', 'basicrum' ), + 'label' => __( 'When enabled, replace complete query strings in page, navigation, referrer, and resource URLs with ?qs-redacted before sending beacons. URL paths are still collected.', 'basicrum-real-user-monitoring' ), ) ); add_settings_field( 'consent_enabled', - esc_html__( 'Visitor Consent', 'basicrum' ), + esc_html__( 'Visitor Consent', 'basicrum-real-user-monitoring' ), array( $this, 'render_radio_field' ), self::SLUG, 'basicrum_section_privacy', array( 'id' => 'consent_enabled', - 'legend' => __( 'Visitor Consent', 'basicrum' ), - 'label' => __( 'Choose whether Boomerang requires an allow decision before monitoring a visitor.', 'basicrum' ), + 'legend' => __( 'Visitor Consent', 'basicrum-real-user-monitoring' ), + 'label' => __( 'Choose whether Boomerang requires an allow decision before monitoring a visitor.', 'basicrum-real-user-monitoring' ), 'announcement_class' => 'basicrum-consent-requirement-announcement', 'announcements' => array( - '0' => __( 'Consent Tool Connection hidden.', 'basicrum' ), - '1' => __( 'Consent Tool Connection shown.', 'basicrum' ), + '0' => __( 'Consent Tool Connection hidden.', 'basicrum-real-user-monitoring' ), + '1' => __( 'Consent Tool Connection shown.', 'basicrum-real-user-monitoring' ), ), 'options' => array( '0' => array( - 'label' => __( 'Monitor without consent', 'basicrum' ), - 'description' => __( 'Boomerang loads for visitors without a consent check. It may set cookies and send performance data. Use this only when your site is permitted to monitor without prior consent.', 'basicrum' ), + 'label' => __( 'Monitor without consent', 'basicrum-real-user-monitoring' ), + 'description' => __( 'Boomerang loads for visitors without a consent check. It may set cookies and send performance data. Use this only when your site is permitted to monitor without prior consent.', 'basicrum-real-user-monitoring' ), ), '1' => array( - 'label' => __( 'Require consent before monitoring (recommended)', 'basicrum' ), - 'description' => __( 'Boomerang stays off and no data is sent until your consent or cookie tool reports an allow decision on each page. Visitors who decline are not monitored. Connect your tool below under Consent Tool Connection.', 'basicrum' ), + 'label' => __( 'Require consent before monitoring (recommended)', 'basicrum-real-user-monitoring' ), + 'description' => __( 'Boomerang stays off and no data is sent until your consent or cookie tool reports an allow decision on each page. Visitors who decline are not monitored. Connect your tool below under Consent Tool Connection.', 'basicrum-real-user-monitoring' ), ), ), ) @@ -384,18 +385,18 @@ private function add_privacy_section() { array( 'id' => 'consent_integration', 'class' => $connection_row_class, - 'legend' => __( 'Consent Tool Connection', 'basicrum' ), + 'legend' => __( 'Consent Tool Connection', 'basicrum-real-user-monitoring' ), 'visible_legend' => true, - 'label' => __( 'Choose how your consent tool\'s decision reaches Basicrum.', 'basicrum' ), + 'label' => __( 'Choose how your consent tool\'s decision reaches Basicrum.', 'basicrum-real-user-monitoring' ), 'options' => array( ConsentIntegration::MODE_AUTOMATIC => array( - 'label' => __( 'Automatic connection (recommended)', 'basicrum' ), - 'description' => __( 'Best for most sites. Detect a supported consent tool and load one matching Basicrum adapter.', 'basicrum' ), + 'label' => __( 'Automatic connection (recommended)', 'basicrum-real-user-monitoring' ), + 'description' => __( 'Best for most sites. Detect a supported consent tool and load one matching Basicrum adapter.', 'basicrum-real-user-monitoring' ), 'controls' => 'basicrum-consent-automatic-panel', ), ConsentIntegration::MODE_MANUAL => array( - 'label' => __( 'Manual callbacks', 'basicrum' ), - 'description' => __( 'For unsupported or custom tools, or when a webmaster already manages the integration snippet.', 'basicrum' ), + 'label' => __( 'Manual callbacks', 'basicrum-real-user-monitoring' ), + 'description' => __( 'For unsupported or custom tools, or when a webmaster already manages the integration snippet.', 'basicrum-real-user-monitoring' ), 'controls' => 'basicrum-consent-manual-panel', ), ), @@ -411,7 +412,7 @@ private function add_privacy_section() { public function render_privacy_section_intro() { printf( '%s
', - esc_html__( 'Control URL query-string handling and choose whether monitoring waits for visitor consent. Basicrum does not display a consent popup, determine your legal basis, or make a site compliant by itself.', 'basicrum' ) + esc_html__( 'Control URL query-string handling and choose whether monitoring waits for visitor consent. Basicrum does not display a consent popup, determine your legal basis, or make a site compliant by itself.', 'basicrum-real-user-monitoring' ) ); } @@ -423,32 +424,32 @@ public function render_privacy_section_intro() { private function add_performance_section() { add_settings_section( 'basicrum_section_performance', - esc_html__( 'Performance', 'basicrum' ), + esc_html__( 'Performance', 'basicrum-real-user-monitoring' ), '__return_empty_string', self::SLUG ); add_settings_field( 'wait_after_onload', - esc_html__( 'Wait After Onload', 'basicrum' ), + esc_html__( 'Wait After Onload', 'basicrum-real-user-monitoring' ), array( $this, 'render_checkbox_field' ), self::SLUG, 'basicrum_section_performance', array( 'id' => 'wait_after_onload', - 'label' => __( 'Delay beacon sending until after page load completes.', 'basicrum' ), + 'label' => __( 'Delay beacon sending until after page load completes.', 'basicrum-real-user-monitoring' ), ) ); add_settings_field( 'delay_ms', - esc_html__( 'Delay (milliseconds)', 'basicrum' ), + esc_html__( 'Delay (milliseconds)', 'basicrum-real-user-monitoring' ), array( $this, 'render_number_field' ), self::SLUG, 'basicrum_section_performance', array( 'id' => 'delay_ms', - 'label' => __( 'Milliseconds to delay the beacon after onload. Leave 0 to disable the delay.', 'basicrum' ), + 'label' => __( 'Milliseconds to delay the beacon after onload. Leave 0 to disable the delay.', 'basicrum-real-user-monitoring' ), 'min' => 0, 'max' => 30000, ) @@ -456,17 +457,17 @@ private function add_performance_section() { add_settings_field( 'script_position', - esc_html__( 'Script Position', 'basicrum' ), + esc_html__( 'Script Position', 'basicrum-real-user-monitoring' ), array( $this, 'render_radio_field' ), self::SLUG, 'basicrum_section_performance', array( 'id' => 'script_position', - 'legend' => __( 'Script Position', 'basicrum' ), - 'label' => __( 'Where to insert the monitoring script.', 'basicrum' ), + 'legend' => __( 'Script Position', 'basicrum-real-user-monitoring' ), + 'label' => __( 'Where to insert the monitoring script.', 'basicrum-real-user-monitoring' ), 'options' => array( - 'header' => __( 'Header (wp_head)', 'basicrum' ), - 'footer' => __( 'Footer (wp_footer)', 'basicrum' ), + 'header' => __( 'Header (wp_head)', 'basicrum-real-user-monitoring' ), + 'footer' => __( 'Footer (wp_footer)', 'basicrum-real-user-monitoring' ), ), ) ); @@ -480,32 +481,32 @@ private function add_performance_section() { private function add_developer_section() { add_settings_section( 'basicrum_section_developer', - esc_html__( 'Developer Settings', 'basicrum' ), + esc_html__( 'Developer Settings', 'basicrum-real-user-monitoring' ), '__return_empty_string', self::SLUG ); add_settings_field( 'development_mode', - esc_html__( 'HTTP Strictness', 'basicrum' ), + esc_html__( 'HTTP Strictness', 'basicrum-real-user-monitoring' ), array( $this, 'render_checkbox_field' ), self::SLUG, 'basicrum_section_developer', array( 'id' => 'development_mode', - 'label' => __( 'Allow HTTP beacon URLs for local testing. Do not enable this on production sites.', 'basicrum' ), + 'label' => __( 'Allow HTTP beacon URLs for local testing. Do not enable this on production sites.', 'basicrum-real-user-monitoring' ), ) ); add_settings_field( 'use_unminified_loaders', - esc_html__( 'Use Unminified Loaders', 'basicrum' ), + esc_html__( 'Use Unminified Loaders', 'basicrum-real-user-monitoring' ), array( $this, 'render_checkbox_field' ), self::SLUG, 'basicrum_section_developer', array( 'id' => 'use_unminified_loaders', - 'label' => __( 'Load unminified JavaScript loaders for debugging.', 'basicrum' ), + 'label' => __( 'Load unminified JavaScript loaders for debugging.', 'basicrum-real-user-monitoring' ), ) ); } @@ -531,6 +532,7 @@ class="basicrum-settings-logo" /> + render_settings_notices(); ?>