forked from friendica/friendica-addons
checking if a variable is an array before doing array_reverse.
This commit is contained in:
parent
d34c78296e
commit
e48fb47d62
|
@ -1027,6 +1027,10 @@ function fbpost_fetchwall($a, $uid) {
|
|||
|
||||
$feed = fetch_url($url);
|
||||
$data = json_decode($feed);
|
||||
|
||||
if (!is_array($data->data))
|
||||
return;
|
||||
|
||||
$items = array_reverse($data->data);
|
||||
|
||||
foreach ($items as $item) {
|
||||
|
|
|
@ -275,6 +275,9 @@ function fromgplus_handleattachments($item) {
|
|||
$post .= "\n[url=".$thumb->url."][img]".$image."[/img][/url]\n";
|
||||
}
|
||||
break;
|
||||
case "audio":
|
||||
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
|
||||
break;
|
||||
//default:
|
||||
// die($attachment->objectType);
|
||||
}
|
||||
|
@ -298,6 +301,9 @@ function fromgplus_fetch($a, $uid) {
|
|||
|
||||
$lastdate = 0;
|
||||
|
||||
if (!is_array($activities->items))
|
||||
return;
|
||||
|
||||
$reversed = array_reverse($activities->items);
|
||||
|
||||
foreach($reversed as $item) {
|
||||
|
|
|
@ -806,6 +806,10 @@ function statusnet_fetchtimeline($a, $uid) {
|
|||
$parameters["since_id"] = $lastid;
|
||||
|
||||
$items = $connection->get('statuses/user_timeline', $parameters);
|
||||
|
||||
if (!is_array($items))
|
||||
return;
|
||||
|
||||
$posts = array_reverse($items);
|
||||
|
||||
if (count($posts)) {
|
||||
|
|
|
@ -613,6 +613,10 @@ function twitter_fetchtimeline($a, $uid) {
|
|||
$parameters["since_id"] = $lastid;
|
||||
|
||||
$items = $connection->get('statuses/user_timeline', $parameters);
|
||||
|
||||
if (!is_array($items))
|
||||
return;
|
||||
|
||||
$posts = array_reverse($items);
|
||||
|
||||
if (count($posts)) {
|
||||
|
|
Loading…
Reference in a new issue