aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-12-14 11:02:20 +0000
committerMario <mario@mariovavti.com>2020-12-14 11:02:20 +0000
commit2a154f8c9a772d61e7dabb5e3fd110ba00cc6007 (patch)
treef57522c894e96f5a386f2fea9c379702b4c2781e /include/text.php
parent634ace552d40f9f287a6419dd6fe5b19d3f390ca (diff)
downloadvolse-hubzilla-2a154f8c9a772d61e7dabb5e3fd110ba00cc6007.tar.gz
volse-hubzilla-2a154f8c9a772d61e7dabb5e3fd110ba00cc6007.tar.bz2
volse-hubzilla-2a154f8c9a772d61e7dabb5e3fd110ba00cc6007.zip
merge branch files_ng into dev
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/text.php b/include/text.php
index c2a45814c..3fb17b648 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2983,7 +2983,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
$str_tags .= $newtag;
}
}
-
+
$fn_results[] = [
'replaced' => $replaced,
@@ -3060,7 +3060,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
];
}
}
-
+
return $fn_results;
}
@@ -3098,7 +3098,7 @@ function linkify_tags(&$body, $uid, $in_network = true) {
function getIconFromType($type) {
$iconMap = array(
//Folder
- t('Collection') => 'fa-folder-o',
+ 'Collection' => 'fa-folder-o',
'multipart/mixed' => 'fa-folder-o', //dirs in attach use this mime type
//Common file
'application/octet-stream' => 'fa-file-o',
@@ -3242,7 +3242,7 @@ function item_url_replace($channel,&$item,$old,$new,$oldnick = '') {
if($oldnick)
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['target']);
}
-
+
$item['body'] = preg_replace("/(\[zrl=".preg_quote($old,'/')."\/(photo|photos|gallery)\/".$channel['channel_address'].".+\]\[zmg=\d+x\d+\])".preg_quote($old,'/')."\/(.+\[\/zmg\])/", '${1}'.$new.'/${3}', $item['body']);
$item['body'] = preg_replace("/".preg_quote($old,'/')."\/(search|\w+\/".$channel['channel_address'].")/", $new.'/${1}', $item['body']);
@@ -3575,7 +3575,7 @@ function cleanup_bbcode($body) {
$body = preg_replace_callback('/\[\$b64url(.*?)\[\/(url)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64svg(.*?)\[\/(svg)\]/ism','\red_unescape_codeblock',$body);
-
+
// fix any img tags that should be zmg
$body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','\red_zrlify_img_callback',$body);
@@ -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);