* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
-
class ApiAtomServiceAction extends ApiBareAuthAction
{
/**
* @return boolean success flag
*
*/
-
function prepare($args)
{
parent::prepare($args);
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
+ // TRANS: Client error displayed when making an Atom API request for an unknown user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
'xmlns:atom' => 'http://www.w3.org/2005/Atom',
'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/'));
$this->elementStart('workspace');
- $this->element('atom:title', null, _('Main'));
+ // TRANS: Title for Atom feed.
+ $this->element('atom:title', null, _m('ATOM','Main'));
$this->elementStart('collection',
array('href' => common_local_url('ApiTimelineUser',
array('id' => $this->user->id,
'format' => 'atom'))));
$this->element('atom:title',
null,
+ // TRANS: Title for Atom feed. %s is a user nickname.
sprintf(_("%s timeline"),
$this->user->nickname));
$this->element('accept', null, 'application/atom+xml;type=entry');
array('subscriber' => $this->user->id))));
$this->element('atom:title',
null,
+ // TRANS: Title for Atom feed with a user's subscriptions. %s is a user nickname.
sprintf(_("%s subscriptions"),
$this->user->nickname));
$this->element('accept', null, 'application/atom+xml;type=entry');
array('profile' => $this->user->id))));
$this->element('atom:title',
null,
+ // TRANS: Title for Atom feed with a user's favorite notices. %s is a user nickname.
sprintf(_("%s favorites"),
$this->user->nickname));
$this->element('accept', null, 'application/atom+xml;type=entry');
array('profile' => $this->user->id))));
$this->element('atom:title',
null,
+ // TRANS: Title for Atom feed with a user's memberships. %s is a user nickname.
sprintf(_("%s memberships"),
$this->user->nickname));
$this->element('accept', null, 'application/atom+xml;type=entry');
$this->deleteNotice();
break;
default:
+ // TRANS: Client error displayed calling an unsupported HTTP error in API status show.
$this->clientError(_('HTTP method not supported.'), 405);
return;
}
$this->showSingleAtomStatus($this->notice);
break;
default:
+ // TRANS: Exception thrown requesting an unsupported notice output format.
+ // TRANS: %s is the requested output format.
throw new Exception(sprintf(_("Unsupported format: %s"), $this->format));
}
} else {
*
* @return boolean true
*/
-
+
function isReadOnly($args)
{
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
function deleteNotice()
{
if ($this->format != 'atom') {
+ // TRANS: Client error displayed when trying to delete a notice not using the Atom format.
$this->clientError(_("Can only delete using the Atom format."));
return;
}
if (empty($this->auth_user) ||
($this->notice->profile_id != $this->auth_user->id &&
!$this->auth_user->hasRight(Right::DELETEOTHERSNOTICE))) {
- $this->clientError(_('Can\'t delete this notice.'), 403);
+ // TRANS: Client error displayed when a user has no rights to delete notices of other users.
+ $this->clientError(_('Cannot delete this notice.'), 403);
return;
}
header('HTTP/1.1 200 OK');
header('Content-Type: text/plain');
+ // TRANS: Confirmation of notice deletion in API. %d is the ID (number) of the deleted notice.
print(sprintf(_('Deleted notice %d'), $this->notice->id));
print("\n");
}