aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-09-02 17:21:12 -0700
committerfriendica <info@friendica.com>2014-09-02 17:21:12 -0700
commit2c94d59cba0b3231b0dd822fc1b95bed5521c48d (patch)
tree5000d4070a1810c1c4b538bf0970d867f0bb6ddb /include/bb2diaspora.php
parent17c1ddb77e153b72fd70d3b58befb9e791ca04c7 (diff)
downloadvolse-hubzilla-2c94d59cba0b3231b0dd822fc1b95bed5521c48d.tar.gz
volse-hubzilla-2c94d59cba0b3231b0dd822fc1b95bed5521c48d.tar.bz2
volse-hubzilla-2c94d59cba0b3231b0dd822fc1b95bed5521c48d.zip
use feed title for channel name before checking author, make feed items shareable (they're private to the channel so they won't be shown in searches), try and handle Diaspora mentions a bit more elegantly. (Bug: we don't convert mentions to Diaspora's format on outbound at all!)
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index f15a34e99..623b2d7b7 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -77,6 +77,25 @@ function share_unshield($m) {
}
+function diaspora_mention_callback($matches) {
+
+ $webbie = $matches[2];
+ $link = '';
+ if($webbie) {
+ $r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_addr = '%s' limit 1",
+ dbesc($webbie)
+ );
+ if($r)
+ $link = $r[0]['xchan_url'];
+ }
+ if(! $link)
+ $link = 'https://' . $matches[3] . '/u/' . $matches[2];
+
+ return '@[url=' . $link . ']' . trim($matches[1]) . '[/url]';
+
+}
+
+
// we don't want to support a bbcode specific markdown interpreter
// and the markdown library we have is pretty good, but provides HTML output.
@@ -97,7 +116,10 @@ function diaspora2bb($s,$use_zrl = false) {
$s = str_replace("<br/>","<br />",$s);
$s = str_replace("\n","<br />",$s);
- $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
+
+// $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
+
+ $s = preg_replace_callback('/\@\{(.+?)\; (.+?)\@(.+?)\}/','diaspora_mention_callback',$s);
// Escaping the hash tags - doesn't always seem to work
// $s = preg_replace('/\#([^\s\#])/','\\#$1',$s);