aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-08-15 13:21:12 +0200
committerMario Vavti <mario@mariovavti.com>2018-08-15 13:21:12 +0200
commit2becc3273aa377574d566c052036f425105b2389 (patch)
treeff7a897190ea8f63b2aa67923ffb58fcd128d531
parent10c5b46e3bb4cfa76cbe7158f5eba54809cd0d79 (diff)
parentf4f610f1a3b3826f960e3db2026bf2204e939fe8 (diff)
downloadvolse-hubzilla-2becc3273aa377574d566c052036f425105b2389.tar.gz
volse-hubzilla-2becc3273aa377574d566c052036f425105b2389.tar.bz2
volse-hubzilla-2becc3273aa377574d566c052036f425105b2389.zip
Merge remote-tracking branch 'mike/master' into dev
-rw-r--r--Zotlabs/Module/Item.php2
-rw-r--r--include/bbcode.php2
-rw-r--r--include/channel.php3
-rw-r--r--include/markdown.php4
-rw-r--r--include/text.php42
5 files changed, 48 insertions, 5 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index ef1eb3700..640b4fa5c 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -533,7 +533,7 @@ class Item extends \Zotlabs\Web\Controller {
// Look for tags and linkify them
$results = linkify_tags($a, $body, ($uid) ? $uid : $profile_uid);
-logger('linkify: ' . print_r($results,true));
+
if($results) {
// Set permissions based on tag replacements
diff --git a/include/bbcode.php b/include/bbcode.php
index 345b5b025..6f22509e6 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -953,12 +953,14 @@ function bbcode($Text, $options = []) {
$Text = preg_replace_callback("/[^\^]\[url\]([$URLSearchString]*)\[\/url\]/ism", 'tryoembed', $Text);
}
}
+
if (strpos($Text,'[/url]') !== false) {
$Text = preg_replace("/\#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
$Text = preg_replace("/\#\^\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
$Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
}
+
if (strpos($Text,'[/zrl]') !== false) {
$Text = preg_replace("/\#\^\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
$Text = preg_replace("/\#\^\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
diff --git a/include/channel.php b/include/channel.php
index 2d0231bba..82d500e83 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2797,3 +2797,6 @@ function pchan_to_chan($pchan) {
return $chan;
}
+function channel_url($channel) {
+ return (($channel) ? z_root() . '/channel/' . $channel['channel_address'] : z_root());
+}
diff --git a/include/markdown.php b/include/markdown.php
index 1b3538306..f4944e2cc 100644
--- a/include/markdown.php
+++ b/include/markdown.php
@@ -82,10 +82,10 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) {
$s = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'use_zrl_cb_img', $s);
$s = preg_replace_callback("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", 'use_zrl_cb_img_x', $s);
}
- $s = preg_replace_callback("/([^\]\=\{]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", 'use_zrl_cb_link',$s);
+ $s = preg_replace_callback("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", 'use_zrl_cb_link',$s);
}
else {
- $s = preg_replace("/([^\]\=\{]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[url=$2$3]$2$3[/url]',$s);
+ $s = preg_replace("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[url=$2$3]$2$3[/url]',$s);
}
// remove duplicate adjacent code tags
diff --git a/include/text.php b/include/text.php
index e894c5ce5..c4f253a27 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3251,17 +3251,17 @@ function cleanup_bbcode($body) {
* First protect any url inside certain bbcode tags so we don't double link it.
*/
-
$body = preg_replace_callback('/\[code(.*?)\[\/(code)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[url(.*?)\[\/(url)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','\red_escape_codeblock',$body);
-
$body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
+\,\(\)]+)/ismu", '\nakedoembed', $body);
+
$body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
+\,\(\)]+)/ismu", '\red_zrl_callback', $body);
+
$body = preg_replace_callback('/\[\$b64zrl(.*?)\[\/(zrl)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64url(.*?)\[\/(url)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','\red_unescape_codeblock',$body);
@@ -3412,3 +3412,41 @@ function get_forum_channels($uid) {
return $r;
}
+
+function print_array($arr, $level = 0) {
+
+ $o = EMPTY_STR;
+ $tabs = EMPTY_STR;
+
+ if(is_array($arr)) {
+ for($x = 0; $x <= $level; $x ++) {
+ $tabs .= "\t";
+ }
+ $o .= '[' . "\n";
+ if(count($arr)) {
+ foreach($arr as $k => $v) {
+ if(is_array($v)) {
+ $o .= $tabs . '[' . $k . '] => ' . print_array($v, $level + 1) . "\n";
+ }
+ else {
+ $o .= $tabs . '[' . $k . '] => ' . print_val($v) . ",\n";
+ }
+ }
+ }
+ $o .= substr($tabs,0,-1) . ']' . (($level) ? ',' : ';' ). "\n";
+ return $o;
+ }
+
+}
+
+function print_val($v) {
+ if(is_bool($v)) {
+ if($v) return 'true';
+ return 'false';
+ }
+ if(is_string($v)) {
+ return "'" . $v . "'";
+ }
+ return $v;
+
+}