Subversion Repositories uuid_mac_utils

Rev

Rev 8 | Rev 10 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8 Rev 9
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 * UUID utils for PHP
4
 * UUID utils for PHP
5
 * Copyright 2011 - 2021 Daniel Marschall, ViaThinkSoft
5
 * Copyright 2011 - 2022 Daniel Marschall, ViaThinkSoft
6
 * Version 2021-12-29
6
 * Version 2022-01-06
7
 *
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
10
 * You may obtain a copy of the License at
11
 *
11
 *
Line 311... Line 311...
311
               substr($y, 16, 4).'-'.
311
               substr($y, 16, 4).'-'.
312
               substr($y, 20, 12);
312
               substr($y, 20, 12);
313
}
313
}
314
 
314
 
315
function is_uuid_oid($oid, $only_allow_root=false) {
315
function is_uuid_oid($oid, $only_allow_root=false) {
316
        if (substr(oid,0,1) == '.') $oid = substr($oid, 1); // remove leading dot
316
        if (substr($oid,0,1) == '.') $oid = substr($oid, 1); // remove leading dot
317
 
317
 
318
        $ary = explode('.', $oid);
318
        $ary = explode('.', $oid);
319
 
319
 
320
        if ($only_allow_root) {
320
        if ($only_allow_root) {
321
                if (count($ary) != 3) return false;
321
                if (count($ary) != 3) return false;