diff options
author | Evan Prodromou <evan@status.net> | 2010-10-25 09:48:01 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-10-25 09:48:01 -0400 |
commit | e51ed96b89eb0229f890a3924c653eda51972a76 (patch) | |
tree | 45a07e5a9521e6f0cff23d61fdabeddd6b4dcfec /classes | |
parent | 59a7d78acb09c92622814d55c14e266f8f460fdf (diff) |
add rel=self links to atom entries
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Notice.php | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index 676e4cb54..90ea811b6 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1615,15 +1615,30 @@ class Notice extends Memcached_DataObject // @fixme check this logic - if ($this->isLocal() && !empty($cur) && $cur->id == $this->profile_id) { - $relEditUrl = common_local_url('ApiStatusesShow', array('id' => $this->id, - 'format' => 'atom')); + if ($this->isLocal()) { - if (Event::handle('StartActivityRelEdit', array(&$this, &$xs, &$relEditUrl))) { - $xs->element('link', array('rel' => 'edit', + $selfUrl = common_local_url('ApiStatusesShow', array('id' => $this->id, + 'format' => 'atom')); + + if (Event::handle('StartActivityRelSelf', array(&$this, &$xs, &$selfUrl))) { + $xs->element('link', array('rel' => 'self', 'type' => 'application/atom+xml', - 'href' => $relEditUrl)); - Event::handle('EndActivityRelEdit', array(&$this, &$xs, $relEditUrl)); + 'href' => $selfUrl)); + Event::handle('EndActivityRelSelf', array(&$this, &$xs, $selfUrl)); + } + + if (!empty($cur) && $cur->id == $this->profile_id) { + + // note: $selfUrl may have been changed by a plugin + $relEditUrl = common_local_url('ApiStatusesShow', array('id' => $this->id, + 'format' => 'atom')); + + if (Event::handle('StartActivityRelEdit', array(&$this, &$xs, &$relEditUrl))) { + $xs->element('link', array('rel' => 'edit', + 'type' => 'application/atom+xml', + 'href' => $relEditUrl)); + Event::handle('EndActivityRelEdit', array(&$this, &$xs, $relEditUrl)); + } } } |