newUuid() public static method

Inspired by http://php.net/manual/en/function.uniqid.php#94959
public static newUuid ( $formatString = '%04x%04x-%04x-%04x-%04x-%04x%04x%04x' ) : string
$formatString
return string
Ejemplo n.º 1
0
/**
 * Creates random GUID that is not based on URL
 *
 * @param array $data Sanitized post data
 * @param array $postarr Raw post data
 * @return array
 */
function vp_generate_post_guid($data, $postarr)
{
    if (!VersionPress::isActive()) {
        return $data;
    }
    if (empty($postarr['ID'])) {
        // it's insert not update
        $protocol = is_ssl() ? 'https://' : 'http://';
        $data['guid'] = $protocol . IdUtil::newUuid();
    }
    return $data;
}