- return json_encode(array_filter($this->doc));
- }
-
-}
-
-/**
- * A class for representing MediaLinks in JSON Activities
- *
- * @category Feed
- * @package StatusNet
- * @author Zach Copley <zach@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-class ActivityStreamsMediaLink extends ActivityStreamsLink
-{
- private $linkDict;
-
- function __construct(
- $url = null,
- $width = null,
- $height = null,
- $mediaType = null,
- $rel = null,
- $duration = null
- )
- {
- parent::__construct($url, $rel, $mediaType);
- $this->linkDict = array(
- 'width' => $width,
- 'height' => $height,
- 'duration' => $duration
- );
- }
-
- function asArray()
- {
- return array_merge(
- parent::asArray(),
- array_filter($this->linkDict)
- );
- }
-}
-
-/**
- * A class for representing links in JSON Activities
- *
- * @category Feed
- * @package StatusNet
- * @author Zach Copley <zach@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-class ActivityStreamsLink
-{
- private $linkDict;
-
- function __construct($url = null, $rel = null, $mediaType = null)
- {
- // links MUST have a URL
- if (empty($url)) {
- throw new Exception('Links must have a URL.');
- }
-
- $this->linkDict = array(
- 'url' => $url,
- 'rel' => $rel, // extension
- 'type' => $mediaType // extension
- );
+ $this->doc['generator'] = 'GNU social ' . GNUSOCIAL_VERSION; // extension
+ $this->doc['title'] = $this->title;
+ $this->doc['url'] = $this->url;
+ $this->doc['totalItems'] = $this->count;
+ $this->doc['items'] = $this->items;
+ $this->doc['links'] = $this->links; // extension
+ return json_encode(array_filter($this->doc)); // filter out empty elements