File "EventIdGenerator.php"
Full Path: /home/jlklyejr/public_html/post-date/wp-content/plugins/official-facebook-pixel/core/EventIdGenerator.php
File size: 1.22 KB
MIME-type: text/x-php
Charset: utf-8
<?php
/**
* Copyright (C) 2015-present, Meta, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
namespace FacebookPixelPlugin\Core;
final class EventIdGenerator {
/**
* Creates a new guid v4 - via https://stackoverflow.com/a/15875555
* @return string A 36 character string containing dashes.
*/
public static function guidv4() {
$data = openssl_random_pseudo_bytes(16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
}