Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hubzilla
core
Commits
1d0afa8f
Commit
1d0afa8f
authored
Nov 29, 2020
by
Mario
Browse files
introduce uuid_from_url()
parent
775cfb8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/feedutils.php
View file @
1d0afa8f
...
...
@@ -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
));
...
...
include/text.php
View file @
1d0afa8f
...
...
@@ -3791,7 +3791,7 @@ function array_path_exists($str,$arr) {
/**
* @brief Generate a
unique
ID.
* @brief Generate a
random v4 UU
ID.
*
* @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<$3</text>'
,
$s
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment