BSF_Analytics::option_notice()
Display admin notice for usage tracking.
Description
Source
File: admin/bsf-analytics/class-bsf-analytics.php
public function option_notice() { if ( ! current_user_can( 'manage_options' ) ) { return; } foreach ( $this->entities as $key => $data ) { $time_to_display = isset( $data['time_to_display'] ) ? $data['time_to_display'] : '+24 hours'; $usage_doc_link = isset( $data['usage_doc_link'] ) ? $data['usage_doc_link'] : $this->usage_doc_link; // Don't display the notice if tracking is disabled or White Label is enabled for any of our plugins. if ( false !== get_site_option( $key . '_analytics_optin', false ) || $this->is_white_label_enabled( $key ) ) { continue; } // Show tracker consent notice after 24 hours from installed time. if ( strtotime( $time_to_display, $this->get_analytics_install_time( $key ) ) > time() ) { continue; } /* translators: %s product name */ $notice_string = __( 'Want to help make <strong>%1s</strong> even more awesome? Allow us to collect non-sensitive diagnostic data and usage information. ', 'astra-addon' ); if ( is_multisite() ) { $notice_string .= __( 'This will be applicable for all sites from the network.', 'astra-addon' ); } $language_dir = is_rtl() ? 'rtl' : 'ltr'; Astra_Notices::add_notice( array( 'id' => $key . '-optin-notice', 'type' => '', 'message' => sprintf( '<div class="notice-content"> <div class="notice-heading"> %1$s </div> <div class="astra-notices-container"> <a href="%2$s" class="astra-notices button-primary"> %3$s </a> <a href="%4$s" data-repeat-notice-after="%5$s" class="astra-notices button-secondary"> %6$s </a> </div> </div>', /* translators: %s usage doc link */ sprintf( $notice_string . '<span dir="%2s"><a href="%3s" target="_blank" rel="noreferrer noopener">%4s</a><span>', esc_html( $data['product_name'] ), $language_dir, esc_url( $usage_doc_link ), __( ' Know More.', 'astra-addon' ) ), add_query_arg( array( $key . '_analytics_optin' => 'yes', $key . '_analytics_nonce' => wp_create_nonce( $key . '_analytics_optin' ), 'bsf_analytics_source' => $key, ) ), __( 'Yes! Allow it', 'astra-addon' ), add_query_arg( array( $key . '_analytics_optin' => 'no', $key . '_analytics_nonce' => wp_create_nonce( $key . '_analytics_optin' ), 'bsf_analytics_source' => $key, ) ), MONTH_IN_SECONDS, __( 'No Thanks', 'astra-addon' ) ), 'show_if' => true, 'repeat-notice-after' => false, 'priority' => 18, 'display-with-other-notices' => true, ) ); } }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |