<commit_before><?php
/**
 * Telemetry implementation for Kirki.
 *
 * @package     Kirki
 * @category    Core
 * @author      <NAME>
 * @copyright   Copyright (c) 2017, <NAME>
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
 * @since       3.0.34
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Telemetry implementation.
 */
final class Kirki_Telemetry {

	/**
	 * Constructor.
	 *
	 * @access public
	 * @since 3.0.34
	 */
	public function __construct() {

		// Early exit if telemetry is disabled.
		if ( ! apply_filters( 'kirki_telemetry', true ) ) {
			return;
		}

		add_action( 'init', array( $this, 'init' ) );
		add_action( 'admin_notices', array( $this, 'admin_notice' ) );
	}

	/**
	 * Additional actions that run on init.
	 *
	 * @access public
	 * @since 3.0.34
	 * @return void
	 */
	public function init() {
		$this->dismiss_notice();
		$this->consent();
		$this->maybe_send_data();
	}

	/**
	 * Maybe send data.
	 *
	 * @access public
	 * @since 3.0.34
	 * @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.
		// $sent = get_site_transient( 'kirki_telemetry_sent' );
		if ( ! $sent ) {
			$this->send_data();
			set_site_transient( 'kirki_telemetry_sent', time(), MONTH_IN_SECONDS );
		}
	}

	/**
	 * Sends data.
	 *
	 * @access private
	 * @since 3.0.34
	 * @return void
	 */
	private function send_data() {

		// The data.
		$data = array_merge(
			array(
				'action' => 'kirki-stats',
			),
			$this->get_data()
		);

		// Build the URL with the arguments.
		// TODO: ADD URL.
		$url = add_query_arg( $data, 'https://localhost/?action=kirki-stats' );
<commit_msg>another inline comment - I should not forget uncommenting this line<commit_after><?php
/**
 * Telemetry implementation for Kirki.
 *
 * @package     Kirki
 * @category    Core
 * @author      <NAME>
 * @copyright   Copyright (c) 2017, <NAME>
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
 * @since       3.0.34
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Telemetry implementation.
 */
final class Kirki_Telemetry {

	/**
	 * Constructor.
	 *
	 * @access public
	 * @since 3.0.34
	 */
	public function __construct() {

		// Early exit if telemetry is disabled.
		if ( ! apply_filters( 'kirki_telemetry', true ) ) {
			return;
		}

		add_action( 'init', array( $this, 'init' ) );
		add_action( 'admin_notices', array( $this, 'admin_notice' ) );
	}

	/**
	 * Additional actions that run on init.
	 *
	 * @access public
	 * @since 3.0.34
	 * @return void
	 */
	public function init() {
		$this->dismiss_notice();
		$this->consent();
		$this->maybe_send_data();
	}

	/**
	 * Maybe send data.
	 *
	 * @access public
	 * @since 3.0.34
	 * @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.
		// TODO: Enable this before merging
		// $sent = get_site_transient( 'kirki_telemetry_sent' );
		if ( ! $sent ) {
			$this->send_data();
			set_site_transient( 'kirki_telemetry_sent', time(), MONTH_IN_SECONDS );
		}
	}

	/**
	 * Sends data.
	 *
	 * @access private
	 * @since 3.0.34
	 * @return void
	 */
	private function send_data() {

		// The data.
		$data = array_merge(
			array(
				'action' => 'kirki-stats',
			),
			$this->get_data()
		);

		// Build the URL with the arguments.
		// TODO: ADD URL.
		$url = add_query_arg( $data, 'https://localhost/?action=kirki-stats' );

{'fraction_non_alphanumeric': 0.15905427189682966, 'fraction_numerical': 0.012896292315959162, 'mean_word_length': 2.7304609218436875, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5654512', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1311, 'n_words': 318}