forked from friendica/friendica-addons
The "bookmark" element is now supported
This commit is contained in:
parent
1fce805ee9
commit
e688a2608a
1 changed files with 18 additions and 10 deletions
|
@ -833,7 +833,10 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
|
if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
|
||||||
$image = $matches[1];
|
$image = $matches[1];
|
||||||
|
|
||||||
$html = bbcode($b['body']);
|
// Replace bookmark with url
|
||||||
|
$body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$b['body']);
|
||||||
|
|
||||||
|
$html = bbcode($body);
|
||||||
$msg = trim($b['title']." \n".html2plain($html, 0, true));
|
$msg = trim($b['title']." \n".html2plain($html, 0, true));
|
||||||
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
|
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
|
||||||
|
|
||||||
|
@ -854,8 +857,12 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// To-Do: look for bookmark-bbcode and handle it with priority
|
$link = '';
|
||||||
|
// look for bookmark-bbcode and handle it with priority
|
||||||
|
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches))
|
||||||
|
$link = $matches[1];
|
||||||
|
|
||||||
|
if ($link == '') {
|
||||||
$links = collecturls($html);
|
$links = collecturls($html);
|
||||||
if (sizeof($links) > 0) {
|
if (sizeof($links) > 0) {
|
||||||
reset($links);
|
reset($links);
|
||||||
|
@ -865,6 +872,7 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
else
|
else
|
||||||
$toolong = true;*/
|
$toolong = true;*/
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((strlen($msg) > FACEBOOK_MAXPOSTLEN) or $toolong) {
|
if ((strlen($msg) > FACEBOOK_MAXPOSTLEN) or $toolong) {
|
||||||
$shortlink = "";
|
$shortlink = "";
|
||||||
|
|
Loading…
Reference in a new issue