diff options
author | Zach Copley <zach@status.net> | 2010-03-12 01:40:52 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-03-12 01:40:52 +0000 |
commit | e1537d83871811cf3446a592e44f56d26e961afe (patch) | |
tree | 52e0cec4556352d04d71b1fc441087c8863a284e /lib/apiaction.php | |
parent | 78f0d6bbd21ed84733e960201c4652e69c565450 (diff) |
More generalized method for calculating Atom rel="self" links
Diffstat (limited to 'lib/apiaction.php')
-rw-r--r-- | lib/apiaction.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/apiaction.php b/lib/apiaction.php index cef5d1c1e..a01809ed9 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -1358,8 +1358,22 @@ class ApiAction extends Action } } - function getSelfUri($action, $aargs) + /** + * Calculate the complete URI that called up this action. Used for + * Atom rel="self" links. Warning: this is funky. + * + * @return string URL a URL suitable for rel="self" Atom links + */ + function getSelfUri() { + $action = mb_substr(get_class($this), 0, -6); // remove 'Action' + + $id = $this->arg('id'); + $aargs = array('format' => $this->format); + if (!empty($id)) { + $aargs['id'] = $id; + } + parse_str($_SERVER['QUERY_STRING'], $params); $pstring = ''; if (!empty($params)) { |