dismiss_notice(); $this->consent(); // This is the last thing to run. No impact on performance or anything else. add_action( 'wp_footer', array( $this, 'maybe_send_data' ), 99999 ); } /** * Maybe send data. * * @access public * @since 3.0.36 * @return void */ public function maybe_send_data() { // Check if the user has consented to the data sending. if ( ! get_option( 'kirki_telemetry_optin' ) ) { return; } // Only send data once/month. We use an option instead of a transient // because transients in some managed hosting environments don't properly update // due to their caching implementations. $sent = get_option( 'kirki_telemetry_sent' ); if ( ! $sent || $sent < time() - MONTH_IN_SECONDS ) { $this->send_data(); update_option( 'kirki_telemetry_sent', time() ); } } /** * Sends data. * * @access private * @since 3.0.36 * @return void */ private function send_data() { // Ping remote server. wp_remote_post( 'https://wplemon.com/?action=kirki-stats', array( 'method' => 'POST', 'blocking' => false, 'body' => array_merge( array( 'action' => 'kirki-stats', ), $this->get_data() ), ) ); } /** * The admin-notice. * * @access private * @since 3.0.36 * @return void */ public function admin_notice() { // Early exit if the user has dismissed the consent, or if they have opted-in. if ( get_option( 'kirki_telemetry_no_consent' ) || get_option( 'kirki_telemetry_optin' ) ) { return; } $data = $this->get_data(); ?>

The data is completely anonymous and we will never collect any identifyable information about you or your website.', 'kirki' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>

$php_version, 'themeName' => $theme->get( 'Name' ), 'themeAuthor' => $theme->get( 'Author' ), 'themeURI' => $theme->get( 'ThemeURI' ), 'fieldTypes' => $this->get_field_types(), ); } /** * Get the field-types used. * * @access private * @since 3.0.36 * @return array */ public function get_field_types() { $types = array(); foreach ( Kirki::$fields as $field ) { if ( isset( $field['type'] ) ) { $types[] = $field['type']; } } return $types; } /** * Dismisses the notice. * * @access private * @since 3.0.36 * @return void */ private function dismiss_notice() { // Check if this is the request we want. if ( isset( $_GET['_wpnonce'] ) && isset( $_GET['kirki-hide-notice'] ) ) { if ( 'telemetry' === sanitize_text_field( wp_unslash( $_GET['kirki-hide-notice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification // Check the wp-nonce. if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) ) ) { // All good, we can save the option to dismiss this notice. update_option( 'kirki_telemetry_no_consent', true ); } } } } /** * Dismisses the notice. * * @access private * @since 3.0.36 * @return void */ private function consent() { // Check if this is the request we want. if ( isset( $_GET['_wpnonce'] ) && isset( $_GET['kirki-consent-notice'] ) ) { if ( 'telemetry' === sanitize_text_field( wp_unslash( $_GET['kirki-consent-notice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification // Check the wp-nonce. if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) ) ) { // All good, we can save the option to dismiss this notice. update_option( 'kirki_telemetry_optin', true ); } } } } }