notice.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * WebFinger resource for Notice objects
  4. *
  5. * @package GNUsocial
  6. * @author Mikael Nordfeldth
  7. * @copyright 2013 Free Software Foundation, Inc.
  8. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  9. * @link http://status.net/
  10. */
  11. class WebFingerResource_Notice extends WebFingerResource
  12. {
  13. public function __construct(Notice $object)
  14. {
  15. // The type argument above verifies that it's our class
  16. parent::__construct($object);
  17. }
  18. public function updateXRD(XML_XRD $xrd)
  19. {
  20. if (Event::handle('StartWebFingerNoticeLinks', array($xrd, $this->object))) {
  21. $xrd->links[] = new XML_XRD_Element_Link('alternate',
  22. common_local_url('ApiStatusesShow',
  23. array('id'=>$this->object->id,
  24. 'format'=>'atom')),
  25. 'application/atom+xml');
  26. $xrd->links[] = new XML_XRD_Element_Link('alternate',
  27. common_local_url('ApiStatusesShow',
  28. array('id'=>$this->object->id,
  29. 'format'=>'json')),
  30. 'application/json');
  31. Event::handle('EndWebFingerNoticeLinks', array($xrd, $this->object));
  32. }
  33. }
  34. }