diff options
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php index 15cc0ca8a..3d351f7dc 100644 --- a/include/text.php +++ b/include/text.php @@ -3,8 +3,11 @@ * @file include/text.php */ -use \Zotlabs\Lib as Zlib; -use \Michelf\MarkdownExtra; +use Zotlabs\Lib as Zlib; + +use Michelf\MarkdownExtra; +use Ramsey\Uuid\Uuid; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; require_once("include/bbcode.php"); @@ -3467,3 +3470,19 @@ function print_val($v) { return $v; } + +/** + * @brief Generate a unique ID. + * + * @return string + */ +function new_uuid() { + + try { + $hash = Uuid::uuid4()->toString(); + } catch (UnsatisfiedDependencyException $e) { + $hash = random_string(48); + } + + return $hash; +} |