3 * WebFinger resource parent class
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/
12 abstract class WebFingerResource
14 const PROFILEPAGE = 'http://webfinger.net/rel/profile-page';
16 protected $identities = array();
18 protected $object = null;
19 protected $type = null;
21 public function __construct(Managed_DataObject $object)
23 $this->object = $object;
26 public function getObject()
28 if ($this->object === null) {
29 throw new ServerException('Object is not set');
34 public function getAliases()
38 // Add the URI as an identity, this is _not_ necessarily an HTTP url
39 $aliases[] = $this->object->getUri();
42 $aliases[] = $this->object->getUrl();
43 } catch (InvalidUrlException $e) {
44 // getUrl failed because no valid URL could be returned, just ignore it
50 public function updateXRD(XML_XRD $xrd) {
51 $xrd->links[] = new XML_XRD_Element_Link(WebFingerResource::PROFILEPAGE,
52 $this->object->getUrl(), 'text/html');