Statusnet: Testing new plaintext function/avoiding warning when content couldn't be fetched.
parent
2394ee288a
commit
8ce597cb4d
|
@ -837,9 +837,29 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
$msg = trim($msg);
|
$msg = trim($msg);
|
||||||
$postdata = array('status' => $msg);
|
$postdata = array('status' => $msg);
|
||||||
} else {
|
} else {
|
||||||
$msgarr = statusnet_shortenmsg($b, $max_char);
|
/* $msgarr = statusnet_shortenmsg($b, $max_char);
|
||||||
$msg = $msgarr["msg"];
|
$msg = $msgarr["msg"];
|
||||||
$image = $msgarr["image"];
|
$image = $msgarr["image"];
|
||||||
|
*/
|
||||||
|
require_once("include/plaintext.php");
|
||||||
|
require_once("include/network.php");
|
||||||
|
$msgarr = plaintext($a, $b, $max_char, true);
|
||||||
|
$msg = $msgarr["text"];
|
||||||
|
|
||||||
|
if (($msg == "") AND isset($msgarr["title"]))
|
||||||
|
$msg = shortenmsg($msgarr["title"], $max_char - 50);
|
||||||
|
|
||||||
|
$image = "";
|
||||||
|
|
||||||
|
if (isset($msgarr["url"])) {
|
||||||
|
if ((strlen($msgarr["url"]) > 20) AND
|
||||||
|
((strlen($msg." ".$msgarr["url"]) > $max_char)))
|
||||||
|
$msg .= " ".short_link($msgarr["url"]);
|
||||||
|
else
|
||||||
|
$msg .= " ".$msgarr["url"];
|
||||||
|
} elseif (isset($msgarr["image"]))
|
||||||
|
$image = $msgarr["image"];
|
||||||
|
|
||||||
if ($image != "") {
|
if ($image != "") {
|
||||||
$img_str = fetch_url($image);
|
$img_str = fetch_url($image);
|
||||||
$tempfile = tempnam(get_config("system","temppath"), "cache");
|
$tempfile = tempnam(get_config("system","temppath"), "cache");
|
||||||
|
@ -1661,6 +1681,7 @@ function statusnet_complete_conversation($a, $uid, $self, $create_user, $nick, $
|
||||||
$parameters["count"] = 200;
|
$parameters["count"] = 200;
|
||||||
|
|
||||||
$items = $connection->get('statusnet/conversation/'.$conversation, $parameters);
|
$items = $connection->get('statusnet/conversation/'.$conversation, $parameters);
|
||||||
|
if (is_array($items)) {
|
||||||
$posts = array_reverse($items);
|
$posts = array_reverse($items);
|
||||||
|
|
||||||
foreach($posts AS $post) {
|
foreach($posts AS $post) {
|
||||||
|
@ -1678,6 +1699,7 @@ function statusnet_complete_conversation($a, $uid, $self, $create_user, $nick, $
|
||||||
statusnet_checknotification($a, $uid, $nick, $item, $postarray);
|
statusnet_checknotification($a, $uid, $nick, $item, $postarray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function statusnet_convertmsg($a, $body, $no_tags = false) {
|
function statusnet_convertmsg($a, $body, $no_tags = false) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue