Commit 1d0afa8f authored by Mario's avatar Mario
Browse files

introduce uuid_from_url()

parent 775cfb8c
......@@ -14,9 +14,6 @@
* @return string with an atom feed
*/
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
function get_public_feed($channel, $params) {
if(! $params)
......@@ -435,13 +432,7 @@ function get_atom_elements($feed, $item) {
$res['plink'] = unxmlify($item->get_link(0));
$res['item_rss'] = 1;
try {
$uuid = Uuid::uuid5(Uuid::NAMESPACE_URL, $res['plink'])->toString();
} catch (UnsatisfiedDependencyException $e) {
$uuid = md5($res['plink']);
}
$res['uuid'] = $uuid;
$res['uuid'] = uuid_from_url($res['plink']);
$summary = unxmlify($item->get_description(true));
......
......@@ -3791,7 +3791,7 @@ function array_path_exists($str,$arr) {
/**
* @brief Generate a unique ID.
* @brief Generate a random v4 UUID.
*
* @return string
*/
......@@ -3807,6 +3807,22 @@ function new_uuid() {
}
/**
* @brief Generate a name-based v5 UUID in the URL namespace
*
* @param string $url
* @return string
*/
function uuid_from_url($url) {
try {
$hash = Uuid::uuid5(Uuid::NAMESPACE_URL, $url)->toString();
} catch (UnsatisfiedDependencyException $e) {
$hash = md5($url);
}
return $hash;
}
function svg2bb($s) {
$s = preg_replace("/\<text (.*?)\>(.*?)\<(.*?)\<\/text\>/", '<text $1>$2&lt;$3</text>', $s);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment