| Server IP : 66.29.153.156 / Your IP : 216.73.217.54 Web Server : LiteSpeed System : Linux premium322.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64 User : lastyfjz ( 1521) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/././lastyfjz/dermalaserclinic.co.uk/wp-content/plugins/otter-blocks/inc/ |
Upload File : |
<?php
/**
* Class for telemetry.
*
* @package ThemeIsle
*/
namespace ThemeIsle\GutenbergBlocks;
/**
* Class Tracker
*/
class Tracker {
/**
* Tracking URL.
*
* @var string
*/
public static $track_url = 'https://api.themeisle.com/tracking/events';
/**
* Send data to the server if the user has opted in.
*
* @param array<array> $events Data to track.
* @param array $options Options.
* @return void
*/
public static function track( $events, $options = array() ) {
if ( ! self::has_consent() && ( ! isset( $options['hasConsent'] ) || ! $options['hasConsent'] ) ) {
return;
}
try {
$payload = array();
$license = apply_filters( 'product_otter_license_key', 'free' );
if ( 'free' !== $license ) {
$license = wp_hash( $license );
}
foreach ( $events as $event ) {
$payload[] = array(
'slug' => 'otter',
'site' => get_site_url(),
'license' => $license,
'data' => $event,
);
}
$args = array(
'headers' => array(
'Content-Type' => 'application/json',
),
'body' => wp_json_encode( $payload ),
);
wp_remote_post( self::$track_url, $args );
} finally {
return;
}
}
/**
* Check if the user has consented to tracking.
*
* @return bool
*/
public static function has_consent() {
return (bool) get_option( 'otter_blocks_logger_flag', false );
}
}