]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/activitystreamsmedialink.php
update from upstream
[quix0rs-gnu-social.git] / lib / activitystreamsmedialink.php
1 <?php
2
3 /**
4  * A class for representing MediaLinks in JSON Activities
5  *
6  * @category Feed
7  * @package  StatusNet
8  * @author   Zach Copley <zach@status.net>
9  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
10  * @link     http://status.net/
11  */
12
13 class ActivityStreamsMediaLink extends ActivityStreamsLink
14 {
15     private $linkDict;
16
17     function __construct(
18         $url       = null,
19         $width     = null,
20         $height    = null,
21         $mediaType = null, // extension
22         $rel       = null, // extension
23         $duration  = null
24     )
25     {
26         parent::__construct($url, $rel, $mediaType);
27         $this->linkDict = array(
28             'width'      => intval($width),
29             'height'     => intval($height),
30             'duration'   => intval($duration)
31         );
32     }
33
34     function asArray()
35     {
36         return array_merge(
37             parent::asArray(),
38             array_filter($this->linkDict)
39         );
40     }
41 }