Bugfix DFRN and bookmark detection
This commit is contained in:
parent
cea445b6f3
commit
e7c4d0bc50
|
@ -38,6 +38,11 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
|
||||||
if (!$data)
|
if (!$data)
|
||||||
return $Text;
|
return $Text;
|
||||||
|
|
||||||
|
if (isset($data["title"])) {
|
||||||
|
$data["title"] = strip_tags($data["title"]);
|
||||||
|
$data["title"] = str_replace(array("http://", "https://"), "", $data["title"]);
|
||||||
|
}
|
||||||
|
|
||||||
if (((strpos($data["text"], "[img=") !== false) OR (strpos($data["text"], "[img]") !== false)) AND ($data["image"] != "")) {
|
if (((strpos($data["text"], "[img=") !== false) OR (strpos($data["text"], "[img]") !== false)) AND ($data["image"] != "")) {
|
||||||
$data["preview"] = $data["image"];
|
$data["preview"] = $data["image"];
|
||||||
$data["image"] = "";
|
$data["image"] = "";
|
||||||
|
|
|
@ -1988,7 +1988,7 @@ class dfrn {
|
||||||
|
|
||||||
$item["extid"] = $xpath->query("dfrn:extid/text()", $entry)->item(0)->nodeValue;
|
$item["extid"] = $xpath->query("dfrn:extid/text()", $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
if ($xpath->query("dfrn:extid/text()", $entry)->item(0)->nodeValue == "true")
|
if ($xpath->query("dfrn:bookmark/text()", $entry)->item(0)->nodeValue == "true")
|
||||||
$item["bookmark"] = true;
|
$item["bookmark"] = true;
|
||||||
|
|
||||||
$notice_info = $xpath->query("statusnet:notice_info", $entry);
|
$notice_info = $xpath->query("statusnet:notice_info", $entry);
|
||||||
|
|
|
@ -136,29 +136,25 @@ function get_attachment_data($body) {
|
||||||
$data["title"] = $title;
|
$data["title"] = $title;
|
||||||
|
|
||||||
$image = "";
|
$image = "";
|
||||||
if ($type != "video") {
|
preg_match("/image='(.*?)'/ism", $attributes, $matches);
|
||||||
preg_match("/image='(.*?)'/ism", $attributes, $matches);
|
if ($matches[1] != "")
|
||||||
if ($matches[1] != "")
|
$image = $matches[1];
|
||||||
$image = $matches[1];
|
|
||||||
|
|
||||||
preg_match('/image="(.*?)"/ism', $attributes, $matches);
|
preg_match('/image="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "")
|
||||||
$image = $matches[1];
|
$image = $matches[1];
|
||||||
}
|
|
||||||
|
|
||||||
if ($image != "")
|
if ($image != "")
|
||||||
$data["image"] = $image;
|
$data["image"] = $image;
|
||||||
|
|
||||||
$preview = "";
|
$preview = "";
|
||||||
if ($type != "video") {
|
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
|
||||||
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
|
if ($matches[1] != "")
|
||||||
if ($matches[1] != "")
|
$preview = $matches[1];
|
||||||
$preview = $matches[1];
|
|
||||||
|
|
||||||
preg_match('/preview="(.*?)"/ism', $attributes, $matches);
|
preg_match('/preview="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "")
|
||||||
$preview = $matches[1];
|
$preview = $matches[1];
|
||||||
}
|
|
||||||
|
|
||||||
if ($preview != "")
|
if ($preview != "")
|
||||||
$data["preview"] = $preview;
|
$data["preview"] = $preview;
|
||||||
|
|
|
@ -505,10 +505,11 @@ function item_post(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// embedded bookmark in post? set bookmark flag
|
// embedded bookmark or attachment in post? set bookmark flag
|
||||||
|
|
||||||
$bookmark = 0;
|
$bookmark = 0;
|
||||||
if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match,PREG_SET_ORDER)) {
|
$data = get_attachment_data($body);
|
||||||
|
if (preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) OR isset($data["type"])) {
|
||||||
$objecttype = ACTIVITY_OBJ_BOOKMARK;
|
$objecttype = ACTIVITY_OBJ_BOOKMARK;
|
||||||
$bookmark = 1;
|
$bookmark = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue