* translator documentation updated.
* superfluous whitespace removed.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiMediaUploadAction extends ApiAuthAction
{
/**
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
if (isset($upload)) {
$this->showResponse($upload);
} else {
+ // TRANS: Client error displayed when uploading a media file has failed.
$this->clientError(_('Upload failed.'));
return;
}
* Overrided clientError to show a more Twitpic-like error
*
* @param String $msg an error message
- *
*/
function clientError($msg)
{
$this->elementEnd('rsp');
$this->endDocument();
}
-
}
$app = $datastore->getAppByRequestToken($this->reqToken);
$atok = $server->fetch_access_token($req);
-
} catch (Exception $e) {
common_log(LOG_WARNING, 'API OAuthException - ' . $e->getMessage());
common_debug(var_export($req, true));
}
if (empty($atok)) {
-
// Token exchange failed -- log it
$msg = sprintf(
common_log(LOG_WARNING, $msg);
// TRANS: Client error given from the OAuth API when the request token or verifier is invalid.
$this->clientError(_("Invalid request token or verifier.", 400, 'text'));
-
} else {
common_log(
LOG_INFO,
*
* @param OAuthToken token the access token
*/
-
function showAccessToken($token)
{
header('Content-Type: application/x-www-form-urlencoded');
if (!$token || $token != common_session_token()) {
$this->showForm(
+ // TRANS: Form validation error in API OAuth authorisation because of an invalid session token.
_('There was a problem with your session token. Try again, please.'));
return;
}
assert(!empty($this->reqToken));
if ($this->arg('allow')) {
-
// mark the req token as authorized
try {
$this->store->authorize_token($this->oauthTokenParam);
// Otherwise, inform the user that the rt was authorized
$this->showAuthorized();
-
} else if ($this->arg('cancel')) {
-
common_log(
LOG_INFO,
sprintf(
);
$pin->showPage();
} else {
-
// NOTE: This would only happen if an application registered as
// a web application but sent in 'oob' for the oauth_callback
// parameter. Usually web apps will send in a callback and
$callback = $this->app->callback_url;
}
-
}
return $callback;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiOauthPinAction extends InfoAction
{
function __construct($title, $message, $verifier, $desktopMode = false)
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiOauthRequestTokenAction extends ApiOauthAction
{
/**
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
/*
* Display temporary OAuth credentials
*/
-
function showRequestToken($token)
{
header('Content-Type: application/x-www-form-urlencoded');
*
* @return boolean true or false
*/
-
function verifyCallback($callback)
{
if ($callback == "oob") {
return Validate::uri($callback);
}
}
-
}
*
* @see ApiPrivateAuthAction
*/
-
class ApiSearchAtomAction extends ApiPrivateAuthAction
{
-
var $cnt;
var $query;
var $lang;
*
* @see Action::__construct
*/
-
function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
*
* @return boolean true
*/
-
function isReadonly()
{
return true;
* @param array $args Arguments from $_REQUEST
*
* @return boolean success
- *
*/
-
function prepare($args)
{
common_debug("in apisearchatom prepare()");
parent::prepare($args);
-
$this->query = $this->trimmed('q');
$this->lang = $this->trimmed('lang');
$this->rpp = $this->trimmed('rpp');
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return array an array of Notice objects sorted in reverse chron
*/
-
function getNotices()
{
// TODO: Support search operators like from: and to:, boolean, etc.
if ($this->cnt > 0) {
while ($notice->fetch()) {
-
++$cnt;
if (!$this->max_id) {
*
* @return void
*/
-
function showAtom()
{
$notices = $this->getNotices();
$this->showFeed();
foreach ($notices as $n) {
-
$profile = $n->getProfile();
// Don't show notices from deleted users
*
* @return void
*/
-
function showFeed()
{
// TODO: A9 OpenSearch stuff like search.twitter.com?
'rel' => 'self',
'href' => $self_uri));
+ // @todo Needs i18n?
$this->element('title', null, "$this->query - $sitename Search");
$this->element('updated', null, common_date_iso8601('now'));
'rel' => 'previous',
'href' => $previous_uri));
}
-
}
/**
*
* @return void
*/
-
function showEntry($notice)
{
$server = common_config('site', 'server');
if ($ns) {
if (!empty($ns->name) && !empty($ns->url)) {
$source = '<a href="'
- . htmlspecialchars($ns->url)
- . '" rel="nofollow">'
- . htmlspecialchars($ns->name)
- . '</a>';
+ . htmlspecialchars($ns->url)
+ . '" rel="nofollow">'
+ . htmlspecialchars($ns->name)
+ . '</a>';
} else {
$source = $ns->code;
}
$name = $profile->nickname;
if ($profile->fullname) {
+ // @todo Needs proper i18n?
$name .= ' (' . $profile->fullname . ')';
}
*
* @return void
*/
-
function initAtom()
{
header('Content-Type: application/atom+xml; charset=utf-8');
*
* @return void
*/
-
function endAtom()
{
$this->elementEnd('feed');
}
-
}
* @link http://status.net/
* @see ApiAction
*/
-
class ApiSearchJSONAction extends ApiPrivateAuthAction
{
var $query;
*
* @return boolean true if nothing goes wrong
*/
-
function prepare($args)
{
common_debug("apisearchjson prepare()");
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showResults()
{
-
// TODO: Support search operators like from: and to:, boolean, etc.
$notice = new Notice();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiStatusesDestroyAction extends ApiAuthAction
{
var $status = null;
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(
+ // TRANS: Client error displayed trying to execute an unknown API method deleting a status.
_('API method not found.'),
404
);
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
$this->clientError(
+ // TRANS: Client error displayed trying to delete a status not using POST or DELETE.
+ // TRANS: POST and DELETE should not be translated.
_('This method requires a POST or DELETE.'),
400,
$this->format
if (empty($this->notice)) {
$this->clientError(
+ // TRANS: Client error displayed trying to delete a status with an invalid ID.
_('No status found with that ID.'),
404, $this->format
);
$this->showNotice();
} else {
$this->clientError(
+ // TRANS: Client error displayed trying to delete a status of another user.
_('You may not delete another user\'s status.'),
403,
$this->format
*
* @return void
*/
-
function showNotice()
{
if (!empty($this->notice)) {
}
}
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiStatusesRetweetAction extends ApiAuthAction
{
var $original = null;
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
$this->original = Notice::staticGet('id', $id);
if (empty($this->original)) {
+ // TRANS: Client error displayed trying to repeat a non-existing notice through the API.
$this->clientError(_('No such notice.'),
400, $this->format);
return false;
$this->user = $this->auth_user;
if ($this->user->id == $this->original->profile_id) {
+ // TRANS: Client error displayed trying to repeat an own notice through the API.
$this->clientError(_('Cannot repeat your own notice.'),
400, $this->format);
return false;
$profile = $this->user->getProfile();
if ($profile->hasRepeated($id)) {
+ // TRANS: Client error displayed trying to re-repeat a notice through the API.
$this->clientError(_('Already repeated that notice.'),
400, $this->format);
return false;
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
$repeat = $this->original->repeat($this->user->id, $this->source);
-
-
$this->showNotice($repeat);
}
*
* @return void
*/
-
function showNotice($notice)
{
if (!empty($notice)) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiStatusesRetweetsAction extends ApiAuthAction
{
const MAXCOUNT = 100;
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
$this->original = Notice::staticGet('id', $id);
if (empty($this->original)) {
+ // TRANS: Client error displayed trying to display redents of a non-exiting notice.
$this->clientError(_('No such notice.'),
400, $this->format);
return false;
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
$this->showJsonTimeline($strm);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiStatusesShowAction extends ApiPrivateAuthAction
{
-
var $notice_id = null;
var $notice = null;
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
return;
}
*
* @return void
*/
-
function showNotice()
{
if (!empty($this->notice)) {
$this->show_single_json_status($this->notice);
}
} else {
-
// XXX: Twitter just sets a 404 header and doens't bother
// to return an err msg
if (!empty($deleted)) {
$this->clientError(
+ // TRANS: Client error displayed requesting a deleted status.
_('Status deleted.'),
410,
$this->format
);
} else {
$this->clientError(
+ // TRANS: Client error displayed requesting a status with an invalid ID.
_('No status with that ID found.'),
404,
$this->format
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notice)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notice)) {
return null;
}
-
}
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
function prepare($args)
{
}
if (empty($this->auth_user)) {
+ // TRANS: Client error displayed when updating a status for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
$status_shortened = common_shorten_links($this->status);
if (Notice::contentTooLong($status_shortened)) {
-
// Note: Twitter truncates anything over 140, flags the status
// as "truncated."
if (Notice::contentTooLong($status_shortened)) {
$upload->delete();
+ // TRANS: Client error displayed exceeding the maximum notice length.
+ // TRANS: %d is the maximum lenth for a notice.
$msg = _m('Maximum notice size is %d character, including attachment URL.',
'Maximum notice size is %d characters, including attachment URL.',
Notice::maxContent());
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiStatusnetConfigAction extends ApiAction
{
var $keys = array(
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
break;
default:
$this->clientError(
+ // TRANS: Client error displayed when trying to handle an unknown API method.
_('API method not found.'),
404,
$this->format
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return true;
}
-
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiStatusnetVersionAction extends ApiPrivateAuthAction
{
/**
* @return boolean success flag
*
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
break;
default:
$this->clientError(
+ // TRANS: Client error displayed when trying to handle an unknown API method.
_('API method not found.'),
404,
$this->format
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return true;
}
-
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiSubscriptionsAction extends ApiBareAuthAction
{
var $profiles = null;
* @param array $args $_REQUEST args
*
* @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 requesting a list of followers for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return false;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
return;
}
*
* @return array Profiles
*/
-
function getProfiles()
{
}
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest profile in the stream
*/
-
function lastModified()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
+ // Caching tags.
isset($this->ids_only) ? 'IDs' : 'Profiles',
strtotime($this->profiles[0]->created),
strtotime($this->profiles[$last]->created))
*
* @return void
*/
-
function showProfiles($include_statuses = true)
{
switch ($this->format) {
print json_encode($arrays);
break;
default:
+ // TRANS: Client error displayed when requesting profiles of followers in an unsupported format.
$this->clientError(_('Unsupported format.'));
break;
}
*
* @return void
*/
-
function showIds()
{
switch ($this->format) {
print json_encode($ids);
break;
default:
+ // TRANS: Client error displayed when requesting IDs of followers in an unsupported format.
$this->clientError(_('Unsupported format.'));
break;
}
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineFavoritesAction extends ApiBareAuthAction
{
var $notices = null;
* @param array $args $_REQUEST args
*
* @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 requesting most recent favourite notices by a user for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showTimeline()
{
$profile = $this->user->getProfile();
$sitename = common_config('site', 'name');
$title = sprintf(
+ // TRANS: Title for timeline of most recent favourite notices by a user.
+ // TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname.
_('%1$s / Favorites from %2$s'),
$sitename,
$this->user->nickname
$id = "tag:$taguribase:Favorites:" . $this->user->id;
$subtitle = sprintf(
- _('%1$s updates favorited by %2$s / %2$s.'),
+ // TRANS: Subtitle for timeline of most recent favourite notices by a user.
+ // TRANS: %1$s is the StatusNet sitename, %2$s is a user's full name,
+ // TRANS: %3$s is a user nickname.
+ _('%1$s updates favorited by %2$s / %3$s.'),
$sitename,
$profile->getBestName(),
$this->user->nickname
);
break;
case 'atom':
-
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
-
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return null;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineFriendsAction extends ApiBareAuthAction
{
var $notices = null;
* @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 requesting dents of a user and friends for a user that does not exist.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showTimeline()
{
$profile = $this->user->getProfile();
);
break;
case 'atom':
-
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$this->showJsonTimeline($this->notices);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
-
$last = count($this->notices) - 1;
return '"' . implode(
return null;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineGroupAction extends ApiPrivateAuthAction
{
-
var $group = null;
var $notices = null;
* @return boolean success flag
*
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
if (empty($this->group)) {
+ // TRANS: Client error displayed requesting most recent notices to a group for a non-existing group.
$this->clientError(_('Group not found.'), 404, $this->format);
return false;
}
*
* @return void
*/
-
function showTimeline()
{
// We'll pull common formatting out of this for other formats
);
break;
case 'atom':
-
header('Content-Type: application/atom+xml; charset=utf-8');
try {
$this->raw($atom->getString());
} catch (Atom10FeedException $e) {
$this->serverError(
- 'Could not generate feed for group - ' . $e->getMessage(),
+ // TRANS: Server error displayed when generating an Atom feed fails.
+ // TRANS: %s is the error.
+ sprintf(_('Could not generate feed for group - %s'),$e->getMessage()),
400,
$this->format
);
return;
}
-
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
default:
$this->clientError(
+ // TRANS: Client error displayed when trying to handle an unknown API method.
_('API method not found.'),
404,
$this->format
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return null;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineHomeAction extends ApiBareAuthAction
{
var $notices = null;
* @param array $args $_REQUEST args
*
* @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 requesting most recent dents by user and friends for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showTimeline()
{
$profile = $this->user->getProfile();
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$sitename = common_config('site', 'name');
+ // TRANS: Timeline title for user and friends. %s is a user nickname.
$title = sprintf(_("%s and friends"), $this->user->nickname);
$taguribase = TagURI::base();
$id = "tag:$taguribase:HomeTimeline:" . $this->user->id;
$this->showJsonTimeline($this->notices);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return null;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineMentionsAction extends ApiBareAuthAction
{
-
var $notices = null;
/**
* @param array $args $_REQUEST args
*
* @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 requesting most recent mentions for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showTimeline()
{
$profile = $this->user->getProfile();
$sitename = common_config('site', 'name');
$title = sprintf(
+ // TRANS: Title for timeline of most recent mentions of a user.
+ // TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname.
_('%1$s / Updates mentioning %2$s'),
$sitename, $this->user->nickname
);
$self = $this->getSelfUri();
$subtitle = sprintf(
+ // TRANS: Subtitle for timeline of most recent mentions of a user.
+ // TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname,
+ // TRANS: %3$s is a user's full name.
_('%1$s updates that reply to updates from %2$s / %3$s.'),
$sitename, $this->user->nickname, $profile->getBestName()
);
);
break;
case 'atom':
-
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$this->showJsonTimeline($this->notices);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return null;
}
-
}
</statuses>
@endverbatim
*/
-
class ApiTimelinePublicAction extends ApiPrivateAuthAction
{
-
var $notices = null;
/**
* @return boolean success flag
*
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showTimeline()
{
$sitename = common_config('site', 'name');
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
+ // TRANS: Title for site timeline. %s is the StatusNet sitename.
$title = sprintf(_("%s public timeline"), $sitename);
$taguribase = TagURI::base();
$id = "tag:$taguribase:PublicTimeline";
$link = common_local_url('public');
$self = $this->getSelfUri();
+ // TRANS: Subtitle for site timeline. %s is the StatusNet sitename.
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
switch($this->format) {
$this->showJsonTimeline($this->notices);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return null;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineRetweetedByMeAction extends ApiAuthAction
{
const DEFAULTCOUNT = 20;
* @return boolean success flag
*
*/
-
function prepare($args)
{
parent::prepare($args);
- $this->serverError('Unimplemented.', 503);
+ // TRANS: Server error displayed calling unimplemented API method for 'retweeted by me'.
+ $this->serverError(_('Unimplemented.'), 503);
return false;
}
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return true;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineRetweetedToMeAction extends ApiAuthAction
{
const DEFAULTCOUNT = 20;
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
case 'atom':
$profile = $this->auth_user->getProfile();
+ // TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
$taguribase = TagURI::base();
$id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
$this->showAtomTimeline($strm, $title, $id, $link);
break;
-
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return true;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
{
const DEFAULTCOUNT = 20;
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
case 'atom':
$profile = $this->auth_user->getProfile();
+ // TRANS: Title of list of repeated notices of the logged in user.
+ // TRANS: %s is the nickname of the logged in user.
$title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
$taguribase = TagURI::base();
$id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
$this->raw($atom->getString());
break;
-
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return true;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineTagAction extends ApiPrivateAuthAction
{
-
var $notices = null;
/**
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showTimeline()
{
$sitename = common_config('site', 'name');
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
+ // TRANS: Title for timeline with lastest notices with a given tag.
+ // TRANS: %s is the tag.
$title = sprintf(_("Notices tagged with %s"), $this->tag);
$subtitle = sprintf(
+ // TRANS: Subtitle for timeline with lastest notices with a given tag.
+ // TRANS: %1$s is the tag, $2$s is the StatusNet sitename.
_('Updates tagged with %1$s on %2$s!'),
$this->tag,
$sitename
);
break;
case 'atom':
-
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$this->showJsonTimeline($this->notices);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return null;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiTimelineUserAction extends ApiBareAuthAction
{
-
var $notices = null;
/**
* @param array $args $_REQUEST args
*
* @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 requesting most recent notices for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showTimeline()
{
$profile = $this->user->getProfile();
);
break;
case 'atom':
-
header('Content-Type: application/atom+xml; charset=utf-8');
$atom->setId($self);
$this->showJsonTimeline($this->notices);
break;
default:
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
-
}
/**
*
* @return array notices
*/
-
function getNotices()
{
$notices = array();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
-
$last = count($this->notices) - 1;
return '"' . implode(
return null;
}
-
}
*
* @see ApiAction
*/
-
class ApiTrendsAction extends ApiPrivateAuthAction
{
-
var $callback;
/**
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*/
function showTrends()
{
+ // TRANS: Server error for unfinished API method showTrends.
$this->serverError(_('API method under construction.'), 501);
}
-
-}
\ No newline at end of file
+}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiUserFollowersAction extends ApiSubscriptionsAction
{
/**
*
* @return array Profiles
*/
-
function getProfiles()
{
$offset = ($this->page - 1) * $this->count;
return $profiles;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiUserFriendsAction extends ApiSubscriptionsAction
{
/**
*
* @return array Profiles
*/
-
function getProfiles()
{
$offset = ($this->page - 1) * $this->count;
return $profiles;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiUserShowAction extends ApiPrivateAuthAction
{
/**
* @return boolean success flag
*
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
if (empty($this->user)) {
- $this->clientError(_('Not found.'), 404, $this->format);
+ // TRANS: Client error displayed when requesting user information for a non-existing user.
+ $this->clientError(_('User not found.'), 404, $this->format);
return;
}
if (!in_array($this->format, array('xml', 'json'))) {
+ // TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
return;
}
$profile = $this->user->getProfile();
if (empty($profile)) {
+ // TRANS: Client error displayed when requesting user information for a user without a profile.
$this->clientError(_('User has no profile.'));
return;
}
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
-
}
/**
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return true;
}
-
}