}
if (empty($page)) {
- $data['first'] = DI::baseUrl() . '/featured/' . $owner['nickname'] . '?page=1';
+ $items = Post::select(['id'], $condition, ['limit' => 20, 'order' => ['created' => true]]);
} else {
$data['type'] = 'OrderedCollectionPage';
- $list = [];
-
$items = Post::select(['id'], $condition, ['limit' => [($page - 1) * 20, 20], 'order' => ['created' => true]]);
- while ($item = Post::fetch($items)) {
- $activity = self::createActivityFromItem($item['id'], true);
- $activity['type'] = $activity['type'] == 'Update' ? 'Create' : $activity['type'];
+ }
+ $list = [];
- // Only list "Create" activity objects here, no reshares
- if (!empty($activity['object']) && ($activity['type'] == 'Create')) {
- $list[] = $activity['object'];
- }
- }
- DBA::close($items);
+ while ($item = Post::fetch($items)) {
+ $activity = self::createActivityFromItem($item['id'], true);
+ $activity['type'] = $activity['type'] == 'Update' ? 'Create' : $activity['type'];
- if (count($list) == 20) {
- $data['next'] = DI::baseUrl() . '/featured/' . $owner['nickname'] . '?page=' . ($page + 1);
+ // Only list "Create" activity objects here, no reshares
+ if (!empty($activity['object']) && ($activity['type'] == 'Create')) {
+ $list[] = $activity['object'];
}
+ }
+ DBA::close($items);
- $data['partOf'] = DI::baseUrl() . '/featured/' . $owner['nickname'];
+ if (count($list) == 20) {
+ $data['next'] = DI::baseUrl() . '/featured/' . $owner['nickname'] . '?page=' . ($page + 1);
+ }
- $data['orderedItems'] = $list;
+ if (!empty($page)) {
+ $data['partOf'] = DI::baseUrl() . '/featured/' . $owner['nickname'];
}
+ $data['orderedItems'] = $list;
+
return $data;
}