mirror of
https://github.com/friendica/friendica
synced 2025-04-26 08:30:10 +00:00
Fix API result, add PHPDoc and cleanup object construction
Fix missing getters fix data array fix missing "$" for template-variables Remove lazy-loaded parent notification instance (for now..)
This commit is contained in:
parent
4c5856da2b
commit
74f3a2f90c
7 changed files with 203 additions and 218 deletions
|
@ -5909,16 +5909,21 @@ function api_friendica_notification($type)
|
|||
$notifications = DI::notification()->select([], ['order' => ['seen' => 'ASC', 'date' => 'DESC'], 'limit' => 50]);
|
||||
|
||||
if ($type == "xml") {
|
||||
$xmlnotes = [];
|
||||
$xmlnotes = false;
|
||||
if (!empty($notifications)) {
|
||||
foreach ($notifications as $notification) {
|
||||
$xmlnotes[] = ["@attributes" => $notification->toArray()];
|
||||
}
|
||||
}
|
||||
|
||||
$notifications = $xmlnotes;
|
||||
$result = $xmlnotes;
|
||||
} elseif (count($notifications) > 0) {
|
||||
$result = $notifications->getArrayCopy();
|
||||
} else {
|
||||
$result = false;
|
||||
}
|
||||
return api_format_data("notes", $type, ['note' => $notifications->getArrayCopy()]);
|
||||
|
||||
return api_format_data("notes", $type, ['note' => $result]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue