aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-04-14 20:41:58 -0700
committerfriendica <info@friendica.com>2013-04-14 20:41:58 -0700
commite411a4bdc27cd443abf613a0044effb4604223f0 (patch)
treee3a501db8f394bd6fd56cd76bfd137f56008cacc /include/text.php
parent2942155797ed46be0d0bd71c89add14404a4bb47 (diff)
downloadvolse-hubzilla-e411a4bdc27cd443abf613a0044effb4604223f0.tar.gz
volse-hubzilla-e411a4bdc27cd443abf613a0044effb4604223f0.tar.bz2
volse-hubzilla-e411a4bdc27cd443abf613a0044effb4604223f0.zip
IMPORTANT: magic-auth protocol update, plus 'zrl' bbcode tag for the privacy-is-more-important-than-ease-of-use folks.
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index a8d91fade..f0251494d 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1108,6 +1108,7 @@ function prepare_text($text,$content_type = 'text/bbcode') {
$s = bbcode($text);
else
$s = smilies(bbcode($text));
+ $s = zidify_links($s);
break;
}
@@ -1116,6 +1117,34 @@ function prepare_text($text,$content_type = 'text/bbcode') {
/**
+ * zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links
+ * These will typically be generated by a bbcode '[zrl]' tag. This is done inside prepare_text() rather than bbcode()
+ * because the latter is used for general purpose conversions and the former is used only when preparing text for
+ * immediate display.
+ *
+ * Issues: Currently the order of HTML parameters in the text is somewhat rigid and inflexible.
+ * We assume it looks like <a class="zrl" href="xxxxxxxxxx"> and will not work if zrl and href appear in a different order.
+ */
+
+
+function zidify_callback($match) {
+ $replace = '<a' . $match[1] . 'class="zrl"' . $match[2] . ' href="' . zid($match[3]) . '"';
+
+ $x = str_replace($match[0],$replace,$match[0]);
+ return $x;
+}
+
+function zidify_links($s) {
+ $s = preg_replace_callback('/\<a(.*?)class\=\"zrl\"(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);
+ return $s;
+}
+
+
+
+
+
+
+/**
* return atom link elements for all of our hubs
*/