aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-11-13 15:06:16 -0800
committerzotlabs <mike@macgirvin.com>2016-11-13 15:06:16 -0800
commit7763643f2e55c82af97d5db5315f051ed9cc6090 (patch)
tree4b17facd3094e8f8e128a30507f72fdc49a25876 /include/text.php
parent61d2bed0191f93f71d7fdad8b17b4b6c6ece7a6d (diff)
downloadvolse-hubzilla-7763643f2e55c82af97d5db5315f051ed9cc6090.tar.gz
volse-hubzilla-7763643f2e55c82af97d5db5315f051ed9cc6090.tar.bz2
volse-hubzilla-7763643f2e55c82af97d5db5315f051ed9cc6090.zip
zidify wiki content
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index dbb0f4434..fa16a16a1 100644
--- a/include/text.php
+++ b/include/text.php
@@ -4,6 +4,7 @@
*/
require_once("include/bbcode.php");
+require_once('include/hubloc.php');
// random string, there are 86 characters max in text mode, 128 for hex
// output is urlsafe
@@ -1736,6 +1737,36 @@ function zidify_links($s) {
return $s;
}
+
+
+
+function zidify_text_callback($match) {
+ $is_zid = is_matrix_url($match[2]);
+ $replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
+ $x = str_replace($match[0],$replace,$match[0]);
+
+ return $x;
+}
+
+function zidify_text_img_callback($match) {
+ $is_zid = is_matrix_url($match[2]);
+ $replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
+
+ $x = str_replace($match[0],$replace,$match[0]);
+
+ return $x;
+}
+
+function zidify_text($s) {
+
+ $s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_text_callback',$s);
+ $s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_text_img_callback',$s);
+
+ return $s;
+
+
+}
+
/**
* @brief Return atom link elements for all of our hubs.
*