activitystreamsmedialink.php 1002 B

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