diff options
Diffstat (limited to 'actions')
91 files changed, 834 insertions, 750 deletions
diff --git a/actions/accessadminpanel.php b/actions/accessadminpanel.php index 73354e97a..027c69c5e 100644 --- a/actions/accessadminpanel.php +++ b/actions/accessadminpanel.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class AccessadminpanelAction extends AdminPanelAction { /** @@ -48,10 +47,9 @@ class AccessadminpanelAction extends AdminPanelAction * * @return string page title */ - function title() { - // TRANS: Page title + // TRANS: Page title for Access admin panel that allows configuring site access. return _('Access'); } @@ -60,10 +58,9 @@ class AccessadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { - // TRANS: Page notice + // TRANS: Page notice. return _('Site access settings'); } @@ -72,7 +69,6 @@ class AccessadminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new AccessAdminPanelForm($this); @@ -85,7 +81,6 @@ class AccessadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { static $booleans = array('site' => array('private', 'inviteonly', 'closed')); @@ -110,7 +105,6 @@ class AccessadminpanelAction extends AdminPanelAction return; } - } class AccessAdminPanelForm extends AdminForm @@ -120,7 +114,6 @@ class AccessAdminPanelForm extends AdminForm * * @return int ID of the form */ - function id() { return 'form_site_admin_panel'; @@ -131,7 +124,6 @@ class AccessAdminPanelForm extends AdminForm * * @return string class of the form */ - function formClass() { return 'form_settings'; @@ -142,7 +134,6 @@ class AccessAdminPanelForm extends AdminForm * * @return string URL of the action */ - function action() { return common_local_url('accessadminpanel'); @@ -153,7 +144,6 @@ class AccessAdminPanelForm extends AdminForm * * @return void */ - function formData() { $this->out->elementStart('fieldset', array('id' => 'settings_admin_access')); @@ -161,7 +151,7 @@ class AccessAdminPanelForm extends AdminForm $this->out->element('legend', null, _('Registration')); $this->out->elementStart('ul', 'form_data'); $this->li(); - // TRANS: Checkbox instructions for admin setting "Private" + // TRANS: Checkbox instructions for admin setting "Private". $instructions = _('Prohibit anonymous users (not logged in) from viewing site?'); // TRANS: Checkbox label for prohibiting anonymous users from viewing site. $this->out->checkbox('private', _m('LABEL', 'Private'), @@ -170,7 +160,7 @@ class AccessAdminPanelForm extends AdminForm $this->unli(); $this->li(); - // TRANS: Checkbox instructions for admin setting "Invite only" + // TRANS: Checkbox instructions for admin setting "Invite only". $instructions = _('Make registration invitation only.'); // TRANS: Checkbox label for configuring site as invite only. $this->out->checkbox('inviteonly', _('Invite only'), @@ -179,7 +169,7 @@ class AccessAdminPanelForm extends AdminForm $this->unli(); $this->li(); - // TRANS: Checkbox instructions for admin setting "Closed" (no new registrations) + // TRANS: Checkbox instructions for admin setting "Closed" (no new registrations). $instructions = _('Disable new registrations.'); // TRANS: Checkbox label for disabling new user registrations. $this->out->checkbox('closed', _('Closed'), @@ -195,12 +185,11 @@ class AccessAdminPanelForm extends AdminForm * * @return void */ - function formActions() { - // TRANS: Title / tooltip for button to save access settings in site admin panel + // TRANS: Title for button to save access settings in site admin panel. $title = _('Save access settings'); + // TRANS: Tooltip for button to save access settings in site admin panel. $this->out->submit('submit', _m('BUTTON', 'Save'), 'submit', null, $title); } - } diff --git a/actions/accesstoken.php b/actions/accesstoken.php index 76bd40473..bfb771b0b 100644 --- a/actions/accesstoken.php +++ b/actions/accesstoken.php @@ -67,4 +67,3 @@ class AccesstokenAction extends Action } } } -?> diff --git a/actions/all.php b/actions/all.php index b65335abc..dc08592fa 100644 --- a/actions/all.php +++ b/actions/all.php @@ -64,7 +64,7 @@ class AllAction extends ProfileAction } if ($this->page > 1 && $this->notice->N == 0) { - // TRANS: Server error when page not found (404) + // TRANS: Server error when page not found (404). $this->serverError(_('No such page.'), $code = 404); } @@ -76,6 +76,7 @@ class AllAction extends ProfileAction parent::handle($args); if (!$this->user) { + // TRANS: Client error when user not found for an action. $this->clientError(_('No such user.')); return; } @@ -103,7 +104,7 @@ class AllAction extends ProfileAction 'nickname' => $this->user->nickname) ), - // TRANS: %s is user nickname + // TRANS: %s is user nickname. sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)), new Feed(Feed::RSS2, common_local_url( @@ -112,7 +113,7 @@ class AllAction extends ProfileAction 'id' => $this->user->nickname ) ), - // TRANS: %s is user nickname + // TRANS: %s is user nickname. sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)), new Feed(Feed::ATOM, common_local_url( @@ -121,7 +122,7 @@ class AllAction extends ProfileAction 'id' => $this->user->nickname ) ), - // TRANS: %s is user nickname + // TRANS: %s is user nickname. sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname)) ); } @@ -134,7 +135,7 @@ class AllAction extends ProfileAction function showEmptyListMessage() { - // TRANS: %s is user nickname + // TRANS: Empty list message. %s is a user nickname. $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' '; if (common_logged_in()) { @@ -144,7 +145,7 @@ class AllAction extends ProfileAction // TRANS: This message contains Markdown links. Keep "](" together. $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.'); } else { - // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@" + // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@". // TRANS: This message contains Markdown links. Keep "](" together. $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname); } @@ -183,10 +184,10 @@ class AllAction extends ProfileAction { $user = common_current_user(); if ($user && ($user->id == $this->user->id)) { - // TRANS: H1 text + // TRANS: H1 text for page when viewing a list for self. $this->element('h1', null, _("You and friends")); } else { - // TRANS: H1 text. %s is a user nickname + // TRANS: H1 text for page. %s is a user nickname. $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname)); } } diff --git a/actions/allrss.php b/actions/allrss.php index 7df0b1ef7..573bb4eb2 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -1,5 +1,4 @@ <?php - /** * RSS feed for user and friends timeline action class. * @@ -57,6 +56,7 @@ class AllrssAction extends Rss10Action * @param array $args Web and URL arguments * * @return boolean false if user doesn't exist + * */ function prepare($args) { @@ -65,6 +65,7 @@ class AllrssAction extends Rss10Action $this->user = User::staticGet('nickname', $nickname); if (!$this->user) { + // TRANS: Client error when user not found for an rss related action. $this->clientError(_('No such user.')); return false; } else { @@ -127,7 +128,7 @@ class AllrssAction extends Rss10Action * Get image. * * @return string user avatar URL or null - */ + */ function getImage() { $user = $this->user; @@ -139,4 +140,3 @@ class AllrssAction extends Rss10Action return $avatar ? $avatar->url : null; } } - diff --git a/actions/apiaccountratelimitstatus.php b/actions/apiaccountratelimitstatus.php index e2dff2db9..8d7f89ead 100644 --- a/actions/apiaccountratelimitstatus.php +++ b/actions/apiaccountratelimitstatus.php @@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiAccountRateLimitStatusAction extends ApiBareAuthAction { - /** * Handle the request * @@ -62,7 +60,6 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -119,11 +116,8 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } - diff --git a/actions/apiaccountupdatedeliverydevice.php b/actions/apiaccountupdatedeliverydevice.php index a7342a94f..ec87c4c95 100644 --- a/actions/apiaccountupdatedeliverydevice.php +++ b/actions/apiaccountupdatedeliverydevice.php @@ -53,7 +53,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ function prepare($args) { diff --git a/actions/apiaccountupdateprofile.php b/actions/apiaccountupdateprofile.php index aea10e33e..163dac42d 100644 --- a/actions/apiaccountupdateprofile.php +++ b/actions/apiaccountupdateprofile.php @@ -51,7 +51,6 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ function prepare($args) { @@ -91,6 +90,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format diff --git a/actions/apiaccountupdateprofilebackgroundimage.php b/actions/apiaccountupdateprofilebackgroundimage.php index 87af962d2..badd8db00 100644 --- a/actions/apiaccountupdateprofilebackgroundimage.php +++ b/actions/apiaccountupdateprofilebackgroundimage.php @@ -114,6 +114,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction } if (empty($this->user)) { + // TRANS: Client error when user not found updating a profile background image. $this->clientError(_('No such user.'), 404, $this->format); return; } diff --git a/actions/apiaccountupdateprofilecolors.php b/actions/apiaccountupdateprofilecolors.php index 9e07d80de..109fbf959 100644 --- a/actions/apiaccountupdateprofilecolors.php +++ b/actions/apiaccountupdateprofilecolors.php @@ -43,10 +43,8 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiAccountUpdateProfileColorsAction extends ApiAuthAction { - var $profile_background_color = null; var $profile_text_color = null; var $profile_link_color = null; @@ -59,9 +57,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -100,7 +96,6 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -116,6 +111,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method updating profile colours. _('API method not found.'), 404, $this->format @@ -126,7 +122,6 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction $design = $this->user->getDesign(); if (!empty($design)) { - $original = clone($design); try { @@ -140,12 +135,11 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction if ($result === false) { common_log_db_error($design, 'UPDATE', __FILE__); + // TRANS: Client error displayed when a database error occurs updating profile colours. $this->clientError(_('Could not update your design.')); return; } - } else { - $this->user->query('BEGIN'); // save new design @@ -162,6 +156,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction if (empty($id)) { common_log_db_error($id, 'INSERT', __FILE__); + // TRANS: Client error displayed when a database error occurs inserting profile colours. $this->clientError(_('Unable to save your design settings.')); return; } @@ -172,6 +167,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction if (empty($result)) { common_log_db_error($original, 'UPDATE', __FILE__); + // TRANS: Client error displayed when a database error occurs updating profile colours. $this->clientError(_('Unable to save your design settings.')); $this->user->query('ROLLBACK'); return; @@ -183,6 +179,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction $profile = $this->user->getProfile(); if (empty($profile)) { + // TRANS: Client error displayed a user has no profile updating profile colours. $this->clientError(_('User has no profile.')); return; } @@ -207,7 +204,6 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction * * @return void */ - function setColors($design) { $bgcolor = empty($this->profile_background_color) ? @@ -243,5 +239,4 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction return true; } - } diff --git a/actions/apiaccountupdateprofileimage.php b/actions/apiaccountupdateprofileimage.php index 1f38bd220..f2886509d 100644 --- a/actions/apiaccountupdateprofileimage.php +++ b/actions/apiaccountupdateprofileimage.php @@ -43,19 +43,15 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiAccountUpdateProfileImageAction extends ApiAuthAction { - /** * Take arguments for running * * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -74,7 +70,6 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -105,6 +100,7 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction } if (empty($this->user)) { + // TRANS: Client error displayed updating profile image without having a user object. $this->clientError(_('No such user.'), 404, $this->format); return; } @@ -130,6 +126,7 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction $profile = $this->user->getProfile(); if (empty($profile)) { + // TRANS: Client error displayed if a user profile could not be found updating a profile image. $this->clientError(_('User has no profile.')); return; } @@ -150,5 +147,4 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction $this->endDocument('json'); } } - } diff --git a/actions/apiaccountverifycredentials.php b/actions/apiaccountverifycredentials.php index 79416e9b2..26d4e2fc5 100644 --- a/actions/apiaccountverifycredentials.php +++ b/actions/apiaccountverifycredentials.php @@ -48,10 +48,8 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiAccountVerifyCredentialsAction extends ApiAuthAction { - /** * Handle the request * @@ -61,12 +59,12 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (!in_array($this->format, array('xml', 'json'))) { + // TRANS: Client error displayed trying to execute an unknown API method verifying user credentials. $this->clientError(_('API method not found.'), $code = 404); return; } @@ -91,12 +89,9 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction * @param array $args other arguments * * @return boolean true - * - **/ - + */ function isReadOnly($args) { return true; } - } diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php index b69907784..7dd0859e9 100644 --- a/actions/apiblockdestroy.php +++ b/actions/apiblockdestroy.php @@ -55,7 +55,6 @@ class ApiBlockDestroyAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ function prepare($args) { @@ -91,6 +90,7 @@ class ApiBlockDestroyAction extends ApiAuthAction } if (empty($this->user) || empty($this->other)) { + // TRANS: Client error when user not found for an API action to remove a block for a user. $this->clientError(_('No such user.'), 404, $this->format); return; } diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index 4e2ec5eb0..e072e27b8 100644 --- a/actions/apidirectmessage.php +++ b/actions/apidirectmessage.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiDirectMessageAction extends ApiAuthAction { var $messages = null; @@ -64,9 +63,7 @@ class ApiDirectMessageAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -87,12 +84,12 @@ class ApiDirectMessageAction extends ApiAuthAction // Action was called by /api/direct_messages/sent.format $this->title = sprintf( - // TRANS: %s is a user nickname. + // TRANS: Title. %s is a user nickname. _("Direct messages from %s"), $this->user->nickname ); $this->subtitle = sprintf( - // TRANS: %s is a user nickname. + // TRANS: Subtitle. %s is a user nickname. _("All the direct messages sent from %s"), $this->user->nickname ); @@ -101,12 +98,12 @@ class ApiDirectMessageAction extends ApiAuthAction $this->id = "tag:$taguribase:SentDirectMessages:" . $this->user->id; } else { $this->title = sprintf( - // TRANS: %s is a user nickname. + // TRANS: Title. %s is a user nickname. _("Direct messages to %s"), $this->user->nickname ); $this->subtitle = sprintf( - // TRANS: %s is a user nickname. + // TRANS: Subtitle. %s is a user nickname. _("All the direct messages sent to %s"), $this->user->nickname ); @@ -129,7 +126,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -141,7 +137,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showMessages() { switch($this->format) { @@ -169,7 +164,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return array notices */ - function getMessages() { $message = new Message(); @@ -208,7 +202,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -219,7 +212,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->messages)) { @@ -234,7 +226,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showXmlDirectMessages() { $this->initDocument('xml'); @@ -255,7 +246,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showJsonDirectMessages() { $this->initDocument('json'); @@ -276,7 +266,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showRssDirectMessages() { $this->initDocument('rss'); @@ -311,7 +300,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showAtomDirectMessages() { $this->initDocument('atom'); @@ -353,7 +341,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return string etag */ - function etag() { if (!empty($this->messages)) { @@ -374,5 +361,4 @@ class ApiDirectMessageAction extends ApiAuthAction return null; } - } diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php index ccef57b3f..b335a9c93 100644 --- a/actions/apidirectmessagenew.php +++ b/actions/apidirectmessagenew.php @@ -60,7 +60,6 @@ class ApiDirectMessageNewAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ function prepare($args) { @@ -69,6 +68,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction $this->user = $this->auth_user; if (empty($this->user)) { + // TRANS: Client error when user not found for an API direct message action. $this->clientError(_('No such user.'), 404, $this->format); return; } @@ -113,7 +113,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction if (empty($this->content)) { $this->clientError( - // TRANS: Client error (406). + // TRANS: Client error displayed when no message text was submitted (406). _('No message text!'), 406, $this->format diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php index 90a29d228..b2f6266eb 100644 --- a/actions/apifavoritecreate.php +++ b/actions/apifavoritecreate.php @@ -58,7 +58,6 @@ class ApiFavoriteCreateAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ function prepare($args) { @@ -95,6 +94,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format diff --git a/actions/apifavoritedestroy.php b/actions/apifavoritedestroy.php index c2e1ebafc..f86c985dc 100644 --- a/actions/apifavoritedestroy.php +++ b/actions/apifavoritedestroy.php @@ -48,10 +48,8 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiFavoriteDestroyAction extends ApiAuthAction { - var $notice = null; /** @@ -60,9 +58,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -82,7 +78,6 @@ class ApiFavoriteDestroyAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -99,6 +94,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format @@ -108,6 +104,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction if (empty($this->notice)) { $this->clientError( + // TRANS: Client error displayed when trying to remove a favourite with an invalid ID. _('No status found with that ID.'), 404, $this->format @@ -121,6 +118,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction if (!$fave->find(true)) { $this->clientError( + // TRANS: Client error displayed when trying to remove a favourite that was not a favourite. _('That status is not a favorite.'), 403, $this->favorite @@ -133,6 +131,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction if (!$result) { common_log_db_error($fave, 'DELETE', __FILE__); $this->clientError( + // TRANS: Client error displayed when removing a favourite has failed. _('Could not delete favorite.'), 404, $this->format @@ -148,5 +147,4 @@ class ApiFavoriteDestroyAction extends ApiAuthAction $this->show_single_json_status($this->notice); } } - } diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index 64c857c70..89557f839 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiFriendshipsCreateAction extends ApiAuthAction { var $other = null; @@ -61,7 +60,6 @@ class ApiFriendshipsCreateAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -81,7 +79,6 @@ class ApiFriendshipsCreateAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -98,6 +95,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format @@ -107,6 +105,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if (empty($this->other)) { $this->clientError( + // TRANS: Client error displayed when trying follow who's profile could not be found. _('Could not follow user: profile not found.'), 403, $this->format @@ -116,6 +115,8 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if ($this->user->isSubscribed($this->other)) { $errmsg = sprintf( + // TRANS: Client error displayed when trying to follow a user that's already being followed. + // TRANS: %s is the nickname of the user that is already being followed. _('Could not follow user: %s is already on your list.'), $this->other->nickname ); @@ -134,5 +135,4 @@ class ApiFriendshipsCreateAction extends ApiAuthAction $this->showProfile($this->other, $this->format); $this->endDocument($this->format); } - } diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php index 21da23ef7..a5dff08ba 100644 --- a/actions/apifriendshipsdestroy.php +++ b/actions/apifriendshipsdestroy.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiFriendshipsDestroyAction extends ApiAuthAction { var $other = null; @@ -61,7 +60,6 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -81,7 +79,6 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -98,6 +95,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format @@ -107,6 +105,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction if (empty($this->other)) { $this->clientError( + // TRANS: Client error displayed when trying to unfollow a user that cannot be found. _('Could not unfollow user: User not found.'), 403, $this->format @@ -118,6 +117,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction if ($this->user->id == $this->other->id) { $this->clientError( + // TRANS: Client error displayed when trying to unfollow self. _("You cannot unfollow yourself."), 403, $this->format @@ -132,5 +132,4 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction $this->showProfile($this->other, $this->format); $this->endDocument($this->format); } - } diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index 725178fd4..43b1daf4f 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -47,7 +47,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiFriendshipsExistsAction extends ApiPrivateAuthAction { var $profile_a = null; @@ -59,9 +58,7 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -81,14 +78,14 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (empty($this->profile_a) || empty($this->profile_b)) { $this->clientError( - _('Two valid IDs or screen_names must be supplied.'), + // TRANS: Client error displayed when supplying invalid parameters to an API call checking if a friendship exists. + _('Two valid IDs or nick names must be supplied.'), 400, $this->format ); @@ -122,10 +119,8 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } diff --git a/actions/apifriendshipsshow.php b/actions/apifriendshipsshow.php index f29e63713..6b069c4fc 100644 --- a/actions/apifriendshipsshow.php +++ b/actions/apifriendshipsshow.php @@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiFriendshipsShowAction extends ApiBareAuthAction { var $source = null; @@ -58,9 +57,7 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -93,7 +90,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction * * @return boolean true or false */ - function requiresAuth() { if (common_config('site', 'private')) { @@ -119,18 +115,19 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (!in_array($this->format, array('xml', 'json'))) { + // TRANS: Client error displayed trying to execute an unknown API method showing friendship. $this->clientError(_('API method not found.'), 404); return; } if (empty($this->source)) { $this->clientError( + // TRANS: Client error displayed when a source user could not be determined showing friendship. _('Could not determine source user.'), 404 ); @@ -139,6 +136,7 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction if (empty($this->target)) { $this->clientError( + // TRANS: Client error displayed when a target user could not be determined showing friendship. _('Could not find target user.'), 404 ); @@ -161,7 +159,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction default: break; } - } /** @@ -178,5 +175,4 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction { return true; } - } diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php index 1608e030b..54875a718 100644 --- a/actions/apigroupcreate.php +++ b/actions/apigroupcreate.php @@ -66,9 +66,7 @@ class ApiGroupCreateAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -150,7 +148,6 @@ class ApiGroupCreateAction extends ApiAuthAction * * @return void */ - function validateParams() { $valid = Validate::string( @@ -218,7 +215,11 @@ class ApiGroupCreateAction extends ApiAuthAction } elseif (User_group::descriptionTooLong($this->description)) { $this->clientError( sprintf( - _('Description is too long (max %d chars).'), + // TRANS: Client error shown when providing too long a description during group creation. + // TRANS: %d is the maximum number of allowed characters. + _m('Description is too long (maximum %d character).', + 'Description is too long (maximum %d characters).', + User_group::maxDescription()), User_group::maxDescription() ), 403, @@ -229,6 +230,7 @@ class ApiGroupCreateAction extends ApiAuthAction !is_null($this->location) && mb_strlen($this->location) > 255) { $this->clientError( + // TRANS: Client error shown when providing too long a location during group creation. _('Location is too long (maximum 255 characters).'), 403, $this->format @@ -248,7 +250,11 @@ class ApiGroupCreateAction extends ApiAuthAction if (count($this->aliases) > common_config('group', 'maxaliases')) { $this->clientError( sprintf( - _('Too many aliases! Maximum %d.'), + // TRANS: Client error shown when providing too many aliases during group creation. + // TRANS: %d is the maximum number of allowed aliases. + _m('Too many aliases! Maximum %d allowed.', + 'Too many aliases! Maximum %d allowed.', + common_config('group', 'maxaliases')), common_config('group', 'maxaliases') ), 403, @@ -269,6 +275,8 @@ class ApiGroupCreateAction extends ApiAuthAction if (!$valid) { $this->clientError( + // TRANS: Client error shown when providing an invalid alias during group creation. + // TRANS: %s is the invalid alias. sprintf(_('Invalid alias: "%s".'), $alias), 403, $this->format @@ -278,6 +286,8 @@ class ApiGroupCreateAction extends ApiAuthAction if ($this->groupNicknameExists($alias)) { $this->clientError( sprintf( + // TRANS: Client error displayed when trying to use an alias during group creation that is already in use. + // TRANS: %s is the alias that is already in use. _('Alias "%s" already in use. Try another one.'), $alias ), @@ -291,6 +301,7 @@ class ApiGroupCreateAction extends ApiAuthAction if (strcmp($alias, $this->nickname) == 0) { $this->clientError( + // TRANS: Client error displayed when trying to use an alias during group creation that is the same as the group's nickname. _('Alias can\'t be the same as nickname.'), 403, $this->format @@ -299,7 +310,7 @@ class ApiGroupCreateAction extends ApiAuthAction } } - // Evarything looks OK + // Everything looks OK return true; } @@ -311,7 +322,6 @@ class ApiGroupCreateAction extends ApiAuthAction * * @return boolean true or false */ - function groupNicknameExists($nickname) { $local = Local_group::staticGet('nickname', $nickname); @@ -328,5 +338,4 @@ class ApiGroupCreateAction extends ApiAuthAction return false; } - } diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php index eaa4769f3..8d31c65dd 100644 --- a/actions/apigroupismember.php +++ b/actions/apigroupismember.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupIsMemberAction extends ApiBareAuthAction { var $group = null; @@ -60,7 +59,6 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ function prepare($args) @@ -82,17 +80,18 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (empty($this->user)) { + // TRANS: Client error displayed when checking group membership for a non-existing user. $this->clientError(_('No such user.'), 404, $this->format); return; } if (empty($this->group)) { + // TRANS: Client error displayed when checking group membership for a non-existing group. $this->clientError(_('Group not found.'), 404, $this->format); return false; } @@ -112,6 +111,7 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction break; default: $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method showing group membership. _('API method not found.'), 400, $this->format @@ -129,10 +129,8 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } diff --git a/actions/apigroupjoin.php b/actions/apigroupjoin.php index a0c069974..345fed221 100644 --- a/actions/apigroupjoin.php +++ b/actions/apigroupjoin.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupJoinAction extends ApiAuthAction { var $group = null; @@ -60,9 +59,7 @@ class ApiGroupJoinAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -82,7 +79,6 @@ class ApiGroupJoinAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -98,17 +94,20 @@ class ApiGroupJoinAction extends ApiAuthAction } if (empty($this->user)) { + // TRANS: Client error displayed when trying to have a non-existing user join a group. $this->clientError(_('No such user.'), 404, $this->format); return; } if (empty($this->group)) { + // TRANS: Client error displayed when trying to join a group that does not exist. $this->clientError(_('Group not found.'), 404, $this->format); return false; } if ($this->user->isMember($this->group)) { $this->clientError( + // TRANS: Server error displayed when trying to join a group the user is already a member of. _('You are already a member of that group.'), 403, $this->format @@ -118,6 +117,7 @@ class ApiGroupJoinAction extends ApiAuthAction if (Group_block::isBlocked($this->group, $this->user->getProfile())) { $this->clientError( + // TRANS: Server error displayed when trying to join a group the user is blocked from joining. _('You have been blocked from that group by the admin.'), 403, $this->format @@ -137,6 +137,8 @@ class ApiGroupJoinAction extends ApiAuthAction common_log_db_error($member, 'INSERT', __FILE__); $this->serverError( sprintf( + // TRANS: Server error displayed when joining a group fails. + // TRANS: %1$s is a user nickname, $2$s is a group nickname. _('Could not join user %1$s to group %2$s.'), $this->user->nickname, $this->group->nickname @@ -154,6 +156,7 @@ class ApiGroupJoinAction extends ApiAuthAction break; default: $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method joining a group. _('API method not found.'), 404, $this->format @@ -161,5 +164,4 @@ class ApiGroupJoinAction extends ApiAuthAction break; } } - } diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php index c838f6c87..0ceb3523c 100644 --- a/actions/apigroupleave.php +++ b/actions/apigroupleave.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupLeaveAction extends ApiAuthAction { var $group = null; @@ -60,9 +59,7 @@ class ApiGroupLeaveAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -82,7 +79,6 @@ class ApiGroupLeaveAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -98,11 +94,13 @@ class ApiGroupLeaveAction extends ApiAuthAction } if (empty($this->user)) { + // TRANS: Client error displayed when trying to have a non-existing user leave a group. $this->clientError(_('No such user.'), 404, $this->format); return; } if (empty($this->group)) { + // TRANS: Client error displayed when trying to leave a group that does not exist. $this->clientError(_('Group not found.'), 404, $this->format); return false; } @@ -113,6 +111,7 @@ class ApiGroupLeaveAction extends ApiAuthAction $member->profile_id = $this->auth_user->id; if (!$member->find(true)) { + // TRANS: Server error displayed when trying to leave a group the user is not a member of. $this->serverError(_('You are not a member of this group.')); return; } @@ -123,6 +122,8 @@ class ApiGroupLeaveAction extends ApiAuthAction common_log_db_error($member, 'DELETE', __FILE__); $this->serverError( sprintf( + // TRANS: Server error displayed when leaving a group fails. + // TRANS: %1$s is a user nickname, $2$s is a group nickname. _('Could not remove user %1$s from group %2$s.'), $this->user->nickname, $this->group->nickname @@ -140,6 +141,7 @@ class ApiGroupLeaveAction extends ApiAuthAction break; default: $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method leaving a group. _('API method not found.'), 404, $this->format @@ -147,5 +149,4 @@ class ApiGroupLeaveAction extends ApiAuthAction break; } } - } diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php index 319a1e424..1f6d44363 100644 --- a/actions/apigrouplist.php +++ b/actions/apigrouplist.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupListAction extends ApiBareAuthAction { var $groups = null; @@ -60,9 +59,7 @@ class ApiGroupListAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -88,13 +85,12 @@ class ApiGroupListAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); $sitename = common_config('site', 'name'); - // TRANS: %s is a user name + // TRANS: Used as title in check for group membership. %s is a user name. $title = sprintf(_("%s's groups"), $this->user->nickname); $taguribase = TagURI::base(); $id = "tag:$taguribase:Groups"; @@ -104,8 +100,8 @@ class ApiGroupListAction extends ApiBareAuthAction ); $subtitle = sprintf( - // TRANS: Meant to convey the user %2$s is a member of each of the groups listed on site %1$s - _("%1\$s groups %2\$s is a member of."), + // TRANS: Used as subtitle in check for group membership. %1$s is a user name, %2$s is the site name. + _('%1$s groups %2$s is a member of.'), $sitename, $this->user->nickname ); @@ -134,13 +130,13 @@ class ApiGroupListAction extends ApiBareAuthAction break; default: $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method checking group membership. _('API method not found.'), 404, $this->format ); break; } - } /** @@ -148,7 +144,6 @@ class ApiGroupListAction extends ApiBareAuthAction * * @return array groups */ - function getGroups() { $groups = array(); @@ -174,7 +169,6 @@ class ApiGroupListAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -203,7 +197,6 @@ class ApiGroupListAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->groups) && (count($this->groups) > 0)) { @@ -224,5 +217,4 @@ class ApiGroupListAction extends ApiBareAuthAction return null; } - } diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index cc7cd901d..d05baa099 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupListAllAction extends ApiPrivateAuthAction { var $groups = null; @@ -60,9 +59,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -82,17 +79,17 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); $sitename = common_config('site', 'name'); - // TRANS: Message is used as a title. %s is a site name. + // TRANS: Message is used as a title when listing the lastest 20 groups. %s is a site name. $title = sprintf(_("%s groups"), $sitename); $taguribase = TagURI::base(); $id = "tag:$taguribase:Groups"; $link = common_local_url('groups'); + // TRANS: Message is used as a subtitle when listing the lastest 20 groups. %s is a site name. $subtitle = sprintf(_("groups on %s"), $sitename); switch($this->format) { @@ -119,13 +116,13 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction break; default: $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method listing the latest 20 groups. _('API method not found.'), 404, $this->format ); break; } - } /** @@ -133,7 +130,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction * * @return array groups */ - function getGroups() { $qry = 'SELECT user_group.* '. @@ -165,7 +161,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -176,7 +171,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction * * @return string datestamp of the site's latest group */ - function lastModified() { if (!empty($this->groups) && (count($this->groups) > 0)) { @@ -194,7 +188,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->groups) && (count($this->groups) > 0)) { @@ -214,5 +207,4 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction return null; } - } diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index b7f3064b5..99ac965fa 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupMembershipAction extends ApiPrivateAuthAction { var $group = null; @@ -61,9 +60,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -83,12 +80,12 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (empty($this->group)) { + // TRANS: Client error displayed trying to show group membership on a non-existing group. $this->clientError(_('Group not found.'), 404, $this->format); return false; } @@ -104,6 +101,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction break; default: $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method showing group membership. _('API method not found.'), 404, $this->format @@ -117,7 +115,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return array $profiles list of profiles */ - function getProfiles() { $profiles = array(); @@ -143,7 +140,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -154,7 +150,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return string datestamp of the lastest profile in the group */ - function lastModified() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -173,7 +168,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -194,5 +188,4 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction return null; } - } diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 9b90e6b38..471aa141f 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -50,7 +50,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupShowAction extends ApiPrivateAuthAction { var $group = null; @@ -61,9 +60,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -80,6 +77,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction common_redirect(common_local_url('ApiGroupShow', $args), 301); } else { $this->clientError( + // TRANS: Client error displayed when trying to show a group that could not be found. _('Group not found.'), 404, $this->format @@ -100,7 +98,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -113,6 +110,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->showSingleJsonGroup($this->group); break; default: + // TRANS: Client error displayed trying to execute an unknown API method showing a group. $this->clientError(_('API method not found.'), 404, $this->format); break; } @@ -123,7 +121,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->group)) { @@ -141,7 +138,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->group)) { @@ -169,10 +165,8 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } diff --git a/actions/apihelptest.php b/actions/apihelptest.php index d0e9e4926..fbe5f1278 100644 --- a/actions/apihelptest.php +++ b/actions/apihelptest.php @@ -44,19 +44,15 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiHelpTestAction extends ApiPrivateAuthAction { - /** * Take arguments for running * * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -70,7 +66,6 @@ class ApiHelpTestAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -85,6 +80,7 @@ class ApiHelpTestAction extends ApiPrivateAuthAction $this->endDocument('json'); } else { $this->clientError( + // TRANS: Client error displayed trying to execute an unknown API method testing API connectivity. _('API method not found.'), 404, $this->format @@ -101,11 +97,8 @@ class ApiHelpTestAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } - diff --git a/actions/apimediaupload.php b/actions/apimediaupload.php index a33771cae..0b08dbedf 100644 --- a/actions/apimediaupload.php +++ b/actions/apimediaupload.php @@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php'; * @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 { /** @@ -57,7 +56,6 @@ class ApiMediaUploadAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -99,6 +97,7 @@ class ApiMediaUploadAction extends ApiAuthAction if (isset($upload)) { $this->showResponse($upload); } else { + // TRANS: Client error displayed when uploading a media file has failed. $this->clientError(_('Upload failed.')); return; } @@ -126,7 +125,6 @@ class ApiMediaUploadAction extends ApiAuthAction * Overrided clientError to show a more Twitpic-like error * * @param String $msg an error message - * */ function clientError($msg) { @@ -140,5 +138,4 @@ class ApiMediaUploadAction extends ApiAuthAction $this->elementEnd('rsp'); $this->endDocument(); } - } diff --git a/actions/apioauthaccesstoken.php b/actions/apioauthaccesstoken.php index f66e4af1e..064d05120 100644 --- a/actions/apioauthaccesstoken.php +++ b/actions/apioauthaccesstoken.php @@ -79,7 +79,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction $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)); @@ -88,7 +87,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction } if (empty($atok)) { - // Token exchange failed -- log it $msg = sprintf( @@ -101,7 +99,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction 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, @@ -121,7 +118,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction * * @param OAuthToken token the access token */ - function showAccessToken($token) { header('Content-Type: application/x-www-form-urlencoded'); diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index f2f1071d9..d76ae060f 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -58,7 +58,6 @@ class ApiOauthAuthorizeAction extends Action * * @return boolean false */ - function isReadOnly($args) { return false; @@ -144,6 +143,7 @@ class ApiOauthAuthorizeAction extends Action 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; } @@ -177,7 +177,6 @@ class ApiOauthAuthorizeAction extends Action assert(!empty($this->reqToken)); if ($this->arg('allow')) { - // mark the req token as authorized try { $this->store->authorize_token($this->oauthTokenParam); @@ -250,9 +249,7 @@ class ApiOauthAuthorizeAction extends Action // Otherwise, inform the user that the rt was authorized $this->showAuthorized(); - } else if ($this->arg('cancel')) { - common_log( LOG_INFO, sprintf( @@ -323,18 +320,46 @@ class ApiOauthAuthorizeAction extends Action } /** - * Override to add some special (more compact) styling when the page is - * being displayed in desktop mode. + * Show body - override to add a special CSS class for the authorize + * page's "desktop mode" (minimal display) + * + * Calls template methods * * @return nothing */ - function showStylesheets() + function showBody() { - parent::showStyleSheets(); + $bodyClasses = array(); if ($this->desktopMode()) { - $this->style('#wrap {min-width: 500px;} #content {width: 480px; padding: 6px; margin: 4px 0px 0px 4px; border-top-left-radius: 7px; -moz-border-radius-topleft: 7px; -webkit-border-top-left-radius: 7px;} fieldset {margin-bottom: 10px !important;}'); + $bodyClasses[] = 'oauth-desktop-mode'; } + + if (common_current_user()) { + $bodyClasses[] = 'user_in'; + } + + $attrs = array('id' => strtolower($this->trimmed('action'))); + + if (!empty($bodyClasses)) { + $attrs['class'] = implode(' ', $bodyClasses); + } + + $this->elementStart('body', $attrs); + + $this->elementStart('div', array('id' => 'wrap')); + if (Event::handle('StartShowHeader', array($this))) { + $this->showHeader(); + Event::handle('EndShowHeader', array($this)); + } + $this->showCore(); + if (Event::handle('StartShowFooter', array($this))) { + $this->showFooter(); + Event::handle('EndShowFooter', array($this)); + } + $this->elementEnd('div'); + $this->showScripts(); + $this->elementEnd('body'); } function showForm($error=null) @@ -386,21 +411,31 @@ class ApiOauthAuthorizeAction extends Action $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $this->elementStart('p'); - if (!empty($this->app->icon)) { + if (!empty($this->app->icon) && $this->app->name != 'anonymous') { $this->element('img', array('src' => $this->app->icon)); } $access = ($this->app->access_type & Oauth_application::$writeAccess) ? 'access and update' : 'access'; - // TRANS: User notification of external application requesting account access. - // TRANS: %1$s is the application name requesting access, %2$s is the organisation behind the application, - // TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename. - $msg = _('The application <strong>%1$s</strong> by ' . - '<strong>%2$s</strong> would like the ability ' . + if ($this->app->name == 'anonymous') { + // Special message for the anonymous app and consumer. + // TRANS: User notification of external application requesting account access. + // TRANS: %3$s is the access type requested (read-write or read-only), %4$s is the StatusNet sitename. + $msg = _('An application would like the ability ' . 'to <strong>%3$s</strong> your %4$s account data. ' . 'You should only give access to your %4$s account ' . 'to third parties you trust.'); + } else { + // TRANS: User notification of external application requesting account access. + // TRANS: %1$s is the application name requesting access, %2$s is the organisation behind the application, + // TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename. + $msg = _('The application <strong>%1$s</strong> by ' . + '<strong>%2$s</strong> would like the ability ' . + 'to <strong>%3$s</strong> your %4$s account data. ' . + 'You should only give access to your %4$s account ' . + 'to third parties you trust.'); + } $this->raw(sprintf($msg, $this->app->name, @@ -576,25 +611,46 @@ class ApiOauthAuthorizeAction extends Action */ function showAuthorized() { - $title = sprintf( - // TRANS: Header of user notification after authorising an application access to a profile. - // TRANS: %s is the authorised application name. - _('You have successfully authorized %s.'), - $this->app->name - ); + $title = null; + $msg = null; - $msg = sprintf( - // TRANS: Uer notification after authorising an application access to a profile. - // TRANS: %s is the authorised application name. - _('Please return to %s and enter the following security code to complete the process.'), - $this->app->name - ); + if ($this->app->name == 'anonymous') { + + $title = + // TRANS: Title of the page notifying the user that an anonymous client application was successfully authorized to access the user's account with OAuth. + _('You have successfully authorized the application'); + + $msg = + // TRANS: Message notifying the user that an anonymous client application was successfully authorized to access the user's account with OAuth. + _('Please return to the application and enter the following security code to complete the process.'); + + } else { + + $title = sprintf( + // TRANS: Title of the page notifying the user that the client application was successfully authorized to access the user's account with OAuth. + // TRANS: %s is the authorised application name. + _('You have successfully authorized %s'), + $this->app->name + ); + + $msg = sprintf( + // TRANS: Message notifying the user that the client application was successfully authorized to access the user's account with OAuth. + // TRANS: %s is the authorised application name. + _('Please return to %s and enter the following security code to complete the process.'), + $this->app->name + ); + + } if ($this->reqToken->verified_callback == 'oob') { - $pin = new ApiOauthPinAction($title, $msg, $this->reqToken->verifier); + $pin = new ApiOauthPinAction( + $title, + $msg, + $this->reqToken->verifier, + $this->desktopMode() + ); $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 @@ -635,7 +691,6 @@ class ApiOauthAuthorizeAction extends Action $callback = $this->app->callback_url; } - } return $callback; diff --git a/actions/apioauthpin.php b/actions/apioauthpin.php index 5e6713a54..22fb95adb 100644 --- a/actions/apioauthpin.php +++ b/actions/apioauthpin.php @@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/lib/info.php'; - /** * Class for displaying an OAuth verifier pin * @@ -44,17 +42,124 @@ require_once INSTALLDIR . '/lib/info.php'; * @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) + function __construct($title, $message, $verifier, $desktopMode = false) { - $this->verifier = $verifier; - $this->title = $title; + $this->verifier = $verifier; + $this->title = $title; + $this->desktopMode = $desktopMode; parent::__construct($title, $message); } /** + * Show body - override to add a special CSS class for the pin pages's + * "desktop mode" (minimal display) + * + * Calls template methods + * + * @return nothing + */ + function showBody() + { + $bodyClasses = array(); + + if ($this->desktopMode) { + $bodyClasses[] = 'oauth-desktop-mode'; + } + + if (common_current_user()) { + $bodyClasses[] = 'user_in'; + } + + $attrs = array('id' => strtolower($this->trimmed('action'))); + + if (!empty($bodyClasses)) { + $attrs['class'] = implode(' ', $bodyClasses); + } + + $this->elementStart('body', $attrs); + + $this->elementStart('div', array('id' => 'wrap')); + if (Event::handle('StartShowHeader', array($this))) { + $this->showHeader(); + Event::handle('EndShowHeader', array($this)); + } + $this->showCore(); + if (Event::handle('StartShowFooter', array($this))) { + $this->showFooter(); + Event::handle('EndShowFooter', array($this)); + } + $this->elementEnd('div'); + $this->showScripts(); + $this->elementEnd('body'); + } + + /** + * A local menu + * + * Shows different login/register actions. + * + * @return void + */ + function showLocalNav() + { + // NOP + } + + /* + * Override - suppress output in "desktop" mode + */ + function showHeader() + { + if ($this->desktopMode == false) { + parent::showHeader(); + } + } + + /* + * Override - suppress output in "desktop" mode + */ + function showAside() + { + if ($this->desktopMode == false) { + parent::showAside(); + } + } + + /* + * Override - suppress output in "desktop" mode + */ + function showFooter() + { + if ($this->desktopMode == false) { + parent::showFooter(); + } + } + + /** + * Show site notice. + * + * @return nothing + */ + function showSiteNotice() + { + // NOP + } + + /** + * Show notice form. + * + * Show the form for posting a new notice + * + * @return nothing + */ + function showNoticeForm() + { + // NOP + } + + /** * Display content. * * @return nothing diff --git a/actions/apioauthrequesttoken.php b/actions/apioauthrequesttoken.php index 376567125..31e638746 100644 --- a/actions/apioauthrequesttoken.php +++ b/actions/apioauthrequesttoken.php @@ -42,7 +42,6 @@ require_once INSTALLDIR . '/lib/apioauth.php'; * @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 { /** @@ -51,9 +50,7 @@ class ApiOauthRequestTokenAction extends ApiOauthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -74,7 +71,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -127,7 +123,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction /* * Display temporary OAuth credentials */ - function showRequestToken($token) { header('Content-Type: application/x-www-form-urlencoded'); @@ -142,7 +137,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction * * @return boolean true or false */ - function verifyCallback($callback) { if ($callback == "oob") { @@ -157,5 +151,4 @@ class ApiOauthRequestTokenAction extends ApiOauthAction return Validate::uri($callback); } } - } diff --git a/actions/apisearchatom.php b/actions/apisearchatom.php index 60bb8b040..6743e92c8 100644 --- a/actions/apisearchatom.php +++ b/actions/apisearchatom.php @@ -48,10 +48,8 @@ require_once INSTALLDIR.'/lib/apiprivateauth.php'; * * @see ApiPrivateAuthAction */ - class ApiSearchAtomAction extends ApiPrivateAuthAction { - var $cnt; var $query; var $lang; @@ -70,7 +68,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @see Action::__construct */ - function __construct($output='php://output', $indent=null) { parent::__construct($output, $indent); @@ -81,7 +78,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadonly() { return true; @@ -93,16 +89,13 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * @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'); @@ -139,7 +132,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -154,7 +146,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return array an array of Notice objects sorted in reverse chron */ - function getNotices() { // TODO: Support search operators like from: and to:, boolean, etc. @@ -180,7 +171,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction if ($this->cnt > 0) { while ($notice->fetch()) { - ++$cnt; if (!$this->max_id) { @@ -203,7 +193,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return void */ - function showAtom() { $notices = $this->getNotices(); @@ -212,7 +201,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction $this->showFeed(); foreach ($notices as $n) { - $profile = $n->getProfile(); // Don't show notices from deleted users @@ -230,7 +218,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return void */ - function showFeed() { // TODO: A9 OpenSearch stuff like search.twitter.com? @@ -278,6 +265,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction 'rel' => 'self', 'href' => $self_uri)); + // @todo Needs i18n? $this->element('title', null, "$this->query - $sitename Search"); $this->element('updated', null, common_date_iso8601('now')); @@ -313,7 +301,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction 'rel' => 'previous', 'href' => $previous_uri)); } - } /** @@ -324,7 +311,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return void */ - function showEntry($notice) { $server = common_config('site', 'server'); @@ -356,10 +342,10 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction 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; } @@ -372,6 +358,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction $name = $profile->nickname; if ($profile->fullname) { + // @todo Needs proper i18n? $name .= ' (' . $profile->fullname . ')'; } @@ -387,7 +374,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return void */ - function initAtom() { header('Content-Type: application/atom+xml; charset=utf-8'); @@ -399,10 +385,8 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction * * @return void */ - function endAtom() { $this->elementEnd('feed'); } - } diff --git a/actions/apisearchjson.php b/actions/apisearchjson.php index e44634684..38e612ee3 100644 --- a/actions/apisearchjson.php +++ b/actions/apisearchjson.php @@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php'; * @link http://status.net/ * @see ApiAction */ - class ApiSearchJSONAction extends ApiPrivateAuthAction { var $query; @@ -62,7 +61,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction * * @return boolean true if nothing goes wrong */ - function prepare($args) { common_debug("apisearchjson prepare()"); @@ -100,7 +98,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -112,10 +109,8 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction * * @return void */ - function showResults() { - // TODO: Support search operators like from: and to:, boolean, etc. $notice = new Notice(); @@ -146,7 +141,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index 485eae66e..d73e574b3 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -55,7 +55,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @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; @@ -66,9 +65,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -94,13 +91,13 @@ class ApiStatusesDestroyAction extends ApiAuthAction * * @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 ); @@ -109,6 +106,8 @@ class ApiStatusesDestroyAction extends ApiAuthAction 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 @@ -118,6 +117,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction 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 ); @@ -132,6 +132,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction $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 @@ -144,7 +145,6 @@ class ApiStatusesDestroyAction extends ApiAuthAction * * @return void */ - function showNotice() { if (!empty($this->notice)) { @@ -155,5 +155,4 @@ class ApiStatusesDestroyAction extends ApiAuthAction } } } - } diff --git a/actions/apistatusesretweet.php b/actions/apistatusesretweet.php index aae98f637..ecc4a3f03 100644 --- a/actions/apistatusesretweet.php +++ b/actions/apistatusesretweet.php @@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php'; * @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; @@ -54,9 +53,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -73,6 +70,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction $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; @@ -81,6 +79,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction $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; @@ -89,6 +88,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction $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; @@ -106,15 +106,12 @@ class ApiStatusesRetweetAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); $repeat = $this->original->repeat($this->user->id, $this->source); - - $this->showNotice($repeat); } @@ -123,7 +120,6 @@ class ApiStatusesRetweetAction extends ApiAuthAction * * @return void */ - function showNotice($notice) { if (!empty($notice)) { diff --git a/actions/apistatusesretweets.php b/actions/apistatusesretweets.php index a79d43168..cc7caee19 100644 --- a/actions/apistatusesretweets.php +++ b/actions/apistatusesretweets.php @@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php'; * @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; @@ -57,9 +56,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -69,6 +66,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction $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; @@ -94,7 +92,6 @@ class ApiStatusesRetweetsAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -109,6 +106,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction $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; } diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 86ffd6862..f4a79ddbc 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -55,10 +55,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @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; @@ -68,9 +66,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -100,12 +96,12 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (!in_array($this->format, array('xml', 'json', 'atom'))) { + // TRANS: Client error displayed when trying to handle an unknown API method. $this->clientError(_('API method not found.'), 404); return; } @@ -128,7 +124,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction * * @return void */ - function showNotice() { if (!empty($this->notice)) { @@ -146,7 +141,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction throw new Exception(sprintf(_("Unsupported format: %s"), $this->format)); } } else { - // XXX: Twitter just sets a 404 header and doens't bother // to return an err msg @@ -154,12 +148,14 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction 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 @@ -175,7 +171,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -186,7 +181,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notice)) { @@ -204,7 +198,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->notice)) { diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 822ebacbd..1a3b54900 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -55,7 +55,7 @@ Yes @param status (Required) The URL-encoded text of the status update. - @param source (Optional) The source of the status. + @param source (Optional) The source application name, if using HTTP authentication or an anonymous OAuth consumer. @param in_reply_to_status_id (Optional) The ID of an existing status that the update is in reply to. @param lat (Optional) The latitude the status refers to. @param long (Optional) The longitude the status refers to. @@ -67,7 +67,7 @@ @subsection usagenotes Usage notes @li The URL pattern is relative to the @ref apiroot. - @li If the @e source parameter is not supplied the source of the status will default to 'api'. + @li If the @e source parameter is not supplied the source of the status will default to 'api'. When authenticated via a registered OAuth application, the application's registered name and URL will always override the source parameter. @li The XML response uses <a href="http://georss.org/Main_Page">GeoRSS</a> to encode the latitude and longitude (see example response below <georss:point>). @li Data uploaded via the @e media parameter should be multipart/form-data encoded. @@ -160,7 +160,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ function prepare($args) { @@ -227,6 +226,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction } 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; } @@ -234,7 +234,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction $status_shortened = common_shorten_links($this->status); if (Notice::contentTooLong($status_shortened)) { - // Note: Twitter truncates anything over 140, flags the status // as "truncated." @@ -304,6 +303,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction 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()); diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php index 76d37ea97..771a95bae 100644 --- a/actions/apistatusnetconfig.php +++ b/actions/apistatusnetconfig.php @@ -46,7 +46,6 @@ if (!defined('STATUSNET')) { * @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( @@ -69,9 +68,7 @@ class ApiStatusnetConfigAction extends ApiAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -85,7 +82,6 @@ class ApiStatusnetConfigAction extends ApiAction * * @return void */ - function handle($args) { parent::handle($args); @@ -138,6 +134,7 @@ class ApiStatusnetConfigAction extends ApiAction break; default: $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format @@ -155,11 +152,8 @@ class ApiStatusnetConfigAction extends ApiAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } - diff --git a/actions/apistatusnetversion.php b/actions/apistatusnetversion.php index d09480759..bc2babc3f 100644 --- a/actions/apistatusnetversion.php +++ b/actions/apistatusnetversion.php @@ -47,7 +47,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @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 { /** @@ -58,7 +57,6 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -72,7 +70,6 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -90,6 +87,7 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction break; default: $this->clientError( + // TRANS: Client error displayed when trying to handle an unknown API method. _('API method not found.'), 404, $this->format @@ -107,11 +105,8 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } - diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index 749d16f06..fc0a2638b 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @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; @@ -62,9 +61,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -84,6 +81,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction $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; } @@ -102,12 +100,12 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @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; } @@ -128,7 +126,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return array Profiles */ - function getProfiles() { } @@ -140,7 +137,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -151,7 +147,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return string datestamp of the latest profile in the stream */ - function lastModified() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -171,7 +166,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -184,6 +178,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction 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)) @@ -202,7 +197,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function showProfiles($include_statuses = true) { switch ($this->format) { @@ -230,6 +224,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction print json_encode($arrays); break; default: + // TRANS: Client error displayed when requesting profiles of followers in an unsupported format. $this->clientError(_('Unsupported format.')); break; } @@ -241,7 +236,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function showIds() { switch ($this->format) { @@ -260,9 +254,9 @@ class ApiSubscriptionsAction extends ApiBareAuthAction print json_encode($ids); break; default: + // TRANS: Client error displayed when requesting IDs of followers in an unsupported format. $this->clientError(_('Unsupported format.')); break; } } - } diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php index f5ce5d2fd..c952c4623 100644 --- a/actions/apitimelinefavorites.php +++ b/actions/apitimelinefavorites.php @@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php'; * @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; @@ -59,9 +58,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -69,6 +66,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction $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; } @@ -87,7 +85,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -99,7 +96,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction * * @return void */ - function showTimeline() { $profile = $this->user->getProfile(); @@ -107,6 +103,8 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction $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 @@ -116,7 +114,10 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction $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 @@ -148,7 +149,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction ); break; case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); @@ -165,12 +165,12 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction $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; } @@ -181,7 +181,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -220,7 +219,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -231,7 +229,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -249,7 +246,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -270,5 +266,4 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction return null; } - } diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php index c96391c12..71049f6eb 100644 --- a/actions/apitimelinefriends.php +++ b/actions/apitimelinefriends.php @@ -151,7 +151,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @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; @@ -164,13 +163,13 @@ class ApiTimelineFriendsAction 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 requesting dents of a user and friends for a user that does not exist. $this->clientError(_('No such user.'), 404, $this->format); return; } @@ -189,7 +188,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -201,7 +199,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction * * @return void */ - function showTimeline() { $profile = $this->user->getProfile(); @@ -246,7 +243,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction ); break; case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); @@ -268,6 +264,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction $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; } @@ -278,7 +275,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -307,7 +303,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -318,7 +313,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -336,11 +330,9 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { - $last = count($this->notices) - 1; return '"' . implode( @@ -357,5 +349,4 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction return null; } - } diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index 5138a4b5e..a85da4b0f 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @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; @@ -64,7 +62,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -83,12 +80,12 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction * * @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; } @@ -102,7 +99,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction * * @return void */ - function showTimeline() { // We'll pull common formatting out of this for other formats @@ -126,7 +122,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction ); break; case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); try { @@ -138,19 +133,21 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction $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 @@ -164,7 +161,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -190,7 +186,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -201,7 +196,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -219,7 +213,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -240,5 +233,4 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction return null; } - } diff --git a/actions/apitimelinehome.php b/actions/apitimelinehome.php index 1ceb3d902..75a9f7258 100644 --- a/actions/apitimelinehome.php +++ b/actions/apitimelinehome.php @@ -56,7 +56,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @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; @@ -67,9 +66,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -77,6 +74,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction $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; } @@ -95,7 +93,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -107,12 +104,12 @@ class ApiTimelineHomeAction extends ApiBareAuthAction * * @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; @@ -172,6 +169,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction $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; } @@ -182,7 +180,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -215,7 +212,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -226,7 +222,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -244,7 +239,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -265,5 +259,4 @@ class ApiTimelineHomeAction extends ApiBareAuthAction return null; } - } diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php index 354dc58b6..a9b6d0b3d 100644 --- a/actions/apitimelinementions.php +++ b/actions/apitimelinementions.php @@ -55,10 +55,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @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; /** @@ -67,9 +65,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -77,6 +73,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction $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; } @@ -95,7 +92,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -107,7 +103,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction * * @return void */ - function showTimeline() { $profile = $this->user->getProfile(); @@ -115,6 +110,8 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction $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 ); @@ -128,6 +125,9 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction $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() ); @@ -149,7 +149,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction ); break; case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); @@ -171,6 +170,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction $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; } @@ -181,7 +181,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -205,7 +204,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -216,7 +214,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -234,7 +231,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -255,5 +251,4 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction return null; } - } diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index 0119b504a..2745e5d3f 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -144,10 +144,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; </statuses> @endverbatim */ - class ApiTimelinePublicAction extends ApiPrivateAuthAction { - var $notices = null; /** @@ -158,7 +156,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -177,7 +174,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -189,16 +185,17 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @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) { @@ -238,6 +235,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction $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; } @@ -248,7 +246,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -272,7 +269,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -283,7 +279,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -301,7 +296,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -321,5 +315,4 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction return null; } - } diff --git a/actions/apitimelineretweetedbyme.php b/actions/apitimelineretweetedbyme.php index af05623cd..5fe960915 100644 --- a/actions/apitimelineretweetedbyme.php +++ b/actions/apitimelineretweetedbyme.php @@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php'; * @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; @@ -64,12 +63,12 @@ class ApiTimelineRetweetedByMeAction extends ApiAuthAction * @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; } @@ -81,7 +80,6 @@ class ApiTimelineRetweetedByMeAction extends ApiAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; diff --git a/actions/apitimelineretweetedtome.php b/actions/apitimelineretweetedtome.php index 73e35c86b..6213a08ea 100644 --- a/actions/apitimelineretweetedtome.php +++ b/actions/apitimelineretweetedtome.php @@ -42,7 +42,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @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; @@ -61,9 +60,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -88,7 +85,6 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -108,6 +104,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction 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; @@ -116,8 +113,8 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction $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; } @@ -132,7 +129,6 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; diff --git a/actions/apitimelineretweetsofme.php b/actions/apitimelineretweetsofme.php index ea922fc42..9cb277279 100644 --- a/actions/apitimelineretweetsofme.php +++ b/actions/apitimelineretweetsofme.php @@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/mediafile.php'; * @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; @@ -62,9 +61,7 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -89,7 +86,6 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -111,6 +107,8 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction 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; @@ -147,8 +145,8 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction $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; } @@ -163,7 +161,6 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index 712703694..4dbe1fc0d 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @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; /** @@ -61,9 +59,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -85,7 +81,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -97,13 +92,16 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction * * @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 @@ -136,7 +134,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction ); break; case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); @@ -158,6 +155,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction $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; } @@ -168,7 +166,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -193,7 +190,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -204,7 +200,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -222,7 +217,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -243,5 +237,4 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction return null; } - } diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 7e7663646..e4a8b596e 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -57,10 +57,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @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; /** @@ -69,9 +67,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -79,6 +75,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction $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; } @@ -97,7 +94,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -114,7 +110,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return void */ - function showTimeline() { $profile = $this->user->getProfile(); @@ -152,7 +147,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction ); break; case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); $atom->setId($self); @@ -208,10 +202,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction $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; } - } /** @@ -219,7 +213,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return array notices */ - function getNotices() { $notices = array(); @@ -248,7 +241,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -259,7 +251,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->notices) && (count($this->notices) > 0)) { @@ -277,11 +268,9 @@ class ApiTimelineUserAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->notices) && (count($this->notices) > 0)) { - $last = count($this->notices) - 1; return '"' . implode( diff --git a/actions/apitrends.php b/actions/apitrends.php index 5b74636c6..3e854b109 100644 --- a/actions/apitrends.php +++ b/actions/apitrends.php @@ -44,10 +44,8 @@ require_once INSTALLDIR.'/lib/apiprivateauth.php'; * * @see ApiAction */ - class ApiTrendsAction extends ApiPrivateAuthAction { - var $callback; /** @@ -70,7 +68,6 @@ class ApiTrendsAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -84,7 +81,7 @@ class ApiTrendsAction extends ApiPrivateAuthAction */ function showTrends() { + // TRANS: Server error for unfinished API method showTrends. $this->serverError(_('API method under construction.'), 501); } - -}
\ No newline at end of file +} diff --git a/actions/apiuserfollowers.php b/actions/apiuserfollowers.php index e8d92a773..a5a429259 100644 --- a/actions/apiuserfollowers.php +++ b/actions/apiuserfollowers.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @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 { /** @@ -56,7 +55,6 @@ class ApiUserFollowersAction extends ApiSubscriptionsAction * * @return array Profiles */ - function getProfiles() { $offset = ($this->page - 1) * $this->count; @@ -85,5 +83,4 @@ class ApiUserFollowersAction extends ApiSubscriptionsAction return $profiles; } - } diff --git a/actions/apiuserfriends.php b/actions/apiuserfriends.php index 741a26e58..b77d08097 100644 --- a/actions/apiuserfriends.php +++ b/actions/apiuserfriends.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @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 { /** @@ -56,7 +55,6 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction * * @return array Profiles */ - function getProfiles() { $offset = ($this->page - 1) * $this->count; @@ -85,5 +83,4 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction return $profiles; } - } diff --git a/actions/apiusershow.php b/actions/apiusershow.php index 28993102c..fbd4d6059 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @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 { /** @@ -60,7 +59,6 @@ class ApiUserShowAction extends ApiPrivateAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -87,17 +85,18 @@ class ApiUserShowAction extends ApiPrivateAuthAction * * @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; } @@ -105,6 +104,7 @@ class ApiUserShowAction extends ApiPrivateAuthAction $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; } @@ -120,7 +120,6 @@ class ApiUserShowAction extends ApiPrivateAuthAction $this->showJsonObjects($twitter_user); $this->endDocument('json'); } - } /** @@ -132,10 +131,8 @@ class ApiUserShowAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - } diff --git a/actions/attachment.php b/actions/attachment.php index 6981354d1..45aa78728 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -42,7 +42,6 @@ require_once INSTALLDIR.'/lib/attachmentlist.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class AttachmentAction extends Action { /** @@ -70,6 +69,7 @@ class AttachmentAction extends Action } if (empty($this->attachment)) { + // TRANS: Client error displayed trying to get a non-existing attachment. $this->clientError(_('No such attachment.'), 404); return false; } @@ -81,7 +81,6 @@ class AttachmentAction extends Action * * @return boolean true */ - function isReadOnly($args) { return true; @@ -129,7 +128,6 @@ class AttachmentAction extends Action * * @return void */ - function handle($args) { parent::handle($args); @@ -150,7 +148,6 @@ class AttachmentAction extends Action * * @return void */ - function showLocalNavBlock() { } @@ -162,7 +159,6 @@ class AttachmentAction extends Action * * @return void */ - function showContent() { $ali = new Attachment($this->attachment, $this); @@ -174,7 +170,6 @@ class AttachmentAction extends Action * * @return void */ - function showPageNoticeBlock() { } @@ -191,4 +186,3 @@ class AttachmentAction extends Action $atcs->show(); } } - diff --git a/actions/attachment_ajax.php b/actions/attachment_ajax.php index 1e0728075..fb7d15f8a 100644 --- a/actions/attachment_ajax.php +++ b/actions/attachment_ajax.php @@ -42,7 +42,6 @@ require_once INSTALLDIR.'/actions/attachment.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class Attachment_ajaxAction extends AttachmentAction { /** @@ -80,4 +79,3 @@ class Attachment_ajaxAction extends AttachmentAction $this->elementEnd('div'); } } - diff --git a/actions/attachment_thumbnail.php b/actions/attachment_thumbnail.php index 7d0ac97a6..38648b8be 100644 --- a/actions/attachment_thumbnail.php +++ b/actions/attachment_thumbnail.php @@ -42,10 +42,8 @@ require_once INSTALLDIR.'/actions/attachment.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class Attachment_thumbnailAction extends AttachmentAction { - function handle($args) { $this->showPage(); @@ -79,6 +77,4 @@ class Attachment_thumbnailAction extends AttachmentAction } $this->element('img', array('src' => $file_thumbnail->url, 'alt' => 'Thumbnail')); } - } - diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index 537950792..fa97a86eb 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -48,7 +48,7 @@ class AvatarbynicknameAction extends Action * Class handler. * * @param array $args query arguments - * + * * @return boolean false if nickname or user isn't found */ function handle($args) @@ -56,27 +56,32 @@ class AvatarbynicknameAction extends Action parent::handle($args); $nickname = $this->trimmed('nickname'); if (!$nickname) { + // TRANS: Client error displayed trying to get an avatar without providing a nickname. $this->clientError(_('No nickname.')); return; } $size = $this->trimmed('size'); if (!$size) { + // TRANS: Client error displayed trying to get an avatar without providing an avatar size. $this->clientError(_('No size.')); return; } $size = strtolower($size); if (!in_array($size, array('original', '96', '48', '24'))) { + // TRANS: Client error displayed trying to get an avatar providing an invalid avatar size. $this->clientError(_('Invalid size.')); return; } $user = User::staticGet('nickname', $nickname); if (!$user) { + // TRANS: Client error displayed trying to get an avatar for a non-existing user. $this->clientError(_('No such user.')); return; } $profile = $user->getProfile(); if (!$profile) { + // TRANS: Client error displayed trying to get an avatar for a user without a profile. $this->clientError(_('User has no profile.')); return; } @@ -103,4 +108,3 @@ class AvatarbynicknameAction extends Action return true; } } - diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 9d4040e75..375420c5c 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -49,7 +49,6 @@ define('MAX_ORIGINAL', 480); * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class AvatarsettingsAction extends AccountSettingsAction { var $mode = null; @@ -61,9 +60,9 @@ class AvatarsettingsAction extends AccountSettingsAction * * @return string Title of the page */ - function title() { + // TRANS: Title for avatar upload page. return _('Avatar'); } @@ -72,10 +71,12 @@ class AvatarsettingsAction extends AccountSettingsAction * * @return instructions for use */ - function getInstructions() { - return sprintf(_('You can upload your personal avatar. The maximum file size is %s.'), ImageFile::maxFileSize()); + // TRANS: Instruction for avatar upload page. + // TRANS: %s is the maximum file size, for example "500b", "10kB" or "2MB". + return sprintf(_('You can upload your personal avatar. The maximum file size is %s.'), + ImageFile::maxFileSize()); } /** @@ -103,6 +104,7 @@ class AvatarsettingsAction extends AccountSettingsAction if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); + // TRANS: Server error displayed in avatar upload page when no matching profile can be found for a user. $this->serverError(_('User without matching profile.')); return; } @@ -116,14 +118,16 @@ class AvatarsettingsAction extends AccountSettingsAction 'action' => common_local_url('avatarsettings'))); $this->elementStart('fieldset'); + // TRANS: Avatar upload page form legend. $this->element('legend', null, _('Avatar settings')); $this->hidden('token', common_session_token()); - + if (Event::handle('StartAvatarFormData', array($this))) { $this->elementStart('ul', 'form_data'); if ($original) { $this->elementStart('li', array('id' => 'avatar_original', 'class' => 'avatar_view')); + // TRANS: Header on avatar upload page for thumbnail of originally uploaded avatar (h2). $this->element('h2', null, _("Original")); $this->elementStart('div', array('id'=>'avatar_original_view')); $this->element('img', array('src' => $original->url, @@ -139,6 +143,7 @@ class AvatarsettingsAction extends AccountSettingsAction if ($avatar) { $this->elementStart('li', array('id' => 'avatar_preview', 'class' => 'avatar_view')); + // TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2). $this->element('h2', null, _("Preview")); $this->elementStart('div', array('id'=>'avatar_preview_view')); $this->element('img', array('src' => $original->url, @@ -146,7 +151,8 @@ class AvatarsettingsAction extends AccountSettingsAction 'height' => AVATAR_PROFILE_SIZE, 'alt' => $user->nickname)); $this->elementEnd('div'); - $this->submit('delete', _('Delete')); + // TRANS: Button on avatar upload page to delete current avatar. + $this->submit('delete', _m('BUTTON','Delete')); $this->elementEnd('li'); } @@ -163,7 +169,8 @@ class AvatarsettingsAction extends AccountSettingsAction $this->elementStart('ul', 'form_actions'); $this->elementStart('li'); - $this->submit('upload', _('Upload')); + // TRANS: Button on avatar upload page to upload an avatar. + $this->submit('upload', _m('BUTTON','Upload')); $this->elementEnd('li'); $this->elementEnd('ul'); } @@ -171,7 +178,6 @@ class AvatarsettingsAction extends AccountSettingsAction $this->elementEnd('fieldset'); $this->elementEnd('form'); - } function showCropForm() @@ -182,6 +188,7 @@ class AvatarsettingsAction extends AccountSettingsAction if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); + // TRANS: Server error displayed in avatar upload page when no matching profile can be found for a user. $this->serverError(_('User without matching profile.')); return; } @@ -194,6 +201,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'action' => common_local_url('avatarsettings'))); $this->elementStart('fieldset'); + // TRANS: Avatar upload page crop form legend. $this->element('legend', null, _('Avatar settings')); $this->hidden('token', common_session_token()); @@ -202,6 +210,7 @@ class AvatarsettingsAction extends AccountSettingsAction $this->elementStart('li', array('id' => 'avatar_original', 'class' => 'avatar_view')); + // TRANS: Header on avatar upload crop form for thumbnail of originally uploaded avatar (h2). $this->element('h2', null, _("Original")); $this->elementStart('div', array('id'=>'avatar_original_view')); $this->element('img', array('src' => Avatar::url($this->filedata['filename']), @@ -214,6 +223,7 @@ class AvatarsettingsAction extends AccountSettingsAction $this->elementStart('li', array('id' => 'avatar_preview', 'class' => 'avatar_view')); + // TRANS: Header on avatar upload crop form for thumbnail of to be used rendition of uploaded avatar (h2). $this->element('h2', null, _("Preview")); $this->elementStart('div', array('id'=>'avatar_preview_view')); $this->element('img', array('src' => Avatar::url($this->filedata['filename']), @@ -228,13 +238,14 @@ class AvatarsettingsAction extends AccountSettingsAction 'type' => 'hidden', 'id' => $crop_info)); } - $this->submit('crop', _('Crop')); + + // TRANS: Button on avatar upload crop form to confirm a selected crop as avatar. + $this->submit('crop', _m('BUTTON','Crop')); $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('fieldset'); $this->elementEnd('form'); - } /** @@ -244,7 +255,6 @@ class AvatarsettingsAction extends AccountSettingsAction * * @return void */ - function handlePost() { // Workaround for PHP returning empty $_POST and $_FILES when POST @@ -271,7 +281,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'Try again, please.')); return; } - + if (Event::handle('StartAvatarSaveForm', array($this))) { if ($this->arg('upload')) { $this->uploadAvatar(); @@ -280,6 +290,7 @@ class AvatarsettingsAction extends AccountSettingsAction } else if ($this->arg('delete')) { $this->deleteAvatar(); } else { + // TRANS: Unexpected validation error on avatar upload form. $this->showForm(_('Unexpected form submission.')); } Event::handle('EndAvatarSaveForm', array($this)); @@ -294,7 +305,6 @@ class AvatarsettingsAction extends AccountSettingsAction * * @return void */ - function uploadAvatar() { try { @@ -304,6 +314,7 @@ class AvatarsettingsAction extends AccountSettingsAction return; } if ($imagefile === null) { + // TRANS: Validation error on avatar upload form when no file was uploaded. $this->showForm(_('No file uploaded.')); return; } @@ -331,6 +342,7 @@ class AvatarsettingsAction extends AccountSettingsAction $this->mode = 'crop'; + // TRANS: Avatar upload form unstruction after uploading a file. $this->showForm(_('Pick a square area of the image to be your avatar'), true); } @@ -340,12 +352,12 @@ class AvatarsettingsAction extends AccountSettingsAction * * @return void */ - function cropAvatar() { $filedata = $_SESSION['FILEDATA']; if (!$filedata) { + // TRANS: Server error displayed if an avatar upload went wrong somehow server side. $this->serverError(_('Lost our file data.')); return; } @@ -369,24 +381,25 @@ class AvatarsettingsAction extends AccountSettingsAction @unlink($filedata['filepath']); unset($_SESSION['FILEDATA']); $this->mode = 'upload'; + // TRANS: Success message for having updated a user avatar. $this->showForm(_('Avatar updated.'), true); common_broadcast_profile($profile); } else { + // TRANS: Error displayed on the avatar upload page if the avatar could not be updated for an unknown reason. $this->showForm(_('Failed updating avatar.')); } } - + /** * Get rid of the current avatar. * * @return void */ - function deleteAvatar() { $user = common_current_user(); $profile = $user->getProfile(); - + $avatar = $profile->getOriginalAvatar(); if($avatar) $avatar->delete(); $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); @@ -396,6 +409,7 @@ class AvatarsettingsAction extends AccountSettingsAction $avatar = $profile->getAvatar(AVATAR_MINI_SIZE); if($avatar) $avatar->delete(); + // TRANS: Success message for deleting a user avatar. $this->showForm(_('Avatar deleted.'), true); } @@ -416,7 +430,6 @@ class AvatarsettingsAction extends AccountSettingsAction * * @return void */ - function showScripts() { parent::showScripts(); diff --git a/actions/block.php b/actions/block.php index 93f8ec937..e87353b4e 100644 --- a/actions/block.php +++ b/actions/block.php @@ -42,7 +42,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class BlockAction extends ProfileFormAction { var $profile = null; @@ -54,7 +53,6 @@ class BlockAction extends ProfileFormAction * * @return boolean success flag */ - function prepare($args) { if (!parent::prepare($args)) { @@ -66,6 +64,7 @@ class BlockAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if ($cur->hasBlocked($this->profile)) { + // TRANS: Client error displayed when blocking a user that has already been blocked. $this->clientError(_('You already blocked that user.')); return false; } @@ -82,7 +81,6 @@ class BlockAction extends ProfileFormAction * * @return void */ - function handle($args) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { @@ -104,6 +102,7 @@ class BlockAction extends ProfileFormAction } function title() { + // TRANS: Title for block user page. return _('Block user'); } @@ -133,8 +132,10 @@ class BlockAction extends ProfileFormAction 'action' => common_local_url('block'))); $this->elementStart('fieldset'); $this->hidden('token', common_session_token()); + // TRANS: Legend for block user form. $this->element('legend', _('Block user')); $this->element('p', null, + // TRANS: Explanation of consequences when blocking a user on the block user page. _('Are you sure you want to block this user? '. 'Afterwards, they will be unsubscribed from you, '. 'unable to subscribe to you in the future, and '. @@ -184,6 +185,7 @@ class BlockAction extends ProfileFormAction } if (!$result) { + // TRANS: Server error displayed when blocking a user fails. $this->serverError(_('Failed to save block information.')); return; } @@ -199,7 +201,7 @@ class BlockAction extends ProfileFormAction * Override for form session token checks; on our first hit we're just * requesting confirmation, which doesn't need a token. We need to be * able to take regular GET requests from email! - * + * * @throws ClientException if token is bad on POST request or if we have * confirmation parameters which could trigger something. */ @@ -216,7 +218,7 @@ class BlockAction extends ProfileFormAction /** * If we reached this form without returnto arguments, return to the * current user's subscription list. - * + * * @return string URL */ function defaultReturnTo() diff --git a/actions/blockedfromgroup.php b/actions/blockedfromgroup.php index a0598db27..6ff572c05 100644 --- a/actions/blockedfromgroup.php +++ b/actions/blockedfromgroup.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class BlockedfromgroupAction extends GroupDesignAction { var $page = null; @@ -70,6 +69,7 @@ class BlockedfromgroupAction extends GroupDesignAction } if (!$nickname) { + // TRANS: Client error displayed when requesting a list of blocked users for a group without providing a group nickname. $this->clientError(_('No nickname.'), 404); return false; } @@ -77,6 +77,7 @@ class BlockedfromgroupAction extends GroupDesignAction $local = Local_group::staticGet('nickname', $nickname); if (!$local) { + // TRANS: Client error displayed when requesting a list of blocked users for a non-local group. $this->clientError(_('No such group.'), 404); return false; } @@ -84,6 +85,7 @@ class BlockedfromgroupAction extends GroupDesignAction $this->group = User_group::staticGet('id', $local->group_id); if (!$this->group) { + // TRANS: Client error displayed when requesting a list of blocked users for a non-existing group. $this->clientError(_('No such group.'), 404); return false; } @@ -94,9 +96,13 @@ class BlockedfromgroupAction extends GroupDesignAction function title() { if ($this->page == 1) { + // TRANS: Title for first page with list of users blocked from a group. + // TRANS: %s is a group nickname. return sprintf(_('%s blocked profiles'), $this->group->nickname); } else { + // TRANS: Title for any but the first page with list of users blocked from a group. + // TRANS: %1$s is a group nickname, %2$d is a page number. return sprintf(_('%1$s blocked profiles, page %2$d'), $this->group->nickname, $this->page); @@ -112,6 +118,7 @@ class BlockedfromgroupAction extends GroupDesignAction function showPageNotice() { $this->element('p', 'instructions', + // TRANS: Instructions for list of users blocked from a group. _('A list of the users blocked from joining this group.')); } @@ -205,7 +212,6 @@ class GroupBlockListItem extends ProfileListItem * * @see UnblockForm */ - class GroupUnblockForm extends Form { /** @@ -234,7 +240,6 @@ class GroupUnblockForm extends Form * @param User_group $group group to block user from * @param array $args return-to args */ - function __construct($out=null, $profile=null, $group=null, $args=null) { parent::__construct($out); @@ -249,7 +254,6 @@ class GroupUnblockForm extends Form * * @return int ID of the form */ - function id() { // This should be unique for the page. @@ -261,7 +265,6 @@ class GroupUnblockForm extends Form * * @return string class of the form */ - function formClass() { return 'form_group_unblock'; @@ -272,7 +275,6 @@ class GroupUnblockForm extends Form * * @return string URL of the action */ - function action() { return common_local_url('groupunblock'); @@ -285,6 +287,7 @@ class GroupUnblockForm extends Form */ function formLegend() { + // TRANS: Form legend for unblocking a user from a group. $this->out->element('legend', null, _('Unblock user from group')); } @@ -293,7 +296,6 @@ class GroupUnblockForm extends Form * * @return void */ - function formData() { $this->out->hidden('unblockto-' . $this->profile->id, @@ -314,9 +316,14 @@ class GroupUnblockForm extends Form * * @return void */ - function formActions() { - $this->out->submit('submit', _('Unblock'), 'submit', null, _('Unblock this user')); + $this->out->submit('submit', + // TRANS: Button text for unblocking a user from a group. + _m('BUTTON','Unblock'), + 'submit', + null, + // TRANS: Tooltip for button for unblocking a user from a group. + _('Unblock this user')); } } diff --git a/actions/bookmarklet.php b/actions/bookmarklet.php index 041c2e894..9cf4e58f8 100644 --- a/actions/bookmarklet.php +++ b/actions/bookmarklet.php @@ -34,7 +34,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { require_once INSTALLDIR . '/actions/newnotice.php'; /** - * Action for posting a notice + * Action for posting a notice * * @category Bookmarklet * @package StatusNet @@ -42,12 +42,12 @@ require_once INSTALLDIR . '/actions/newnotice.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class BookmarkletAction extends NewnoticeAction { function showTitle() { // TRANS: Title for mini-posting window loaded from bookmarklet. + // TRANS: %s is the StatusNet site name. $this->element('title', null, sprintf(_('Post to %s'), common_config('site', 'name'))); } @@ -73,4 +73,3 @@ class BookmarkletAction extends NewnoticeAction { } } - diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php index 8bf8c8c4d..5617c5339 100644 --- a/actions/confirmaddress.php +++ b/actions/confirmaddress.php @@ -44,7 +44,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ConfirmaddressAction extends Action { /** type of confirmation. */ @@ -61,7 +60,6 @@ class ConfirmaddressAction extends Action * * @return void */ - function handle($args) { parent::handle($args); @@ -72,27 +70,30 @@ class ConfirmaddressAction extends Action } $code = $this->trimmed('code'); if (!$code) { + // TRANS: Client error displayed when not providing a confirmation code in the contact address confirmation action. $this->clientError(_('No confirmation code.')); return; } $confirm = Confirm_address::staticGet('code', $code); if (!$confirm) { + // TRANS: Client error displayed when providing a non-existing confirmation code in the contact address confirmation action. $this->clientError(_('Confirmation code not found.')); return; } $cur = common_current_user(); if ($cur->id != $confirm->user_id) { + // TRANS: Client error displayed when not providing a confirmation code for another user in the contact address confirmation action. $this->clientError(_('That confirmation code is not for you!')); return; } $type = $confirm->address_type; if (!in_array($type, array('email', 'jabber', 'sms'))) { - // TRANS: Server error for an unknow address type, which can be 'email', 'jabber', or 'sms'. + // TRANS: Server error for a unknow address type %s, which can be 'email', 'jabber', or 'sms'. $this->serverError(sprintf(_('Unrecognized address type %s.'), $type)); return; } if ($cur->$type == $confirm->address) { - // TRANS: Client error for an already confirmed email/jabbel/sms address. + // TRANS: Client error for an already confirmed email/jabber/sms address. $this->clientError(_('That address has already been confirmed.')); return; } @@ -113,6 +114,7 @@ class ConfirmaddressAction extends Action if (!$result) { common_log_db_error($cur, 'UPDATE', __FILE__); + // TRANS: Server error displayed when a user update to the database fails in the contact address confirmation action. $this->serverError(_('Couldn\'t update user.')); return; } @@ -125,7 +127,9 @@ class ConfirmaddressAction extends Action if (!$result) { common_log_db_error($confirm, 'DELETE', __FILE__); - $this->serverError(_('Couldn\'t delete email confirmation.')); + // TRANS: Server error displayed when an address confirmation code deletion from the + // TRANS: database fails in the contact address confirmation action. + $this->serverError(_('Could not delete address confirmation.')); return; } @@ -140,9 +144,9 @@ class ConfirmaddressAction extends Action * * @return string title */ - function title() { + // TRANS: Title for the contact address confirmation action. return _('Confirm address'); } @@ -151,13 +155,14 @@ class ConfirmaddressAction extends Action * * @return void */ - function showContent() { $cur = common_current_user(); $type = $this->type; $this->element('p', null, + // TRANS: Success message for the contact address confirmation action. + // TRANS: %s can be 'email', 'jabber', or 'sms'. sprintf(_('The address "%s" has been '. 'confirmed for your account.'), $cur->$type)); diff --git a/actions/conversation.php b/actions/conversation.php index 900a724ef..8d11df37b 100644 --- a/actions/conversation.php +++ b/actions/conversation.php @@ -45,7 +45,6 @@ require_once INSTALLDIR.'/lib/noticelist.php'; * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class ConversationAction extends Action { var $id = null; @@ -58,7 +57,6 @@ class ConversationAction extends Action * * @return boolean false if id not passed in */ - function prepare($args) { parent::prepare($args); @@ -81,7 +79,6 @@ class ConversationAction extends Action * * @return void */ - function handle($args) { parent::handle($args); @@ -93,10 +90,10 @@ class ConversationAction extends Action * * @return string page title */ - function title() { - return _("Conversation"); + // TRANS: Title for page with a conversion (multiple notices in context). + return _('Conversation'); } /** @@ -107,7 +104,6 @@ class ConversationAction extends Action * * @return void */ - function showContent() { $notices = Notice::conversationStream($this->id, null, null); @@ -134,7 +130,6 @@ class ConversationAction extends Action * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class ConversationTree extends NoticeList { var $tree = null; @@ -145,12 +140,12 @@ class ConversationTree extends NoticeList * * @return void */ - function show() { $cnt = $this->_buildTree(); $this->out->elementStart('div', array('id' =>'notices_primary')); + // TRANS: Header on conversation page. Hidden by default (h2). $this->out->element('h2', null, _('Notices')); $this->out->elementStart('ol', array('class' => 'notices xoxo')); @@ -200,7 +195,6 @@ class ConversationTree extends NoticeList * * @return void */ - function showNoticePlus($id) { $notice = $this->table[$id]; @@ -237,7 +231,6 @@ class ConversationTree extends NoticeList * * @return NoticeListItem a list item to show */ - function newListItem($notice) { return new ConversationTreeItem($notice, $this->out); @@ -255,7 +248,6 @@ class ConversationTree extends NoticeList * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class ConversationTreeItem extends NoticeListItem { /** @@ -266,7 +258,6 @@ class ConversationTreeItem extends NoticeListItem * * @return void */ - function showStart() { return; @@ -280,7 +271,6 @@ class ConversationTreeItem extends NoticeListItem * * @return void */ - function showEnd() { return; @@ -293,7 +283,6 @@ class ConversationTreeItem extends NoticeListItem * * @return void */ - function showContext() { return; diff --git a/actions/deleteapplication.php b/actions/deleteapplication.php index 806de0be6..272a91762 100644 --- a/actions/deleteapplication.php +++ b/actions/deleteapplication.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class DeleteapplicationAction extends Action { var $app = null; @@ -52,7 +51,6 @@ class DeleteapplicationAction extends Action * * @return boolean success flag */ - function prepare($args) { if (!parent::prepare($args)) { @@ -60,6 +58,7 @@ class DeleteapplicationAction extends Action } if (!common_logged_in()) { + // TRANS: Client error displayed trying to delete an application while not logged in. $this->clientError(_('You must be logged in to delete an application.')); return false; } @@ -68,6 +67,7 @@ class DeleteapplicationAction extends Action $this->app = Oauth_application::staticGet('id', $id); if (empty($this->app)) { + // TRANS: Client error displayed trying to delete an application that does not exist. $this->clientError(_('Application not found.')); return false; } @@ -75,6 +75,7 @@ class DeleteapplicationAction extends Action $cur = common_current_user(); if ($cur->id != $this->app->owner) { + // TRANS: Client error displayed trying to delete an application the current user does not own. $this->clientError(_('You are not the owner of this application.'), 401); return false; } @@ -91,7 +92,6 @@ class DeleteapplicationAction extends Action * * @return void */ - function handle($args) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { @@ -120,6 +120,7 @@ class DeleteapplicationAction extends Action } function title() { + // TRANS: Title for delete application page. return _('Delete application'); } @@ -144,8 +145,10 @@ class DeleteapplicationAction extends Action array('id' => $this->app->id)))); $this->elementStart('fieldset'); $this->hidden('token', common_session_token()); + // TRANS: Fieldset legend on delete application page. $this->element('legend', _('Delete application')); $this->element('p', null, + // TRANS: Confirmation text on delete application page. _('Are you sure you want to delete this application? '. 'This will clear all data about the application from the '. 'database, including all existing user connections.')); @@ -171,10 +174,8 @@ class DeleteapplicationAction extends Action * * @return void */ - function handlePost() { $this->app->delete(); } } - diff --git a/actions/deletegroup.php b/actions/deletegroup.php index 62fff00c4..4e9b9851f 100644 --- a/actions/deletegroup.php +++ b/actions/deletegroup.php @@ -172,7 +172,7 @@ class DeletegroupAction extends RedirectingAction } function title() { - // TRANS: Title. + // TRANS: Title of delete group page. return _('Delete group'); } @@ -201,8 +201,8 @@ class DeletegroupAction extends RedirectingAction // TRANS: Form legend for deleting a group. $this->element('legend', _('Delete group')); if (Event::handle('StartDeleteGroupForm', array($this, $this->group))) { - // TRANS: Warning in form for deleleting a group. $this->element('p', null, + // TRANS: Warning in form for deleleting a group. _('Are you sure you want to delete this group? '. 'This will clear all data about the group from the '. 'database, without a backup. ' . diff --git a/actions/deletenotice.php b/actions/deletenotice.php index 2879faa5d..a7ac28e19 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -32,6 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } +// @todo FIXME: documentation needed. class DeletenoticeAction extends Action { var $error = null; @@ -47,6 +48,7 @@ class DeletenoticeAction extends Action $this->user = common_current_user(); if (!$this->user) { + // TRANS: Error message displayed trying to delete a notice while not logged in. common_user_error(_('Not logged in.')); exit; } @@ -55,6 +57,7 @@ class DeletenoticeAction extends Action $this->notice = Notice::staticGet($notice_id); if (!$this->notice) { + // TRANS: Error message displayed trying to delete a non-existing notice. common_user_error(_('No such notice.')); exit; } @@ -71,6 +74,7 @@ class DeletenoticeAction extends Action if ($this->notice->profile_id != $this->user_profile->id && !$this->user->hasRight(Right::DELETEOTHERSNOTICE)) { + // TRANS: Error message displayed trying to delete a notice that was not made by the current user. common_user_error(_('Can\'t delete this notice.')); exit; } @@ -90,7 +94,6 @@ class DeletenoticeAction extends Action * * @return void */ - function showPageNotice() { $instr = $this->getInstructions(); @@ -103,12 +106,14 @@ class DeletenoticeAction extends Action function getInstructions() { + // TRANS: Instructions for deleting a notice. return _('You are about to permanently delete a notice. ' . 'Once this is done, it cannot be undone.'); } function title() { + // TRANS: Page title when deleting a notice. return _('Delete notice'); } @@ -121,7 +126,6 @@ class DeletenoticeAction extends Action * * @return void */ - function showForm($error = null) { $this->error = $error; @@ -133,7 +137,6 @@ class DeletenoticeAction extends Action * * @return void */ - function showContent() { $this->elementStart('form', array('id' => 'form_notice_delete', @@ -141,9 +144,11 @@ class DeletenoticeAction extends Action 'method' => 'post', 'action' => common_local_url('deletenotice'))); $this->elementStart('fieldset'); + // TRANS: Fieldset legend for the delete notice form. $this->element('legend', null, _('Delete notice')); $this->hidden('token', common_session_token()); $this->hidden('notice', $this->trimmed('notice')); + // TRANS: Message for the delete notice form. $this->element('p', null, _('Are you sure you want to delete this notice?')); $this->submit('form_action-no', // TRANS: Button label on the delete notice form. diff --git a/actions/editapplication.php b/actions/editapplication.php index d1c7a5c3d..760b1d284 100644 --- a/actions/editapplication.php +++ b/actions/editapplication.php @@ -185,7 +185,7 @@ class EditApplicationAction extends OwnerDesignAction return; } elseif (mb_strlen($name) > 255) { // TRANS: Validation error shown when providing too long a name in the "Edit application" form. - $this->showForm(_('Name is too long (max 255 characters).')); + $this->showForm(_('Name is too long (maximum 255 characters).')); return; } else if ($this->nameExists($name)) { // TRANS: Validation error shown when providing a name for an application that already exists in the "Edit application" form. diff --git a/actions/editgroup.php b/actions/editgroup.php index eaadbabe4..4d3af34c7 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -45,14 +45,13 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class EditgroupAction extends GroupDesignAction { - var $msg; function title() { + // TRANS: Title for form to edit a group. %s is a group nickname. return sprintf(_('Edit %s group'), $this->group->nickname); } @@ -65,6 +64,7 @@ class EditgroupAction extends GroupDesignAction parent::prepare($args); if (!common_logged_in()) { + // TRANS: Client error displayed trying to edit a group while not logged in. $this->clientError(_('You must be logged in to create a group.')); return false; } @@ -81,6 +81,7 @@ class EditgroupAction extends GroupDesignAction } if (!$nickname) { + // TRANS: Client error displayed trying to edit a group while not proving a nickname for the group to edit. $this->clientError(_('No nickname.'), 404); return false; } @@ -97,6 +98,7 @@ class EditgroupAction extends GroupDesignAction } if (!$this->group) { + // TRANS: Client error displayed trying to edit a non-existing group. $this->clientError(_('No such group.'), 404); return false; } @@ -104,6 +106,7 @@ class EditgroupAction extends GroupDesignAction $cur = common_current_user(); if (!$cur->isAdmin($this->group)) { + // TRANS: Client error displayed trying to edit a group while not being a group admin. $this->clientError(_('You must be an admin to edit the group.'), 403); return false; } @@ -120,7 +123,6 @@ class EditgroupAction extends GroupDesignAction * * @return void */ - function handle($args) { parent::handle($args); @@ -155,6 +157,7 @@ class EditgroupAction extends GroupDesignAction $this->element('p', 'error', $this->msg); } else { $this->element('p', 'instructions', + // TRANS: Form instructions for group edit form. _('Use this form to edit the group.')); } } @@ -169,6 +172,7 @@ class EditgroupAction extends GroupDesignAction { $cur = common_current_user(); if (!$cur->isAdmin($this->group)) { + // TRANS: Client error displayed trying to edit a group while not being a group admin. $this->clientError(_('You must be an admin to edit the group.'), 403); return; } @@ -183,28 +187,39 @@ class EditgroupAction extends GroupDesignAction if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) { + // TRANS: Group edit form validation error. $this->showForm(_('Nickname must have only lowercase letters '. 'and numbers and no spaces.')); return; } else if ($this->nicknameExists($nickname)) { + // TRANS: Group edit form validation error. $this->showForm(_('Nickname already in use. Try another one.')); return; } else if (!User_group::allowedNickname($nickname)) { + // TRANS: Group edit form validation error. $this->showForm(_('Not a valid nickname.')); return; } else if (!is_null($homepage) && (strlen($homepage) > 0) && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) { + // TRANS: Group edit form validation error. $this->showForm(_('Homepage is not a valid URL.')); return; } else if (!is_null($fullname) && mb_strlen($fullname) > 255) { + // TRANS: Group edit form validation error. $this->showForm(_('Full name is too long (maximum 255 characters).')); return; } else if (User_group::descriptionTooLong($description)) { - $this->showForm(sprintf(_('Description is too long (max %d chars).'), User_group::maxDescription())); + $this->showForm(sprintf( + // TRANS: Group edit form validation error. + _m('Description is too long (maximum %d character).', + 'Description is too long (maximum %d characters).', + User_group::maxDescription()), + User_group::maxDescription())); return; } else if (!is_null($location) && mb_strlen($location) > 255) { + // TRANS: Group edit form validation error. $this->showForm(_('Location is too long (maximum 255 characters).')); return; } @@ -216,7 +231,11 @@ class EditgroupAction extends GroupDesignAction } if (count($aliases) > common_config('group', 'maxaliases')) { - $this->showForm(sprintf(_('Too many aliases! Maximum %d.'), + // TRANS: Group edit form validation error. + // TRANS: %d is the maximum number of allowed aliases. + $this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.', + 'Too many aliases! Maximum %d allowed.', + common_config('group', 'maxaliases')), common_config('group', 'maxaliases'))); return; } @@ -225,16 +244,19 @@ class EditgroupAction extends GroupDesignAction if (!Validate::string($alias, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) { + // TRANS: Group edit form validation error. $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias)); return; } if ($this->nicknameExists($alias)) { + // TRANS: Group edit form validation error. $this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'), $alias)); return; } // XXX assumes alphanum nicknames if (strcmp($alias, $nickname) == 0) { + // TRANS: Group edit form validation error. $this->showForm(_('Alias can\'t be the same as nickname.')); return; } @@ -255,12 +277,14 @@ class EditgroupAction extends GroupDesignAction if (!$result) { common_log_db_error($this->group, 'UPDATE', __FILE__); + // TRANS: Server error displayed when editing a group fails. $this->serverError(_('Could not update group.')); } $result = $this->group->setAliases($aliases); if (!$result) { + // TRANS: Server error displayed when group aliases could not be added. $this->serverError(_('Could not create aliases.')); } @@ -277,6 +301,7 @@ class EditgroupAction extends GroupDesignAction array('nickname' => $nickname)), 303); } else { + // TRANS: Group edit form success message. $this->showForm(_('Options saved.')); } } @@ -300,4 +325,3 @@ class EditgroupAction extends GroupDesignAction return false; } } - diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 9c250fc8a..5a816e5c0 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -178,51 +178,55 @@ class EmailsettingsAction extends AccountSettingsAction $this->element('legend', null, _('Email preferences')); $this->elementStart('ul', 'form_data'); - $this->elementStart('li'); - $this->checkbox('emailnotifysub', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me notices of new subscriptions through email.'), - $user->emailnotifysub); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifyfav', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me email when someone '. - 'adds my notice as a favorite.'), - $user->emailnotifyfav); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifymsg', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me email when someone sends me a private message.'), - $user->emailnotifymsg); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifyattn', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me email when someone sends me an "@-reply".'), - $user->emailnotifyattn); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifynudge', - // TRANS: Checkbox label in e-mail preferences form. - _('Allow friends to nudge me and send me an email.'), - $user->emailnotifynudge); - $this->elementEnd('li'); - if (common_config('emailpost', 'enabled')) { - $this->elementStart('li'); - $this->checkbox('emailpost', - // TRANS: Checkbox label in e-mail preferences form. - _('I want to post notices by email.'), - $user->emailpost); - $this->elementEnd('li'); - } - $this->elementStart('li'); - $this->checkbox('emailmicroid', - // TRANS: Checkbox label in e-mail preferences form. - _('Publish a MicroID for my email address.'), - $user->emailmicroid); - $this->elementEnd('li'); + + if (Event::handle('StartEmailFormData', array($this))) { + $this->elementStart('li'); + $this->checkbox('emailnotifysub', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me notices of new subscriptions through email.'), + $user->emailnotifysub); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifyfav', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me email when someone '. + 'adds my notice as a favorite.'), + $user->emailnotifyfav); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifymsg', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me email when someone sends me a private message.'), + $user->emailnotifymsg); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifyattn', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me email when someone sends me an "@-reply".'), + $user->emailnotifyattn); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifynudge', + // TRANS: Checkbox label in e-mail preferences form. + _('Allow friends to nudge me and send me an email.'), + $user->emailnotifynudge); + $this->elementEnd('li'); + if (common_config('emailpost', 'enabled')) { + $this->elementStart('li'); + $this->checkbox('emailpost', + // TRANS: Checkbox label in e-mail preferences form. + _('I want to post notices by email.'), + $user->emailpost); + $this->elementEnd('li'); + } + $this->elementStart('li'); + $this->checkbox('emailmicroid', + // TRANS: Checkbox label in e-mail preferences form. + _('Publish a MicroID for my email address.'), + $user->emailmicroid); + $this->elementEnd('li'); + Event::handle('EndEmailFormData', array($this)); + } $this->elementEnd('ul'); // TRANS: Button label to save e-mail preferences. $this->submit('save', _m('BUTTON','Save')); @@ -299,43 +303,48 @@ class EmailsettingsAction extends AccountSettingsAction function savePreferences() { - $emailnotifysub = $this->boolean('emailnotifysub'); - $emailnotifyfav = $this->boolean('emailnotifyfav'); - $emailnotifymsg = $this->boolean('emailnotifymsg'); - $emailnotifynudge = $this->boolean('emailnotifynudge'); - $emailnotifyattn = $this->boolean('emailnotifyattn'); - $emailmicroid = $this->boolean('emailmicroid'); - $emailpost = $this->boolean('emailpost'); - - $user = common_current_user(); - - assert(!is_null($user)); // should already be checked - - $user->query('BEGIN'); - - $original = clone($user); - - $user->emailnotifysub = $emailnotifysub; - $user->emailnotifyfav = $emailnotifyfav; - $user->emailnotifymsg = $emailnotifymsg; - $user->emailnotifynudge = $emailnotifynudge; - $user->emailnotifyattn = $emailnotifyattn; - $user->emailmicroid = $emailmicroid; - $user->emailpost = $emailpost; - - $result = $user->update($original); - - if ($result === false) { - common_log_db_error($user, 'UPDATE', __FILE__); - // TRANS: Server error thrown on database error updating e-mail preferences. - $this->serverError(_('Couldn\'t update user.')); - return; - } - - $user->query('COMMIT'); - - // TRANS: Confirmation message for successful e-mail preferences save. - $this->showForm(_('Email preferences saved.'), true); + $user = common_current_user(); + + if (Event::handle('StartEmailSaveForm', array($this, &$user))) { + + $emailnotifysub = $this->boolean('emailnotifysub'); + $emailnotifyfav = $this->boolean('emailnotifyfav'); + $emailnotifymsg = $this->boolean('emailnotifymsg'); + $emailnotifynudge = $this->boolean('emailnotifynudge'); + $emailnotifyattn = $this->boolean('emailnotifyattn'); + $emailmicroid = $this->boolean('emailmicroid'); + $emailpost = $this->boolean('emailpost'); + + assert(!is_null($user)); // should already be checked + + $user->query('BEGIN'); + + $original = clone($user); + + $user->emailnotifysub = $emailnotifysub; + $user->emailnotifyfav = $emailnotifyfav; + $user->emailnotifymsg = $emailnotifymsg; + $user->emailnotifynudge = $emailnotifynudge; + $user->emailnotifyattn = $emailnotifyattn; + $user->emailmicroid = $emailmicroid; + $user->emailpost = $emailpost; + + $result = $user->update($original); + + if ($result === false) { + common_log_db_error($user, 'UPDATE', __FILE__); + // TRANS: Server error thrown on database error updating e-mail preferences. + $this->serverError(_('Couldn\'t update user.')); + return; + } + + $user->query('COMMIT'); + + Event::handle('EndEmailSaveForm', array($this)); + + // TRANS: Confirmation message for successful e-mail preferences save. + $this->showForm(_('Email preferences saved.'), true); + } } /** diff --git a/actions/groupunblock.php b/actions/groupunblock.php index dd6b15c26..ef2380725 100644 --- a/actions/groupunblock.php +++ b/actions/groupunblock.php @@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { } /** - * Unlock a user from a group + * Unblock a user from a group * * @category Action * @package StatusNet @@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class GroupunblockAction extends Action { var $profile = null; @@ -53,11 +52,11 @@ class GroupunblockAction extends Action * * @return boolean success flag */ - function prepare($args) { parent::prepare($args); if (!common_logged_in()) { + // TRANS: Client error displayed when trying to unblock a user from a group while not logged in. $this->clientError(_('Not logged in.')); return false; } @@ -68,11 +67,13 @@ class GroupunblockAction extends Action } $id = $this->trimmed('unblockto'); if (empty($id)) { + // TRANS: Client error displayed when trying to unblock a user from a group without providing a profile. $this->clientError(_('No profile specified.')); return false; } $this->profile = Profile::staticGet('id', $id); if (empty($this->profile)) { + // TRANS: Client error displayed when trying to unblock a user from a group without providing an existing profile. $this->clientError(_('No profile with that ID.')); return false; } @@ -83,15 +84,18 @@ class GroupunblockAction extends Action } $this->group = User_group::staticGet('id', $group_id); if (empty($this->group)) { + // TRANS: Client error displayed when trying to unblock a user from a non-existing group. $this->clientError(_('No such group.')); return false; } $user = common_current_user(); if (!$user->isAdmin($this->group)) { + // TRANS: Client error displayed when trying to unblock a user from a group without being an administrator for the group. $this->clientError(_('Only an admin can unblock group members.'), 401); return false; } if (!Group_block::isBlocked($this->group, $this->profile)) { + // TRANS: Client error displayed when trying to unblock a non-blocked user from a group. $this->clientError(_('User is not blocked from group.')); return false; } @@ -105,7 +109,6 @@ class GroupunblockAction extends Action * * @return void */ - function handle($args) { parent::handle($args); @@ -119,12 +122,12 @@ class GroupunblockAction extends Action * * @return void */ - function unblockProfile() { $result = Group_block::unblockProfile($this->group, $this->profile); if (!$result) { + // TRANS: Server error displayed when unblocking a user from a group fails because of an unknown error. $this->serverError(_('Error removing the block.')); return; } @@ -146,4 +149,3 @@ class GroupunblockAction extends Action } } } - diff --git a/actions/invite.php b/actions/invite.php index 2779437e0..e9adb3b7f 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -142,7 +142,7 @@ class InviteAction extends CurrentUserDesignAction $this->elementStart('ul'); foreach ($this->already as $other) { // TRANS: Used as list item for already subscribed users (%1$s is nickname, %2$s is e-mail address). - $this->element('li', null, sprintf(_('%1$s (%2$s)'), $other->nickname, $other->email)); + $this->element('li', null, sprintf(_m('INVITE','%1$s (%2$s)'), $other->nickname, $other->email)); } $this->elementEnd('ul'); } @@ -156,7 +156,7 @@ class InviteAction extends CurrentUserDesignAction $this->elementStart('ul'); foreach ($this->subbed as $other) { // TRANS: Used as list item for already registered people (%1$s is nickname, %2$s is e-mail address). - $this->element('li', null, sprintf(_('%1$s (%2$s)'), $other->nickname, $other->email)); + $this->element('li', null, sprintf(_m('INVITE','%1$s (%2$s)'), $other->nickname, $other->email)); } $this->elementEnd('ul'); } diff --git a/actions/licenseadminpanel.php b/actions/licenseadminpanel.php index 9165ca19d..95ac48cc8 100644 --- a/actions/licenseadminpanel.php +++ b/actions/licenseadminpanel.php @@ -153,7 +153,7 @@ class LicenseadminpanelAction extends AdminPanelAction // Make sure the license title is not too long if (mb_strlen($values['license']['type']) > 255) { $this->clientError( - _("Invalid license title. Max length is 255 characters.") + _('Invalid license title. Maximum length is 255 characters.') ); } diff --git a/actions/newapplication.php b/actions/newapplication.php index 033c0852d..ae1754558 100644 --- a/actions/newapplication.php +++ b/actions/newapplication.php @@ -166,7 +166,7 @@ class NewApplicationAction extends OwnerDesignAction $this->showForm(_('Name already in use. Try another one.')); return; } elseif (mb_strlen($name) > 255) { - $this->showForm(_('Name is too long (maximum 255 chars).')); + $this->showForm(_('Name is too long (maximum 255 characters).')); return; } elseif (empty($description)) { $this->showForm(_('Description is required.')); @@ -196,7 +196,7 @@ class NewApplicationAction extends OwnerDesignAction $this->showForm(_('Organization is required.')); return; } elseif (mb_strlen($organization) > 255) { - $this->showForm(_('Organization is too long (maximum 255 chars).')); + $this->showForm(_('Organization is too long (maximum 255 characters).')); return; } elseif (empty($homepage)) { $this->showForm(_('Organization homepage is required.')); diff --git a/actions/newgroup.php b/actions/newgroup.php index ebfe9b599..e0e7978c3 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -43,25 +43,25 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class NewgroupAction extends Action { var $msg; function title() { + // TRANS: Title for form to create a group. return _('New group'); } /** * Prepare to run */ - function prepare($args) { parent::prepare($args); if (!common_logged_in()) { + // TRANS: Client error displayed trying to create a group while not logged in. $this->clientError(_('You must be logged in to create a group.')); return false; } @@ -78,7 +78,6 @@ class NewgroupAction extends Action * * @return void */ - function handle($args) { parent::handle($args); @@ -107,6 +106,7 @@ class NewgroupAction extends Action $this->element('p', 'error', $this->msg); } else { $this->element('p', 'instructions', + // TRANS: Form instructions for group create form. _('Use this form to create a new group.')); } } @@ -123,28 +123,39 @@ class NewgroupAction extends Action if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) { + // TRANS: Group create form validation error. $this->showForm(_('Nickname must have only lowercase letters '. 'and numbers and no spaces.')); return; } else if ($this->nicknameExists($nickname)) { + // TRANS: Group create form validation error. $this->showForm(_('Nickname already in use. Try another one.')); return; } else if (!User_group::allowedNickname($nickname)) { + // TRANS: Group create form validation error. $this->showForm(_('Not a valid nickname.')); return; } else if (!is_null($homepage) && (strlen($homepage) > 0) && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) { + // TRANS: Group create form validation error. $this->showForm(_('Homepage is not a valid URL.')); return; } else if (!is_null($fullname) && mb_strlen($fullname) > 255) { + // TRANS: Group create form validation error. $this->showForm(_('Full name is too long (maximum 255 characters).')); return; } else if (User_group::descriptionTooLong($description)) { - $this->showForm(sprintf(_('description is too long (max %d chars).'), User_group::maxDescription())); + // TRANS: Group create form validation error. + // TRANS: %d is the maximum number of allowed characters. + $this->showForm(sprintf(_m('Description is too long (maximum %d character).', + 'Description is too long (maximum %d characters).', + User_group::maxDescription()), + User_group::maxDescription())); return; } else if (!is_null($location) && mb_strlen($location) > 255) { + // TRANS: Group create form validation error. $this->showForm(_('Location is too long (maximum 255 characters).')); return; } @@ -156,7 +167,11 @@ class NewgroupAction extends Action } if (count($aliases) > common_config('group', 'maxaliases')) { - $this->showForm(sprintf(_('Too many aliases! Maximum %d.'), + // TRANS: Group create form validation error. + // TRANS: %d is the maximum number of allowed aliases. + $this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.', + 'Too many aliases! Maximum %d allowed.', + common_config('group', 'maxaliases')), common_config('group', 'maxaliases'))); return; } @@ -165,16 +180,19 @@ class NewgroupAction extends Action if (!Validate::string($alias, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) { + // TRANS: Group create form validation error. $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias)); return; } if ($this->nicknameExists($alias)) { + // TRANS: Group create form validation error. $this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'), $alias)); return; } // XXX assumes alphanum nicknames if (strcmp($alias, $nickname) == 0) { + // TRANS: Group create form validation error. $this->showForm(_('Alias can\'t be the same as nickname.')); return; } @@ -218,4 +236,3 @@ class NewgroupAction extends Action return false; } } - diff --git a/actions/newnotice.php b/actions/newnotice.php index 57cd847c6..0d4dcfccd 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -156,8 +156,11 @@ class NewnoticeAction extends Action $content_shortened = common_shorten_links($content); if (Notice::contentTooLong($content_shortened)) { - $this->clientError(sprintf(_('That\'s too long. '. - 'Max notice size is %d chars.'), + // TRANS: Client error displayed when the parameter "status" is missing. + // TRANS: %d is the maximum number of character for a notice. + $this->clientError(sprintf(_m('That\'s too long. Maximum notice size is %d character.', + 'That\'s too long. Maximum notice size is %d characters.', + Notice::maxContent()), Notice::maxContent())); } @@ -178,12 +181,10 @@ class NewnoticeAction extends Action if (Notice::contentTooLong($content_shortened)) { $upload->delete(); - $this->clientError( - sprintf( - _('Max notice size is %d chars, including attachment URL.'), - Notice::maxContent() - ) - ); + $this->clientError(sprintf(_m('Maximum notice size is %d character, including attachment URL.', + 'Maximum notice size is %d characters, including attachment URL.', + Notice::maxContent()), + Notice::maxContent())); } } diff --git a/actions/oembed.php b/actions/oembed.php index e25e4cb25..da3aa0c71 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -79,11 +79,7 @@ class OembedAction extends Action if (empty($profile)) { $this->serverError(_('Notice has no profile.'), 500); } - if (!empty($profile->fullname)) { - $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; - } else { - $authorname = $profile->nickname; - } + $authorname = $profile->getFancyName(); $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), $authorname, common_exact_date($notice->created)); diff --git a/actions/othersettings.php b/actions/othersettings.php index 10e9873b3..13460a4bf 100644 --- a/actions/othersettings.php +++ b/actions/othersettings.php @@ -46,7 +46,6 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class OthersettingsAction extends AccountSettingsAction { /** @@ -54,9 +53,9 @@ class OthersettingsAction extends AccountSettingsAction * * @return string Title of the page */ - function title() { + // Page title for a tab in user profile settings. return _('Other settings'); } @@ -68,6 +67,7 @@ class OthersettingsAction extends AccountSettingsAction function getInstructions() { + // TRANS: Instructions for tab "Other" in user profile settings. return _('Manage various other options.'); } @@ -105,6 +105,9 @@ class OthersettingsAction extends AccountSettingsAction { $services[$name]=$name; if($value['freeService']){ + // TRANS: Used as a suffix for free URL shorteners in a dropdown list in the tab "Other" of a + // TRANS: user's profile settings. This message has one space at the beginning. Use your + // TRANS: language's word separator here if it has one (most likely a single space). $services[$name].=_(' (free service)'); } } @@ -113,17 +116,22 @@ class OthersettingsAction extends AccountSettingsAction asort($services); $this->elementStart('li'); + // TRANS: Label for dropdown with URL shortener services. $this->dropdown('urlshorteningservice', _('Shorten URLs with'), + // TRANS: Tooltip for for dropdown with URL shortener services. $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice); $this->elementEnd('li'); } $this->elementStart('li'); + // TRANS: Label for checkbox. $this->checkbox('viewdesigns', _('View profile designs'), + // TRANS: Tooltip for checkbox. $user->viewdesigns, _('Show or hide profile designs.')); $this->elementEnd('li'); $this->elementEnd('ul'); - $this->submit('save', _('Save')); + // TRANS: Button text for saving "Other settings" in profile. + $this->submit('save', _m('BUTTON','Save')); $this->elementEnd('fieldset'); $this->elementEnd('form'); } @@ -150,7 +158,8 @@ class OthersettingsAction extends AccountSettingsAction $urlshorteningservice = $this->trimmed('urlshorteningservice'); if (!is_null($urlshorteningservice) && strlen($urlshorteningservice) > 50) { - $this->showForm(_('URL shortening service is too long (max 50 chars).')); + // TRANS: Form validation error for form "Other settings" in user profile. + $this->showForm(_('URL shortening service is too long (maximum 50 characters).')); return; } @@ -171,6 +180,7 @@ class OthersettingsAction extends AccountSettingsAction if ($result === false) { common_log_db_error($user, 'UPDATE', __FILE__); + // TRANS: Server error displayed when "Other" settings in user profile could not be updated on the server. $this->serverError(_('Couldn\'t update user.')); return; } diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php index f9956897f..33b0440e4 100644 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php @@ -362,7 +362,7 @@ class RecoverpasswordAction extends Action $confirm = $this->trimmed('confirm'); if (!$newpassword || strlen($newpassword) < 6) { - $this->showPasswordForm(_('Password must be 6 chars or more.')); + $this->showPasswordForm(_('Password must be 6 characters or more.')); return; } if ($newpassword != $confirm) { diff --git a/actions/showgroup.php b/actions/showgroup.php index 9a12bafaf..f38cd420a 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -46,10 +46,8 @@ define('MEMBERS_PER_SECTION', 27); * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ShowgroupAction extends GroupDesignAction { - /** page we're viewing. */ var $page = null; @@ -58,7 +56,6 @@ class ShowgroupAction extends GroupDesignAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -69,18 +66,16 @@ class ShowgroupAction extends GroupDesignAction * * @return string page title, with page number */ - function title() { - if (!empty($this->group->fullname)) { - $base = $this->group->fullname . ' (' . $this->group->nickname . ')'; - } else { - $base = $this->group->nickname; - } + $base = $this->group->getFancyName(); if ($this->page == 1) { + // TRANS: Page title for first group page. %s is a group name. return sprintf(_('%s group'), $base); } else { + // TRANS: Page title for any but first group page. + // TRANS: %1$s is a group name, $2$s is a page number. return sprintf(_('%1$s group, page %2$d'), $base, $this->page); @@ -96,7 +91,6 @@ class ShowgroupAction extends GroupDesignAction * * @return boolean success flag */ - function prepare($args) { parent::prepare($args); @@ -118,6 +112,7 @@ class ShowgroupAction extends GroupDesignAction } if (!$nickname) { + // TRANS: Client error displayed if no nickname argument was given requesting a group page. $this->clientError(_('No nickname.'), 404); return false; } @@ -135,6 +130,7 @@ class ShowgroupAction extends GroupDesignAction return false; } else { common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'"); + // TRANS: Client error displayed if no remote group with a given name was found requesting group page. $this->clientError(_('No such group.'), 404); return false; } @@ -143,6 +139,7 @@ class ShowgroupAction extends GroupDesignAction $this->group = User_group::staticGet('id', $local->group_id); if (!$this->group) { + // TRANS: Client error displayed if no local group with a given name was found requesting group page. $this->clientError(_('No such group.'), 404); return false; } @@ -160,7 +157,6 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function handle($args) { $this->showPage(); @@ -171,7 +167,6 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showLocalNav() { $nav = new GroupNav($this, $this->group); @@ -183,7 +178,6 @@ class ShowgroupAction extends GroupDesignAction * * Shows a group profile and a list of group notices */ - function showContent() { $this->showGroupProfile(); @@ -195,7 +189,6 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showGroupNotices() { $notice = $this->group->getNotices(($this->page-1)*NOTICES_PER_PAGE, @@ -218,15 +211,16 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showGroupProfile() { $this->elementStart('div', array('id' => 'i', 'class' => 'entity_profile vcard author')); + // TRANS: Group profile header (h2). Text hidden by default. $this->element('h2', null, _('Group profile')); $this->elementStart('dl', 'entity_depiction'); + // TRANS: Label for group avatar (dt). Text hidden by default. $this->element('dt', null, _('Avatar')); $this->elementStart('dd'); @@ -242,6 +236,7 @@ class ShowgroupAction extends GroupDesignAction $this->elementEnd('dl'); $this->elementStart('dl', 'entity_nickname'); + // TRANS: Label for group nickname (dt). Text hidden by default. $this->element('dt', null, _('Nickname')); $this->elementStart('dd'); $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid'; @@ -253,6 +248,7 @@ class ShowgroupAction extends GroupDesignAction if ($this->group->fullname) { $this->elementStart('dl', 'entity_fn'); + // TRANS: Label for full group name (dt). Text hidden by default. $this->element('dt', null, _('Full name')); $this->elementStart('dd'); $this->element('span', 'fn org', $this->group->fullname); @@ -262,6 +258,7 @@ class ShowgroupAction extends GroupDesignAction if ($this->group->location) { $this->elementStart('dl', 'entity_location'); + // TRANS: Label for group location (dt). Text hidden by default. $this->element('dt', null, _('Location')); $this->element('dd', 'label', $this->group->location); $this->elementEnd('dl'); @@ -269,6 +266,7 @@ class ShowgroupAction extends GroupDesignAction if ($this->group->homepage) { $this->elementStart('dl', 'entity_url'); + // TRANS: Label for group URL (dt). Text hidden by default. $this->element('dt', null, _('URL')); $this->elementStart('dd'); $this->element('a', array('href' => $this->group->homepage, @@ -280,6 +278,7 @@ class ShowgroupAction extends GroupDesignAction if ($this->group->description) { $this->elementStart('dl', 'entity_note'); + // TRANS: Label for group description or group note (dt). Text hidden by default. $this->element('dt', null, _('Note')); $this->element('dd', 'note', $this->group->description); $this->elementEnd('dl'); @@ -290,6 +289,7 @@ class ShowgroupAction extends GroupDesignAction if (!empty($aliases)) { $this->elementStart('dl', 'entity_aliases'); + // TRANS: Label for group aliases (dt). Text hidden by default. $this->element('dt', null, _('Aliases')); $this->element('dd', 'aliases', implode(' ', $aliases)); $this->elementEnd('dl'); @@ -298,12 +298,13 @@ class ShowgroupAction extends GroupDesignAction $this->elementEnd('div'); + $cur = common_current_user(); $this->elementStart('div', 'entity_actions'); + // TRANS: Group actions header (h2). Text hidden by default. $this->element('h2', null, _('Group actions')); $this->elementStart('ul'); $this->elementStart('li', 'entity_subscribe'); if (Event::handle('StartGroupSubscribe', array($this, $this->group))) { - $cur = common_current_user(); if ($cur) { if ($cur->isMember($this->group)) { $lf = new LeaveForm($this, $this->group); @@ -316,7 +317,7 @@ class ShowgroupAction extends GroupDesignAction Event::handle('EndGroupSubscribe', array($this, $this->group)); } $this->elementEnd('li'); - if ($cur->hasRight(Right::DELETEGROUP)) { + if ($cur && $cur->hasRight(Right::DELETEGROUP)) { $this->elementStart('li', 'entity_delete'); $df = new DeleteGroupForm($this, $this->group); $df->show(); @@ -331,7 +332,6 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function getFeeds() { $url = @@ -341,23 +341,27 @@ class ShowgroupAction extends GroupDesignAction return array(new Feed(Feed::RSS1, common_local_url('grouprss', array('nickname' => $this->group->nickname)), + // TRANS: Tooltip for feed link. %s is a group nickname. sprintf(_('Notice feed for %s group (RSS 1.0)'), $this->group->nickname)), new Feed(Feed::RSS2, common_local_url('ApiTimelineGroup', array('format' => 'rss', 'id' => $this->group->id)), + // TRANS: Tooltip for feed link. %s is a group nickname. sprintf(_('Notice feed for %s group (RSS 2.0)'), $this->group->nickname)), new Feed(Feed::ATOM, common_local_url('ApiTimelineGroup', array('format' => 'atom', 'id' => $this->group->id)), + // TRANS: Tooltip for feed link. %s is a group nickname. sprintf(_('Notice feed for %s group (Atom)'), $this->group->nickname)), new Feed(Feed::FOAF, common_local_url('foafgroup', array('nickname' => $this->group->nickname)), + // TRANS: Tooltip for feed link. %s is a group nickname. sprintf(_('FOAF for %s group'), $this->group->nickname))); } @@ -367,7 +371,6 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showSections() { $this->showMembers(); @@ -382,7 +385,6 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showMembers() { $member = $this->group->getMembers(0, MEMBERS_PER_SECTION); @@ -396,17 +398,22 @@ class ShowgroupAction extends GroupDesignAction if (Event::handle('StartShowGroupMembersMiniList', array($this))) { + // TRANS: Header for mini list of group members on a group page (h2). $this->element('h2', null, _('Members')); $gmml = new GroupMembersMiniList($member, $this); $cnt = $gmml->show(); if ($cnt == 0) { + // TRANS: Description for mini list of group members on a group page when the group has no members. $this->element('p', null, _('(None)')); } + // @todo FIXME: Should be shown if a group has more than 27 members, but I do not see it displayed at + // for example http://identi.ca/group/statusnet. Broken? if ($cnt > MEMBERS_PER_SECTION) { $this->element('a', array('href' => common_local_url('groupmembers', array('nickname' => $this->group->nickname))), + // TRANS: Link to all group members from mini list of group members if group has more than n members. _('All members')); } @@ -421,7 +428,6 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showAdmins() { $adminSection = new GroupAdminSection($this, $this->group); @@ -433,22 +439,26 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showStatistics() { $this->elementStart('div', array('id' => 'entity_statistics', 'class' => 'section')); + // TRANS: Header for group statistics on a group page (h2). $this->element('h2', null, _('Statistics')); $this->elementStart('dl', 'entity_created'); - $this->element('dt', null, _('Created')); + // @todo FIXME: i18n issue. This label gets a colon added from somewhere. Should be part of the message. + // TRANS: Label for creation date in statistics on group page. + $this->element('dt', null, _m('LABEL','Created')); $this->element('dd', null, date('j M Y', strtotime($this->group->created))); $this->elementEnd('dl'); $this->elementStart('dl', 'entity_members'); - $this->element('dt', null, _('Members')); + // @todo FIXME: i18n issue. This label gets a colon added from somewhere. Should be part of the message. + // TRANS: Label for member count in statistics on group page. + $this->element('dt', null, _m('LABEL','Members')); $this->element('dd', null, $this->group->getMemberCount()); $this->elementEnd('dl'); @@ -458,12 +468,21 @@ class ShowgroupAction extends GroupDesignAction function showAnonymousMessage() { if (!(common_config('site','closed') || common_config('site','inviteonly'))) { + // @todo FIXME: use group full name here if available instead of (uglier) primary alias. + // TRANS: Notice on group pages for anonymous users for StatusNet sites that accept new registrations. + // TRANS: **%s** is the group alias, %%%%site.name%%%% is the site name, + // TRANS: %%%%action.register%%%% is the URL for registration, %%%%doc.help%%%% is a URL to help. + // TRANS: This message contains Markdown links. Ensure they are formatted correctly: [Description](link). $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' . 'short messages about their life and interests. '. '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'), $this->group->nickname); } else { + // @todo FIXME: use group full name here if available instead of (uglier) primary alias. + // TRANS: Notice on group pages for anonymous users for StatusNet sites that accept no new registrations. + // TRANS: **%s** is the group alias, %%%%site.name%%%% is the site name, + // TRANS: This message contains Markdown links. Ensure they are formatted correctly: [Description](link). $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' . 'short messages about their life and interests. '), @@ -492,6 +511,7 @@ class GroupAdminSection extends ProfileSection function title() { + // TRANS: Header for list of group administrators on a group page (h2). return _('Admins'); } @@ -527,4 +547,3 @@ class GroupMembersMiniListItem extends ProfileMiniListItem return $aAttrs; } } - diff --git a/actions/showmessage.php b/actions/showmessage.php index db757948b..d737f85d3 100644 --- a/actions/showmessage.php +++ b/actions/showmessage.php @@ -26,8 +26,8 @@ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); } require_once INSTALLDIR.'/lib/mailbox.php'; @@ -36,26 +36,24 @@ require_once INSTALLDIR.'/lib/mailbox.php'; * Show a single message * * // XXX: It is totally weird how this works! - * + * * @category Personal * @package StatusNet * @author Evan Prodromou <evan@status.net> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ShowmessageAction extends MailboxAction { /** * Message object to show */ - var $message = null; - + /** * The current user */ - + var $user = null; /** @@ -67,17 +65,17 @@ class ShowmessageAction extends MailboxAction * * @return success flag */ - function prepare($args) { parent::prepare($args); - + $this->page = 1; - + $id = $this->trimmed('message'); $this->message = Message::staticGet('id', $id); if (!$this->message) { + // TRANS: Client error displayed requesting a single message that does not exist. $this->clientError(_('No such message.'), 404); return false; } @@ -90,40 +88,47 @@ class ShowmessageAction extends MailboxAction function handle($args) { Action::handle($args); - - if ($this->user && ($this->user->id == $this->message->from_profile || + + if ($this->user && ($this->user->id == $this->message->from_profile || $this->user->id == $this->message->to_profile)) { $this->showPage(); } else { + // TRANS: Client error displayed requesting a single direct message the requesting user was not a party in. $this->clientError(_('Only the sender and recipient ' . 'may read this message.'), 403); return; } } - + function title() - { + { if ($this->user->id == $this->message->from_profile) { $to = $this->message->getTo(); - return sprintf(_("Message to %1\$s on %2\$s"), + // @todo FIXME: Might be nice if the timestamp could be localised. + // TRANS: Page title for single direct message display when viewing user is the sender. + // TRANS: %1$s is the addressed user's nickname, $2$s is a timestamp. + return sprintf(_('Message to %1$s on %2$s'), $to->nickname, common_exact_date($this->message->created)); } else if ($this->user->id == $this->message->to_profile) { $from = $this->message->getFrom(); - return sprintf(_("Message from %1\$s on %2\$s"), + // @todo FIXME: Might be nice if the timestamp could be localised. + // TRANS: Page title for single message display. + // TRANS: %1$s is the sending user's nickname, $2$s is a timestamp. + return sprintf(_('Message from %1$s on %2$s'), $from->nickname, common_exact_date($this->message->created)); } } - - function getMessages() - { + + function getMessages() + { $message = new Message(); $message->id = $this->message->id; $message->find(); return $message; } - + function getMessageProfile() { if ($this->user->id == $this->message->from_profile) { @@ -135,23 +140,21 @@ class ShowmessageAction extends MailboxAction return null; } } - + /** * Don't show local navigation * * @return void */ - function showLocalNavBlock() { } - + /** * Don't show page notice * * @return void */ - function showPageNoticeBlock() { } @@ -161,17 +164,15 @@ class ShowmessageAction extends MailboxAction * * @return void */ - - function showAside() + function showAside() { } - + /** * Don't show any instructions * * @return string */ - function getInstructions() { return ''; diff --git a/actions/shownotice.php b/actions/shownotice.php index 5fc863486..b7e61a137 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -167,11 +167,7 @@ class ShownoticeAction extends OwnerDesignAction function title() { - if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; - } else { - $base = $this->profile->nickname; - } + $base = $this->profile->getFancyName(); return sprintf(_('%1$s\'s status on %2$s'), $base, @@ -335,6 +331,32 @@ class SingleNoticeItem extends DoFollowListItem $this->showEnd(); } + /** + * show the avatar of the notice's author + * + * We use the larger size for single notice page. + * + * @return void + */ + + function showAvatar() + { + $avatar_size = AVATAR_PROFILE_SIZE; + + $avatar = $this->profile->getAvatar($avatar_size); + + $this->out->element('img', array('src' => ($avatar) ? + $avatar->displayUrl() : + Avatar::defaultImage($avatar_size), + 'class' => 'avatar photo', + 'width' => $avatar_size, + 'height' => $avatar_size, + 'alt' => + ($this->profile->fullname) ? + $this->profile->fullname : + $this->profile->nickname)); + } + function showNoticeAttachments() { $al = new AttachmentList($this->notice, $this->out); $al->show(); diff --git a/actions/showstream.php b/actions/showstream.php index fb5b061fb..5a22bdf28 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -63,21 +63,26 @@ class ShowstreamAction extends ProfileAction function title() { - if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->user->nickname . ') '; - } else { - $base = $this->user->nickname; - } + $base = $this->profile->getFancyName(); if (!empty($this->tag)) { - $base .= sprintf(_(' tagged %s'), $this->tag); - } - - if ($this->page == 1) { - return $base; + if ($this->page == 1) { + // TRANS: Page title showing tagged notices in one user's stream. %1$s is the username, %2$s is the hash tag. + return sprintf(_('%1$s tagged %2$s'), $base, $this->tag); + } else { + // TRANS: Page title showing tagged notices in one user's stream. + // TRANS: %1$s is the username, %2$s is the hash tag, %1$d is the page number. + return sprintf(_('%1$s tagged %2$s, page %3$d'), $base, $this->tag, $this->page); + } } else { - return sprintf(_('%1$s, page %2$d'), - $base, - $this->page); + if ($this->page == 1) { + return $base; + } else { + // TRANS: Extended page title showing tagged notices in one user's stream. + // TRANS: %1$s is the username, %2$d is the page number. + return sprintf(_('%1$s, page %2$d'), + $base, + $this->page); + } } } @@ -117,6 +122,8 @@ class ShowstreamAction extends ProfileAction common_local_url('userrss', array('nickname' => $this->user->nickname, 'tag' => $this->tag)), + // TRANS: Title for link to notice feed. + // TRANS: %1$s is a user nickname, %2$s is a hashtag. sprintf(_('Notice feed for %1$s tagged %2$s (RSS 1.0)'), $this->user->nickname, $this->tag))); } @@ -124,6 +131,8 @@ class ShowstreamAction extends ProfileAction return array(new Feed(Feed::RSS1, common_local_url('userrss', array('nickname' => $this->user->nickname)), + // TRANS: Title for link to notice feed. + // TRANS: %s is a user nickname. sprintf(_('Notice feed for %s (RSS 1.0)'), $this->user->nickname)), new Feed(Feed::RSS2, @@ -131,6 +140,8 @@ class ShowstreamAction extends ProfileAction array( 'id' => $this->user->id, 'format' => 'rss')), + // TRANS: Title for link to notice feed. + // TRANS: %s is a user nickname. sprintf(_('Notice feed for %s (RSS 2.0)'), $this->user->nickname)), new Feed(Feed::ATOM, @@ -143,6 +154,8 @@ class ShowstreamAction extends ProfileAction new Feed(Feed::FOAF, common_local_url('foaf', array('nickname' => $this->user->nickname)), + // TRANS: Title for link to notice feed. FOAF stands for Friend of a Friend. + // TRANS: More information at http://www.foaf-project.org. %s is a user nickname. sprintf(_('FOAF for %s'), $this->user->nickname))); } @@ -194,17 +207,23 @@ class ShowstreamAction extends ProfileAction function showEmptyListMessage() { - $message = sprintf(_('This is the timeline for %1$s but %2$s hasn\'t posted anything yet.'), $this->user->nickname, $this->user->nickname) . ' '; + // TRANS: First sentence of empty list message for a stream. $1%s is a user nickname. + $message = sprintf(_('This is the timeline for %1$s, but %1$s hasn\'t posted anything yet.'), $this->user->nickname) . ' '; if (common_logged_in()) { $current_user = common_current_user(); if ($this->user->id === $current_user->id) { + // TRANS: Second sentence of empty list message for a stream for the user themselves. $message .= _('Seen anything interesting recently? You haven\'t posted any notices yet, now would be a good time to start :)'); } else { + // TRANS: Second sentence of empty list message for a non-self stream. %1$s is a user nickname, %2$s is a part of a URL. + // TRANS: This message contains a Markdown link. Keep "](" together. $message .= sprintf(_('You can try to nudge %1$s or [post something to them](%%%%action.newnotice%%%%?status_textarea=%2$s).'), $this->user->nickname, '@' . $this->user->nickname); } } else { + // TRANS: Second sentence of empty message for anonymous users. %s is a user nickname. + // TRANS: This message contains a Markdown link. Keep "](" together. $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname); } @@ -240,11 +259,15 @@ class ShowstreamAction extends ProfileAction function showAnonymousMessage() { if (!(common_config('site','closed') || common_config('site','inviteonly'))) { + // TRANS: Announcement for anonymous users showing a stream if site registrations are open. + // TRANS: This message contains a Markdown link. Keep "](" together. $m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . 'based on the Free Software [StatusNet](http://status.net/) tool. ' . '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'), $this->user->nickname, $this->user->nickname); } else { + // TRANS: Announcement for anonymous users showing a stream if site registrations are closed or invite only. + // TRANS: This message contains a Markdown link. Keep "](" together. $m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . 'based on the Free Software [StatusNet](http://status.net/) tool. '), $this->user->nickname, $this->user->nickname); @@ -284,7 +307,6 @@ class ProfileNoticeListItem extends DoFollowListItem * * @return void */ - function showRepeat() { if (!empty($this->repeat)) { @@ -295,13 +317,14 @@ class ProfileNoticeListItem extends DoFollowListItem 'class' => 'url'); if (!empty($this->profile->fullname)) { - $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; + $attrs['title'] = $this->getFancyName(); } $this->out->elementStart('span', 'repeat'); $text_link = XMLStringer::estring('a', $attrs, $this->profile->nickname); + // TRANS: Link to the author of a repeated notice. %s is a linked nickname. $this->out->raw(sprintf(_('Repeat of %s'), $text_link)); $this->out->elementEnd('span'); diff --git a/actions/sitenoticeadminpanel.php b/actions/sitenoticeadminpanel.php index bdcaa2355..797a6c4f4 100644 --- a/actions/sitenoticeadminpanel.php +++ b/actions/sitenoticeadminpanel.php @@ -42,7 +42,6 @@ require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class SitenoticeadminpanelAction extends AdminPanelAction { /** @@ -50,9 +49,9 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return string page title */ - function title() { + // TRANS: Page title for site-wide notice tab in admin panel. return _('Site Notice'); } @@ -61,9 +60,9 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { + // TRANS: Instructions for site-wide notice tab in admin panel. return _('Edit site-wide message'); } @@ -72,7 +71,6 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new SiteNoticeAdminPanelForm($this); @@ -85,7 +83,6 @@ class SitenoticeadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { $siteNotice = $this->trimmed('site-notice'); @@ -100,6 +97,7 @@ class SitenoticeadminpanelAction extends AdminPanelAction $result = Config::save('site', 'notice', $siteNotice); if (!$result) { + // TRANS: Server error displayed when saving a site-wide notice was impossible. $this->ServerError(_("Unable to save site notice.")); } } @@ -110,7 +108,8 @@ class SitenoticeadminpanelAction extends AdminPanelAction if (mb_strlen($siteNotice) > 255) { $this->clientError( - _('Max length for the site-wide notice is 255 chars.') + // TRANS: Client error displayed when a site-wide notice was longer than allowed. + _('Maximum length for the site-wide notice is 255 characters.') ); } @@ -173,9 +172,11 @@ class SiteNoticeAdminPanelForm extends AdminForm $this->out->elementStart('li'); $this->out->textarea( 'site-notice', + // TRANS: Label for site-wide notice text field in admin panel. _('Site notice text'), common_config('site', 'notice'), - _('Site-wide notice text (255 chars max; HTML okay)') + // TRANS: Tooltip for site-wide notice text field in admin panel. + _('Site-wide notice text (255 characters maximum; HTML allowed)') ); $this->out->elementEnd('li'); @@ -192,9 +193,11 @@ class SiteNoticeAdminPanelForm extends AdminForm { $this->out->submit( 'submit', - _('Save'), + // TRANS: Button text for saving site notice in admin panel. + _m('BUTTON','Save'), 'submit', null, + // TRANS: Title for button to save site notice in admin panel. _('Save site notice') ); } diff --git a/actions/subedit.php b/actions/subedit.php index cf6589e50..3b77aff58 100644 --- a/actions/subedit.php +++ b/actions/subedit.php @@ -19,6 +19,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } +// @todo FIXME: Documentation needed. class SubeditAction extends Action { var $profile = null; @@ -28,6 +29,7 @@ class SubeditAction extends Action parent::prepare($args); if (!common_logged_in()) { + // TRANS: Client error displayed trying a change a subscription while not logged in. $this->clientError(_('Not logged in.')); return false; } @@ -43,6 +45,7 @@ class SubeditAction extends Action $id = $this->trimmed('profile'); if (!$id) { + // TRANS: Client error displayed trying a change a subscription without providing a profile. $this->clientError(_('No profile specified.')); return false; } @@ -50,6 +53,7 @@ class SubeditAction extends Action $this->profile = Profile::staticGet('id', $id); if (!$this->profile) { + // TRANS: Client error displayed trying a change a subscription for a non-existant profile ID. $this->clientError(_('No profile with that ID.')); return false; } @@ -67,6 +71,7 @@ class SubeditAction extends Action 'subscribed' => $this->profile->id)); if (!$sub) { + // TRANS: Client error displayed trying a change a subscription for a non-subscribed profile. $this->clientError(_('You are not subscribed to that profile.')); return false; } @@ -80,6 +85,7 @@ class SubeditAction extends Action if (!$result) { common_log_db_error($sub, 'UPDATE', __FILE__); + // TRANS: Server error displayed when updating a subscription fails with a database error. $this->serverError(_('Could not save subscription.')); return false; } diff --git a/actions/useradminpanel.php b/actions/useradminpanel.php index 04e0ca3e7..fc75e83b2 100644 --- a/actions/useradminpanel.php +++ b/actions/useradminpanel.php @@ -45,7 +45,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class UseradminpanelAction extends AdminPanelAction { /** @@ -53,7 +52,6 @@ class UseradminpanelAction extends AdminPanelAction * * @return string page title */ - function title() { // TRANS: User admin panel title @@ -65,9 +63,9 @@ class UseradminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { + // TRANS: Instruction for user admin panel. return _('User settings for this StatusNet site'); } @@ -76,7 +74,6 @@ class UseradminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new UserAdminPanelForm($this); @@ -89,7 +86,6 @@ class UseradminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { static $settings = array( @@ -147,13 +143,15 @@ class UseradminpanelAction extends AdminPanelAction // Validate biolimit if (!Validate::number($values['profile']['biolimit'])) { - $this->clientError(_("Invalid bio limit. Must be numeric.")); + // TRANS: Form validation error in user admin panel when a non-numeric character limit was set. + $this->clientError(_('Invalid bio limit. Must be numeric.')); } // Validate welcome text if (mb_strlen($values['newuser']['welcome']) > 255) { - $this->clientError(_("Invalid welcome text. Max length is 255 characters.")); + // TRANS: Form validation error in user admin panel when welcome text is too long. + $this->clientError(_('Invalid welcome text. Maximum length is 255 characters.')); } // Validate default subscription @@ -163,7 +161,9 @@ class UseradminpanelAction extends AdminPanelAction if (empty($defuser)) { $this->clientError( sprintf( - _('Invalid default subscripton: \'%1$s\' is not user.'), + // TRANS: Client error displayed when trying to set a non-existing user as default subscription for new + // TRANS: users in user admin panel. %1$s is the invalid nickname. + _('Invalid default subscripton: \'%1$s\' is not a user.'), $values['newuser']['default'] ) ); @@ -179,7 +179,6 @@ class UserAdminPanelForm extends AdminForm * * @return int ID of the form */ - function id() { return 'useradminpanel'; @@ -190,7 +189,6 @@ class UserAdminPanelForm extends AdminForm * * @return string class of the form */ - function formClass() { return 'form_settings'; @@ -201,7 +199,6 @@ class UserAdminPanelForm extends AdminForm * * @return string URL of the action */ - function action() { return common_local_url('useradminpanel'); @@ -212,7 +209,6 @@ class UserAdminPanelForm extends AdminForm * * @return void */ - function formData() { $this->out->elementStart('fieldset', array('id' => 'settings_user-profile')); @@ -220,7 +216,9 @@ class UserAdminPanelForm extends AdminForm $this->out->elementStart('ul', 'form_data'); $this->li(); + // TRANS: Field label in user admin panel for setting the character limit for the bio field. $this->input('biolimit', _('Bio Limit'), + // TRANS: Tooltip in user admin panel for setting the character limit for the bio field. _('Maximum length of a profile bio in characters.'), 'profile'); $this->unli(); @@ -229,17 +227,22 @@ class UserAdminPanelForm extends AdminForm $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_user-newusers')); + // TRANS: Form legend in user admin panel. $this->out->element('legend', null, _('New users')); $this->out->elementStart('ul', 'form_data'); $this->li(); + // TRANS: Field label in user admin panel for setting new user welcome text. $this->input('welcome', _('New user welcome'), - _('Welcome text for new users (Max 255 chars).'), + // TRANS: Tooltip in user admin panel for setting new user welcome text. + _('Welcome text for new users (maximum 255 characters).'), 'newuser'); $this->unli(); $this->li(); + // TRANS: Field label in user admin panel for setting default subscription for new users. $this->input('default', _('Default subscription'), + // TRANS: Tooltip in user admin panel for setting default subscription for new users. _('Automatically subscribe new users to this user.'), 'newuser'); $this->unli(); @@ -249,21 +252,21 @@ class UserAdminPanelForm extends AdminForm $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_user-invitations')); + // TRANS: Form legend in user admin panel. $this->out->element('legend', null, _('Invitations')); $this->out->elementStart('ul', 'form_data'); $this->li(); + // TRANS: Field label for checkbox in user admin panel for allowing users to invite friend using site e-mail. $this->out->checkbox('invite-enabled', _('Invitations enabled'), (bool) $this->value('enabled', 'invite'), + // TRANS: Tooltip for checkbox in user admin panel for allowing users to invite friend using site e-mail. _('Whether to allow users to invite new users.')); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); - - - } /** @@ -278,7 +281,6 @@ class UserAdminPanelForm extends AdminForm * * @return void */ - function input($setting, $title, $instructions, $section='site') { $this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions); @@ -289,9 +291,14 @@ class UserAdminPanelForm extends AdminForm * * @return void */ - function formActions() { - $this->out->submit('submit', _('Save'), 'submit', null, _('Save user settings')); + $this->out->submit('submit', + // TRANS: Button text to save user settings in user admin panel. + _m('BUTTON','Save'), + 'submit', + null, + // TRANS: Title for button to save user settings in user admin panel. + _('Save user settings')); } } |