<?php /** * Class for telemetry. * * @package ThemeIsle */ namespace Neve\Core; /** * 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_neve_license_key', 'free' ); if ( 'free' !== $license ) { $license = wp_hash( $license ); } foreach ( $events as $event ) { $payload[] = array( 'slug' => 'neve', '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( 'neve_logger_flag', false ); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
settings | Folder | 0755 |
|
|
styles | Folder | 0755 |
|
|
traits | Folder | 0755 |
|
|
admin.php | File | 20.94 KB | 0644 |
|
builder_migrator.php | File | 11.44 KB | 0644 |
|
core_loader.php | File | 4.58 KB | 0644 |
|
dynamic_css.php | File | 5.38 KB | 0644 |
|
factory.php | File | 1.36 KB | 0644 |
|
front_end.php | File | 19.71 KB | 0644 |
|
limited_offers.php | File | 7.88 KB | 0644 |
|
migration_flags.php | File | 2.81 KB | 0644 |
|
supported_post_types.php | File | 1013 B | 0644 |
|
theme_info.php | File | 729 B | 0644 |
|
tracker.php | File | 1.34 KB | 0644 |
|