ID)) { return; } $mixpanelHandler = new MixpanelHandler(); $mixpanelHandler->trackEvent( 'pluginUpgraded', [ '$device_id' => $uuid, 'pluginVersion' => accessibe_get_plugin_version(), 'wordpressStoreName' => accessibe_sanitizeDomain(wp_parse_url(site_url())['host']), 'wordpressPluginVersionNumber' => accessibe_get_plugin_version(), 'wordpressAccountUserID' => $current_user->ID, 'wordpressUserEmail' => $current_user->user_email, 'wordpressUsername' => $current_user->user_login ] ); $current_data = [ 'mixpanelUUID' => $uuid, 'pluginVersion' => accessibe_get_plugin_version(), ]; update_option('accessibeforwp_options', json_encode($current_data)); } function accessibe_generateUuidV4() { $data = random_bytes(16); // Set version to 4 and variant to 10xx $data[6] = chr((ord($data[6]) & 0x0f) | 0x40); $data[8] = chr((ord($data[8]) & 0x3f) | 0x80); return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } function accessibe_sanitizeDomain($domain) { // Use regex to replace "www." only at the beginning return preg_replace("/^www\./", "", strtolower($domain)); } function accessibe_get_plugin_version() { $accessibe_plugin_data = get_file_data(ACCESSIBE_WP_FILE, ['version' => 'Version'], 'plugin'); return $accessibe_plugin_data['version']; }