diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/accountsettingsaction.php | 30 | ||||
-rw-r--r-- | lib/action.php | 54 | ||||
-rw-r--r-- | lib/activity.php | 3 | ||||
-rw-r--r-- | lib/adminpanelaction.php | 11 | ||||
-rw-r--r-- | lib/apiaction.php | 65 | ||||
-rw-r--r-- | lib/apiauth.php | 23 | ||||
-rw-r--r-- | lib/applicationeditform.php | 41 | ||||
-rw-r--r-- | lib/applicationlist.php | 17 | ||||
-rw-r--r-- | lib/atomgroupnoticefeed.php | 3 | ||||
-rw-r--r-- | lib/atomusernoticefeed.php | 3 | ||||
-rw-r--r-- | lib/attachmentlist.php | 3 | ||||
-rw-r--r-- | lib/authorizationplugin.php | 4 | ||||
-rw-r--r-- | lib/command.php | 36 | ||||
-rw-r--r-- | lib/htmloutputter.php | 1 | ||||
-rw-r--r-- | lib/language.php | 19 | ||||
-rw-r--r-- | lib/mediafile.php | 2 | ||||
-rw-r--r-- | lib/noticeform.php | 4 | ||||
-rw-r--r-- | lib/noticelist.php | 12 | ||||
-rw-r--r-- | lib/profileaction.php | 12 | ||||
-rw-r--r-- | lib/util.php | 20 |
20 files changed, 304 insertions, 59 deletions
diff --git a/lib/accountsettingsaction.php b/lib/accountsettingsaction.php index c79a1f5d7..57740f8b8 100644 --- a/lib/accountsettingsaction.php +++ b/lib/accountsettingsaction.php @@ -105,27 +105,45 @@ class AccountSettingsNav extends Widget $user = common_current_user(); if(Event::handle('StartAccountSettingsProfileMenuItem', array($this, &$menu))){ - $this->showMenuItem('profilesettings',_('Profile'),_('Change your profile settings')); + // TRANS: Link title attribute in user account settings menu. + $title = _('Change your profile settings'); + // TRANS: Link description in user account settings menu. + $this->showMenuItem('profilesettings',_('Profile'),$title); Event::handle('EndAccountSettingsProfileMenuItem', array($this, &$menu)); } if(Event::handle('StartAccountSettingsAvatarMenuItem', array($this, &$menu))){ - $this->showMenuItem('avatarsettings',_('Avatar'),_('Upload an avatar')); + // TRANS: Link title attribute in user account settings menu. + $title = _('Upload an avatar'); + // TRANS: Link description in user account settings menu. + $this->showMenuItem('avatarsettings',_('Avatar'),$title); Event::handle('EndAccountSettingsAvatarMenuItem', array($this, &$menu)); } if(Event::handle('StartAccountSettingsPasswordMenuItem', array($this, &$menu))){ - $this->showMenuItem('passwordsettings',_('Password'),_('Change your password')); + // TRANS: Link title attribute in user account settings menu. + $title = _('Change your password'); + // TRANS: Link description in user account settings menu. + $this->showMenuItem('passwordsettings',_('Password'),$title); Event::handle('EndAccountSettingsPasswordMenuItem', array($this, &$menu)); } if(Event::handle('StartAccountSettingsEmailMenuItem', array($this, &$menu))){ - $this->showMenuItem('emailsettings',_('Email'),_('Change email handling')); + // TRANS: Link title attribute in user account settings menu. + $title = _('Change email handling'); + // TRANS: Link description in user account settings menu. + $this->showMenuItem('emailsettings',_('Email'),$title); Event::handle('EndAccountSettingsEmailMenuItem', array($this, &$menu)); } if(Event::handle('StartAccountSettingsDesignMenuItem', array($this, &$menu))){ - $this->showMenuItem('userdesignsettings',_('Design'),_('Design your profile')); + // TRANS: Link title attribute in user account settings menu. + $title = _('Design your profile'); + // TRANS: Link description in user account settings menu. + $this->showMenuItem('userdesignsettings',_('Design'),$title); Event::handle('EndAccountSettingsDesignMenuItem', array($this, &$menu)); } if(Event::handle('StartAccountSettingsOtherMenuItem', array($this, &$menu))){ - $this->showMenuItem('othersettings',_('Other'),_('Other options')); + // TRANS: Link title attribute in user account settings menu. + $title = _('Other options'); + // TRANS: Link description in user account settings menu. + $this->showMenuItem('othersettings',_('Other'),$title); Event::handle('EndAccountSettingsOtherMenuItem', array($this, &$menu)); } diff --git a/lib/action.php b/lib/action.php index c4d9fd5cb..98e5ec2c9 100644 --- a/lib/action.php +++ b/lib/action.php @@ -141,6 +141,7 @@ class Action extends HTMLOutputter // lawsuit function showTitle() { $this->element('title', null, + // TRANS: Page title. %1$s is the title, %2$s is the site name. sprintf(_("%1\$s - %2\$s"), $this->title(), common_config('site', 'name'))); @@ -156,6 +157,7 @@ class Action extends HTMLOutputter // lawsuit function title() { + // TRANS: Page title for a page without a title set. return _("Untitled page"); } @@ -420,6 +422,7 @@ class Action extends HTMLOutputter // lawsuit { $user = common_current_user(); $this->elementStart('dl', array('id' => 'site_nav_global_primary')); + // TRANS: DT element for primary navigation menu. String is hidden in default CSS. $this->element('dt', null, _('Primary site navigation')); $this->elementStart('dd'); $this->elementStart('ul', array('class' => 'nav')); @@ -427,31 +430,31 @@ class Action extends HTMLOutputter // lawsuit if ($user) { // TRANS: Tooltip for main menu option "Personal" $tooltip = _m('TOOLTIP', 'Personal profile and friends timeline'); - // TRANS: Main menu option when logged in for access to personal profile and friends timeline $this->menuItem(common_local_url('all', array('nickname' => $user->nickname)), + // TRANS: Main menu option when logged in for access to personal profile and friends timeline _m('MENU', 'Personal'), $tooltip, false, 'nav_home'); // TRANS: Tooltip for main menu option "Account" $tooltip = _m('TOOLTIP', 'Change your email, avatar, password, profile'); - // TRANS: Main menu option when logged in for access to user settings $this->menuItem(common_local_url('profilesettings'), + // TRANS: Main menu option when logged in for access to user settings _('Account'), $tooltip, false, 'nav_account'); // TRANS: Tooltip for main menu option "Services" $tooltip = _m('TOOLTIP', 'Connect to services'); - // TRANS: Main menu option when logged in and connection are possible for access to options to connect to other services $this->menuItem(common_local_url('oauthconnectionssettings'), + // TRANS: Main menu option when logged in and connection are possible for access to options to connect to other services _('Connect'), $tooltip, false, 'nav_connect'); if ($user->hasRight(Right::CONFIGURESITE)) { // TRANS: Tooltip for menu option "Admin" $tooltip = _m('TOOLTIP', 'Change site configuration'); - // TRANS: Main menu option when logged in and site admin for access to site configuration $this->menuItem(common_local_url('siteadminpanel'), + // TRANS: Main menu option when logged in and site admin for access to site configuration _m('MENU', 'Admin'), $tooltip, false, 'nav_admin'); } if (common_config('invite', 'enabled')) { // TRANS: Tooltip for main menu option "Invite" $tooltip = _m('TOOLTIP', 'Invite friends and colleagues to join you on %s'); - // TRANS: Main menu option when logged in and invitations are allowed for inviting new users $this->menuItem(common_local_url('invite'), + // TRANS: Main menu option when logged in and invitations are allowed for inviting new users _m('MENU', 'Invite'), sprintf($tooltip, common_config('site', 'name')), @@ -459,16 +462,16 @@ class Action extends HTMLOutputter // lawsuit } // TRANS: Tooltip for main menu option "Logout" $tooltip = _m('TOOLTIP', 'Logout from the site'); - // TRANS: Main menu option when logged in to log out the current user $this->menuItem(common_local_url('logout'), + // TRANS: Main menu option when logged in to log out the current user _m('MENU', 'Logout'), $tooltip, false, 'nav_logout'); } else { if (!common_config('site', 'closed') && !common_config('site', 'inviteonly')) { // TRANS: Tooltip for main menu option "Register" $tooltip = _m('TOOLTIP', 'Create an account'); - // TRANS: Main menu option when not logged in to register a new account $this->menuItem(common_local_url('register'), + // TRANS: Main menu option when not logged in to register a new account _m('MENU', 'Register'), $tooltip, false, 'nav_register'); } // TRANS: Tooltip for main menu option "Login" @@ -575,6 +578,7 @@ class Action extends HTMLOutputter // lawsuit function showLocalNavBlock() { $this->elementStart('dl', array('id' => 'site_nav_local_views')); + // TRANS: DT element for local views block. String is hidden in default CSS. $this->element('dt', null, _('Local views')); $this->elementStart('dd'); $this->showLocalNav(); @@ -641,6 +645,7 @@ class Action extends HTMLOutputter // lawsuit $this->elementStart('dl', array('id' => 'page_notice', 'class' => 'system_notice')); + // TRANS: DT element for page notice. String is hidden in default CSS. $this->element('dt', null, _('Page notice')); $this->elementStart('dd'); if (Event::handle('StartShowPageNotice', array($this))) { @@ -743,28 +748,37 @@ class Action extends HTMLOutputter // lawsuit function showSecondaryNav() { $this->elementStart('dl', array('id' => 'site_nav_global_secondary')); + // TRANS: DT element for secondary navigation menu. String is hidden in default CSS. $this->element('dt', null, _('Secondary site navigation')); $this->elementStart('dd', null); $this->elementStart('ul', array('class' => 'nav')); if (Event::handle('StartSecondaryNav', array($this))) { $this->menuItem(common_local_url('doc', array('title' => 'help')), + // TRANS: Secondary navigation menu option leading to help on StatusNet. _('Help')); $this->menuItem(common_local_url('doc', array('title' => 'about')), + // TRANS: Secondary navigation menu option leading to text about StatusNet site. _('About')); $this->menuItem(common_local_url('doc', array('title' => 'faq')), + // TRANS: Secondary navigation menu option leading to Frequently Asked Questions. _('FAQ')); $bb = common_config('site', 'broughtby'); if (!empty($bb)) { $this->menuItem(common_local_url('doc', array('title' => 'tos')), + // TRANS: Secondary navigation menu option leading to Terms of Service. _('TOS')); } $this->menuItem(common_local_url('doc', array('title' => 'privacy')), + // TRANS: Secondary navigation menu option leading to privacy policy. _('Privacy')); $this->menuItem(common_local_url('doc', array('title' => 'source')), + // TRANS: Secondary navigation menu option. _('Source')); $this->menuItem(common_local_url('version'), + // TRANS: Secondary navigation menu option leading to version information on the StatusNet site. _('Version')); $this->menuItem(common_local_url('doc', array('title' => 'contact')), + // TRANS: Secondary navigation menu option leading to contact information on the StatusNet site. _('Contact')); $this->menuItem(common_local_url('doc', array('title' => 'badge')), _('Badge')); @@ -795,16 +809,18 @@ class Action extends HTMLOutputter // lawsuit */ function showStatusNetLicense() { + // TRANS: DT element for StatusNet software license. $this->element('dt', array('id' => 'site_statusnet_license'), _('StatusNet software license')); $this->elementStart('dd', null); - // @fixme drop the final spaces in the messages when at good spot - // to let translations get updated. if (common_config('site', 'broughtby')) { - $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). '); + // TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is set. + $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%).'); } else { - $instr = _('**%%site.name%%** is a microblogging service. '); + // TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is not set. + $instr = _('**%%site.name%%** is a microblogging service.'); } $instr .= ' '; + // TRANS: Second sentence of the StatusNet site license. Mentions the StatusNet source code license. $instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION); $output = common_markup_to_html($instr); $this->raw($output); @@ -820,19 +836,25 @@ class Action extends HTMLOutputter // lawsuit function showContentLicense() { if (Event::handle('StartShowContentLicense', array($this))) { + // TRANS: DT element for StatusNet site content license. $this->element('dt', array('id' => 'site_content_license'), _('Site content license')); $this->elementStart('dd', array('id' => 'site_content_license_cc')); switch (common_config('license', 'type')) { case 'private': + // TRANS: Content license displayed when license is set to 'private'. + // TRANS: %1$s is the site name. $this->element('p', null, sprintf(_('Content and data of %1$s are private and confidential.'), common_config('site', 'name'))); // fall through case 'allrightsreserved': if (common_config('license', 'owner')) { + // TRANS: Content license displayed when license is set to 'allrightsreserved'. + // TRANS: %1$s is the copyright owner. $this->element('p', null, sprintf(_('Content and data copyright by %1$s. All rights reserved.'), common_config('license', 'owner'))); } else { + // TRANS: Content license displayed when license is set to 'allrightsreserved' and no owner is set. $this->element('p', null, _('Content and data copyright by contributors. All rights reserved.')); } break; @@ -1148,11 +1170,15 @@ class Action extends HTMLOutputter // lawsuit * * @return nothing */ + // XXX: The messages in this pagination method only tailor to navigating + // notices. In other lists, "Previous"/"Next" type navigation is + // desirable, but not available. function pagination($have_before, $have_after, $page, $action, $args=null) { // Does a little before-after block for next/prev page if ($have_before || $have_after) { $this->elementStart('dl', 'pagination'); + // TRANS: DT element for pagination (previous/next, etc.). $this->element('dt', null, _('Pagination')); $this->elementStart('dd', null); $this->elementStart('ul', array('class' => 'nav')); @@ -1162,6 +1188,8 @@ class Action extends HTMLOutputter // lawsuit $this->elementStart('li', array('class' => 'nav_prev')); $this->element('a', array('href' => common_local_url($action, $args, $pargs), 'rel' => 'prev'), + // TRANS: Pagination message to go to a page displaying information more in the + // TRANS: present than the currently displayed information. _('After')); $this->elementEnd('li'); } @@ -1170,6 +1198,8 @@ class Action extends HTMLOutputter // lawsuit $this->elementStart('li', array('class' => 'nav_next')); $this->element('a', array('href' => common_local_url($action, $args, $pargs), 'rel' => 'next'), + // TRANS: Pagination message to go to a page displaying information more in the + // TRANS: past than the currently displayed information. _('Before')); $this->elementEnd('li'); } @@ -1213,6 +1243,8 @@ class Action extends HTMLOutputter // lawsuit * @return void */ + // XXX: Finding this type of check with the same message about 50 times. + // Possible to refactor? function checkSessionToken() { // CSRF protection diff --git a/lib/activity.php b/lib/activity.php index 27f09ab4d..8e2da99bb 100644 --- a/lib/activity.php +++ b/lib/activity.php @@ -118,7 +118,8 @@ class Activity // Insist on a feed's root DOMElement; don't allow a DOMDocument if ($feed instanceof DOMDocument) { throw new ClientException( - _("Expecting a root feed element but got a whole XML document.") + // TRANS: Client exception thrown when a feed instance is a DOMDocument. + _('Expecting a root feed element but got a whole XML document.') ); } diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php index a927e2333..e22804fc8 100644 --- a/lib/adminpanelaction.php +++ b/lib/adminpanelaction.php @@ -69,7 +69,7 @@ class AdminPanelAction extends Action // User must be logged in. if (!common_logged_in()) { - // TRANS: Client error message + // TRANS: Client error message thrown when trying to access the admin panel while not logged in. $this->clientError(_('Not logged in.')); return false; } @@ -94,7 +94,7 @@ class AdminPanelAction extends Action // User must have the right to change admin settings if (!$user->hasRight(Right::CONFIGURESITE)) { - // TRANS: Client error message + // TRANS: Client error message thrown when a user tries to change admin settings but has no access rights. $this->clientError(_('You cannot make changes to this site.')); return false; } @@ -106,7 +106,7 @@ class AdminPanelAction extends Action $name = mb_substr($name, 0, -10); if (!self::canAdmin($name)) { - // TRANS: Client error message + // TRANS: Client error message throw when a certain panel's settings cannot be changed. $this->clientError(_('Changes to that panel are not allowed.'), 403); return false; } @@ -225,7 +225,7 @@ class AdminPanelAction extends Action function showForm() { - // TRANS: Client error message + // TRANS: Client error message. $this->clientError(_('showForm() not implemented.')); return; } @@ -279,7 +279,8 @@ class AdminPanelAction extends Action $result = $config->delete(); if (!$result) { common_log_db_error($config, 'DELETE', __FILE__); - // TRANS: Client error message + // TRANS: Client error message thrown if design settings could not be deleted in + // TRANS: the admin panel Design. $this->clientError(_("Unable to delete design setting.")); return null; } diff --git a/lib/apiaction.php b/lib/apiaction.php index 59dc47c23..a3c34a91b 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -32,6 +32,67 @@ * @link http://status.net/ */ +/* External API usage documentation. Please update when you change how the API works. */ + +/*! @mainpage StatusNet REST API + + @section Introduction + + Some explanatory text about the API would be nice. + + @section API Methods + + @subsection timelinesmethods_sec Timeline Methods + + @li @ref publictimeline + @li @ref friendstimeline + + @subsection statusmethods_sec Status Methods + + @li @ref statusesupdate + + @subsection usermethods_sec User Methods + + @subsection directmessagemethods_sec Direct Message Methods + + @subsection friendshipmethods_sec Friendship Methods + + @subsection socialgraphmethods_sec Social Graph Methods + + @subsection accountmethods_sec Account Methods + + @subsection favoritesmethods_sec Favorites Methods + + @subsection blockmethods_sec Block Methods + + @subsection oauthmethods_sec OAuth Methods + + @subsection helpmethods_sec Help Methods + + @subsection groupmethods_sec Group Methods + + @page apiroot API Root + + The URLs for methods referred to in this API documentation are + relative to the StatusNet API root. The API root is determined by the + site's @b server and @b path variables, which are generally specified + in config.php. For example: + + @code + $config['site']['server'] = 'example.org'; + $config['site']['path'] = 'statusnet' + @endcode + + The pattern for a site's API root is: @c protocol://server/path/api E.g: + + @c http://example.org/statusnet/api + + The @b path can be empty. In that case the API root would simply be: + + @c http://example.org/api + +*/ + if (!defined('STATUSNET')) { exit(1); } @@ -102,6 +163,7 @@ class ApiAction extends Action function handle($args) { + header('Access-Control-Allow-Origin: *'); parent::handle($args); } @@ -1065,6 +1127,7 @@ class ApiAction extends Action $this->initTwitterAtom(); break; default: + // TRANS: Client error on an API request with an unsupported data format. $this->clientError(_('Not a supported data format.')); break; } @@ -1093,6 +1156,7 @@ class ApiAction extends Action $this->endTwitterRss(); break; default: + // TRANS: Client error on an API request with an unsupported data format. $this->clientError(_('Not a supported data format.')); break; } @@ -1209,6 +1273,7 @@ class ApiAction extends Action $this->showJsonObjects($profile_array); break; default: + // TRANS: Client error on an API request with an unsupported data format. $this->clientError(_('Not a supported data format.')); return; } diff --git a/lib/apiauth.php b/lib/apiauth.php index e78de618e..8c3998888 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -34,6 +34,24 @@ * @link http://status.net/ */ +/* External API usage documentation. Please update when you change how this method works. */ + +/*! @page authentication Authentication + + StatusNet supports HTTP Basic Authentication and OAuth for API calls. + + @warning Currently, users who have created accounts without setting a + password via OpenID, Facebook Connect, etc., cannot use the API until + they set a password with their account settings panel. + + @section HTTP Basic Auth + + + + @section OAuth + +*/ + if (!defined('STATUSNET')) { exit(1); } @@ -91,6 +109,7 @@ class ApiAuthAction extends ApiAction if ($this->isReadOnly($args) == false) { if ($this->access != self::READ_WRITE) { + // TRANS: Client error 401. $msg = _('API resource requires read-write access, ' . 'but you only have read access.'); $this->clientError($msg, 401, $this->format); @@ -273,8 +292,8 @@ class ApiAuthAction extends ApiAction list($proxy, $ip) = common_client_ip(); - $msg = sprintf(_('Failed API auth attempt, nickname = %1$s, ' . - 'proxy = %2$s, ip = %3$s'), + $msg = sprintf( 'Failed API auth attempt, nickname = %1$s, ' . + 'proxy = %2$s, ip = %3$s', $this->auth_user_nickname, $proxy, $ip); diff --git a/lib/applicationeditform.php b/lib/applicationeditform.php index 9b7d05861..81c8fb018 100644 --- a/lib/applicationeditform.php +++ b/lib/applicationeditform.php @@ -133,6 +133,7 @@ class ApplicationEditForm extends Form function formLegend() { + // TRANS: Form legend. $this->out->element('legend', null, _('Edit application')); } @@ -177,10 +178,12 @@ class ApplicationEditForm extends Form } $this->out->element('label', array('for' => 'app_icon'), + // TRANS: Form input field label for application icon. _('Icon')); $this->out->element('input', array('name' => 'app_icon', 'type' => 'file', 'id' => 'app_icon')); + // TRANS: Form guide. $this->out->element('p', 'form_guide', _('Icon for this application')); $this->out->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', @@ -192,6 +195,7 @@ class ApplicationEditForm extends Form $this->out->hidden('application_id', $id); + // TRANS: Form input field label for application name. $this->out->input('name', _('Name'), ($this->out->arg('name')) ? $this->out->arg('name') : $name); @@ -201,11 +205,14 @@ class ApplicationEditForm extends Form $maxDesc = Oauth_application::maxDesc(); if ($maxDesc > 0) { + // TRANS: Form input field instructions. $descInstr = sprintf(_('Describe your application in %d characters'), $maxDesc); } else { + // TRANS: Form input field instructions. $descInstr = _('Describe your application'); } + // TRANS: Form input field label. $this->out->textarea('description', _('Description'), ($this->out->arg('description')) ? $this->out->arg('description') : $description, $descInstr); @@ -213,27 +220,39 @@ class ApplicationEditForm extends Form $this->out->elementEnd('li'); $this->out->elementStart('li'); + // TRANS: Form input field instructions. + $instruction = _('URL of the homepage of this application'); + // TRANS: Form input field label. $this->out->input('source_url', _('Source URL'), ($this->out->arg('source_url')) ? $this->out->arg('source_url') : $source_url, - _('URL of the homepage of this application')); + $instruction); $this->out->elementEnd('li'); $this->out->elementStart('li'); + // TRANS: Form input field instructions. + $instruction = _('Organization responsible for this application'); + // TRANS: Form input field label. $this->out->input('organization', _('Organization'), ($this->out->arg('organization')) ? $this->out->arg('organization') : $organization, - _('Organization responsible for this application')); + $instruction); $this->out->elementEnd('li'); $this->out->elementStart('li'); + // TRANS: Form input field instructions. + $instruction = _('URL for the homepage of the organization'); + // TRANS: Form input field label. $this->out->input('homepage', _('Homepage'), ($this->out->arg('homepage')) ? $this->out->arg('homepage') : $homepage, - _('URL for the homepage of the organization')); + $instruction); $this->out->elementEnd('li'); $this->out->elementStart('li'); + // TRANS: Form input field instructions. + $instruction = _('URL to redirect to after authentication'); + // TRANS: Form input field label. $this->out->input('callback_url', ('Callback URL'), ($this->out->arg('callback_url')) ? $this->out->arg('callback_url') : $callback_url, - _('URL to redirect to after authentication')); + $instruction); $this->out->elementEnd('li'); $this->out->elementStart('li', array('id' => 'application_types')); @@ -255,6 +274,7 @@ class ApplicationEditForm extends Form $this->out->element('label', array('for' => 'app_type-browser', 'class' => 'radio'), + // TRANS: Radio button label for application type _('Browser')); $attrs = array('name' => 'app_type', @@ -271,7 +291,9 @@ class ApplicationEditForm extends Form $this->out->element('label', array('for' => 'app_type-desktop', 'class' => 'radio'), + // TRANS: Radio button label for application type _('Desktop')); + // TRANS: Form guide. $this->out->element('p', 'form_guide', _('Type of application, browser or desktop')); $this->out->elementEnd('li'); @@ -294,6 +316,7 @@ class ApplicationEditForm extends Form $this->out->element('label', array('for' => 'default_access_type-ro', 'class' => 'radio'), + // TRANS: Radio button label for access type. _('Read-only')); $attrs = array('name' => 'default_access_type', @@ -312,7 +335,9 @@ class ApplicationEditForm extends Form $this->out->element('label', array('for' => 'default_access_type-rw', 'class' => 'radio'), + // TRANS: Radio button label for access type. _('Read-write')); + // TRANS: Form guide. $this->out->element('p', 'form_guide', _('Default access for this application: read-only, or read-write')); $this->out->elementEnd('li'); @@ -328,9 +353,13 @@ class ApplicationEditForm extends Form function formActions() { - $this->out->submit('cancel', _('Cancel'), 'submit form_action-primary', + // TRANS: Button label + $this->out->submit('cancel', _m('BUTTON','Cancel'), 'submit form_action-primary', + // TRANS: Submit button title 'cancel', _('Cancel')); - $this->out->submit('save', _('Save'), 'submit form_action-secondary', + // TRANS: Button label + $this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary', + // TRANS: Submit button title 'save', _('Save')); } } diff --git a/lib/applicationlist.php b/lib/applicationlist.php index 3abb1f8aa..904f8981d 100644 --- a/lib/applicationlist.php +++ b/lib/applicationlist.php @@ -88,7 +88,6 @@ class ApplicationList extends Widget function showApplication() { - $user = common_current_user(); $this->out->elementStart('li', array('class' => 'application', @@ -133,11 +132,16 @@ class ApplicationList extends Widget $this->out->elementStart('li'); - $access = ($this->application->access_type & Oauth_application::$writeAccess) - ? 'read-write' : 'read-only'; + // TRANS: Application access type + $readWriteText = _('read-write'); + // TRANS: Application access type + $readOnlyText = _('read-only'); - $txt = 'Approved ' . common_date_string($appUser->modified) . - " - $access access."; + $access = ($this->application->access_type & Oauth_application::$writeAccess) + ? $readWriteText : $readOnlyText; + $modifiedDate = common_date_string($appUser->modified); + // TRANS: Used in application list. %1$s is a modified date, %2$s is access type (read-write or read-only) + $txt = sprintf(_('Approved %1$s - "%2$s" access.'),$modifiedDate,$access); $this->out->raw($txt); $this->out->elementEnd('li'); @@ -151,7 +155,8 @@ class ApplicationList extends Widget $this->out->elementStart('fieldset'); $this->out->hidden('id', $this->application->id); $this->out->hidden('token', common_session_token()); - $this->out->submit('revoke', _('Revoke')); + // TRANS: Button label + $this->out->submit('revoke', _m('BUTTON','Revoke')); $this->out->elementEnd('fieldset'); $this->out->elementEnd('form'); $this->out->elementEnd('li'); diff --git a/lib/atomgroupnoticefeed.php b/lib/atomgroupnoticefeed.php index 08c1c707c..b4810d04a 100644 --- a/lib/atomgroupnoticefeed.php +++ b/lib/atomgroupnoticefeed.php @@ -58,11 +58,14 @@ class AtomGroupNoticeFeed extends AtomNoticeFeed parent::__construct($indent); $this->group = $group; + // TRANS: Title in atom group notice feed. %s is a group name. $title = sprintf(_("%s timeline"), $group->nickname); $this->setTitle($title); $sitename = common_config('site', 'name'); $subtitle = sprintf( + // TRANS: Message is used as a subtitle in atom group notice feed. + // TRANS: %1$s is a group name, %2$s is a site name. _('Updates from %1$s on %2$s!'), $group->nickname, $sitename diff --git a/lib/atomusernoticefeed.php b/lib/atomusernoticefeed.php index 428cc2de2..acfcbd75f 100644 --- a/lib/atomusernoticefeed.php +++ b/lib/atomusernoticefeed.php @@ -64,11 +64,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed $this->setActivitySubject($profile->asActivityNoun('subject')); } + // TRANS: Title in atom user notice feed. %s is a user name. $title = sprintf(_("%s timeline"), $user->nickname); $this->setTitle($title); $sitename = common_config('site', 'name'); $subtitle = sprintf( + // TRANS: Message is used as a subtitle in atom user notice feed. + // TRANS: %1$s is a user name, %2$s is a site name. _('Updates from %1$s on %2$s!'), $user->nickname, $sitename ); diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 43f836e15..59cab9532 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -84,6 +84,7 @@ class AttachmentList extends Widget if (empty($att)) return 0; $this->out->elementStart('dl', array('id' =>'attachments', 'class' => 'entry-content')); + // TRANS: DT element label in attachment list. $this->out->element('dt', null, _('Attachments')); $this->out->elementStart('dd'); $this->out->elementStart('ol', array('class' => 'attachments')); @@ -260,6 +261,7 @@ class Attachment extends AttachmentListItem 'class' => 'entry-content')); if (!empty($this->oembed->author_name)) { $this->out->elementStart('dl', 'vcard author'); + // TRANS: DT element label in attachment list item. $this->out->element('dt', null, _('Author')); $this->out->elementStart('dd', 'fn'); if (empty($this->oembed->author_url)) { @@ -273,6 +275,7 @@ class Attachment extends AttachmentListItem } if (!empty($this->oembed->provider)) { $this->out->elementStart('dl', 'vcard'); + // TRANS: DT element label in attachment list item. $this->out->element('dt', null, _('Provider')); $this->out->elementStart('dd', 'fn'); if (empty($this->oembed->provider_url)) { diff --git a/lib/authorizationplugin.php b/lib/authorizationplugin.php index 07da9b2d1..3790bccf4 100644 --- a/lib/authorizationplugin.php +++ b/lib/authorizationplugin.php @@ -67,7 +67,7 @@ abstract class AuthorizationPlugin extends Plugin //------------Below are the methods that connect StatusNet to the implementing Auth plugin------------\\ - function onStartSetUser(&$user) { + function onStartSetUser($user) { $loginAllowed = $this->loginAllowed($user); if($loginAllowed === true){ return; @@ -84,7 +84,7 @@ abstract class AuthorizationPlugin extends Plugin } } - function onStartSetApiUser(&$user) { + function onStartSetApiUser($user) { return $this->onStartSetUser($user); } diff --git a/lib/command.php b/lib/command.php index 216f9e649..a769dc1fc 100644 --- a/lib/command.php +++ b/lib/command.php @@ -122,6 +122,8 @@ class Command } Event::handle('EndCommandGetProfile', array($this, $arg, &$profile)); if (!$profile) { + // TRANS: Message given requesting a profile for a non-existing user. + // TRANS: %s is the nickname of the user for which the profile could not be found. throw new CommandException(sprintf(_('Could not find a user with nickname %s'), $arg)); } return $profile; @@ -140,6 +142,8 @@ class Command } Event::handle('EndCommandGetUser', array($this, $arg, &$user)); if (!$user){ + // TRANS: Message given getting a non-existing user. + // TRANS: %s is the nickname of the user that could not be found. throw new CommandException(sprintf(_('Could not find a local user with nickname %s'), $arg)); } @@ -225,6 +229,8 @@ class NudgeCommand extends Command } // XXX: notify by IM // XXX: notify by SMS + // TRANS: Message given having nudged another user. + // TRANS: %s is the nickname of the user that was nudged. $channel->output($this->user, sprintf(_('Nudge sent to %s'), $recipient->nickname)); } @@ -328,12 +334,16 @@ class JoinCommand extends Command Event::handle('EndJoinGroup', array($group, $cur)); } } catch (Exception $e) { - $channel->error($cur, sprintf(_('Could not join user %s to group %s'), + // TRANS: Message given having failed to add a user to a group. + // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group. + $channel->error($cur, sprintf(_('Could not join user %1$s to group %2$s'), $cur->nickname, $group->nickname)); return; } - $channel->output($cur, sprintf(_('%s joined group %s'), + // TRANS: Message given having added a user to a group. + // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group. + $channel->output($cur, sprintf(_('%1$s joined group %2$s'), $cur->nickname, $group->nickname)); } @@ -370,12 +380,16 @@ class DropCommand extends Command Event::handle('EndLeaveGroup', array($group, $cur)); } } catch (Exception $e) { - $channel->error($cur, sprintf(_('Could not remove user %s to group %s'), + // TRANS: Message given having failed to remove a user from a group. + // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group. + $channel->error($cur, sprintf(_('Could not remove user %1$s from group %2$s'), $cur->nickname, $group->nickname)); return; } - $channel->output($cur, sprintf(_('%s left group %s'), + // TRANS: Message given having removed a user from a group. + // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group. + $channel->output($cur, sprintf(_('%1$s left group %2$s'), $cur->nickname, $group->nickname)); } @@ -395,18 +409,24 @@ class WhoisCommand extends Command { $recipient = $this->getProfile($this->other); + // TRANS: Whois output. + // TRANS: %1$s nickname of the queried user, %2$s is their profile URL. $whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname, $recipient->profileurl); if ($recipient->fullname) { + // TRANS: Whois output. %s is the full name of the queried user. $whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname); } if ($recipient->location) { + // TRANS: Whois output. %s is the location of the queried user. $whois .= "\n" . sprintf(_('Location: %s'), $recipient->location); } if ($recipient->homepage) { + // TRANS: Whois output. %s is the homepage of the queried user. $whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage); } if ($recipient->bio) { + // TRANS: Whois output. %s is the bio information of the queried user. $whois .= "\n" . sprintf(_('About: %s'), $recipient->bio); } $channel->output($this->user, $whois); @@ -447,7 +467,9 @@ class MessageCommand extends Command $this->text = common_shorten_links($this->text); if (Message::contentTooLong($this->text)) { - $channel->error($this->user, sprintf(_('Message too long - maximum is %d characters, you sent %d'), + // TRANS: Message given if content is too long. + // TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters. + $channel->error($this->user, sprintf(_('Message too long - maximum is %1$d characters, you sent %2$d'), Message::maxContent(), mb_strlen($this->text))); return; } @@ -465,6 +487,8 @@ class MessageCommand extends Command $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source()); if ($message) { $message->notify(); + // TRANS: Message given have sent a direct message to another user. + // TRANS: %s is the name of the other user. $channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other)); } else { $channel->error($this->user, _('Error sending direct message.')); @@ -500,6 +524,8 @@ class RepeatCommand extends Command if ($repeat) { + // TRANS: Message given having repeated a notice from another user. + // TRANS: %s is the name of the user for which the notice was repeated. $channel->output($this->user, sprintf(_('Notice from %s repeated'), $recipient->nickname)); } else { $channel->error($this->user, _('Error repeating notice.')); diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 7786b5941..5dc2b38da 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -100,6 +100,7 @@ class HTMLOutputter extends XMLOutputter $type = common_negotiate_type($cp, $sp); if (!$type) { + // TRANS: Client exception 406 throw new ClientException(_('This page is not available in a '. 'media type you accept'), 406); } diff --git a/lib/language.php b/lib/language.php index 64b59e739..8009adc9b 100644 --- a/lib/language.php +++ b/lib/language.php @@ -202,16 +202,19 @@ function _mdomain($backtrace) static $cached; $path = $backtrace[0]['file']; if (!isset($cached[$path])) { + $final = 'statusnet'; // assume default domain if (DIRECTORY_SEPARATOR !== '/') { $path = strtr($path, DIRECTORY_SEPARATOR, '/'); } - $cut = strpos($path, '/plugins/') + 9; - $cut2 = strpos($path, '/', $cut); - if ($cut && $cut2) { - $cached[$path] = substr($path, $cut, $cut2 - $cut); - } else { - return null; + $cut = strpos($path, '/plugins/'); + if ($cut) { + $cut += strlen('/plugins/'); + $cut2 = strpos($path, '/', $cut); + if ($cut && $cut2) { + $final = substr($path, $cut, $cut2 - $cut); + } } + $cached[$path] = $final; } return $cached[$path]; } @@ -286,6 +289,7 @@ function get_nice_language_list() */ function get_all_languages() { return array( + 'af' => array('q' => 0.8, 'lang' => 'af', 'name' => 'Afrikaans', 'direction' => 'ltr'), 'ar' => array('q' => 0.8, 'lang' => 'ar', 'name' => 'Arabic', 'direction' => 'rtl'), 'arz' => array('q' => 0.8, 'lang' => 'arz', 'name' => 'Egyptian Spoken Arabic', 'direction' => 'rtl'), 'bg' => array('q' => 0.8, 'lang' => 'bg', 'name' => 'Bulgarian', 'direction' => 'ltr'), @@ -301,7 +305,8 @@ function get_all_languages() { 'fi' => array('q' => 1, 'lang' => 'fi', 'name' => 'Finnish', 'direction' => 'ltr'), 'fa' => array('q' => 1, 'lang' => 'fa', 'name' => 'Persian', 'direction' => 'rtl'), 'fr-fr' => array('q' => 1, 'lang' => 'fr', 'name' => 'French', 'direction' => 'ltr'), - 'ga' => array('q' => 0.5, 'lang' => 'ga', 'name' => 'Galician', 'direction' => 'ltr'), + 'ga' => array('q' => 0.5, 'lang' => 'ga', 'name' => 'Irish', 'direction' => 'ltr'), + 'gl' => array('q' => 0.8, 'lang' => 'gl', 'name' => 'Galician', 'direction' => 'ltr'), 'he' => array('q' => 0.5, 'lang' => 'he', 'name' => 'Hebrew', 'direction' => 'rtl'), 'hsb' => array('q' => 0.8, 'lang' => 'hsb', 'name' => 'Upper Sorbian', 'direction' => 'ltr'), 'ia' => array('q' => 0.8, 'lang' => 'ia', 'name' => 'Interlingua', 'direction' => 'ltr'), diff --git a/lib/mediafile.php b/lib/mediafile.php index 10d90d008..1c96c42d7 100644 --- a/lib/mediafile.php +++ b/lib/mediafile.php @@ -171,7 +171,7 @@ class MediaFile return; } - if (!MediaFile::respectsQuota($user, $_FILES['attach']['size'])) { + if (!MediaFile::respectsQuota($user, $_FILES[$param]['size'])) { // Should never actually get here diff --git a/lib/noticeform.php b/lib/noticeform.php index 7278c41a9..84c20a5b3 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -212,8 +212,8 @@ class NoticeForm extends Form $this->out->checkbox('notice_data-geo', _('Share my location'), true); $this->out->elementEnd('div'); $this->out->inlineScript(' var NoticeDataGeo_text = {'. - 'ShareDisable: "'._('Do not share my location').'",'. - 'ErrorTimeout: "'._('Sorry, retrieving your geo location is taking longer than expected, please try again later').'"'. + 'ShareDisable: ' .json_encode(_('Do not share my location')).','. + 'ErrorTimeout: ' .json_encode(_('Sorry, retrieving your geo location is taking longer than expected, please try again later')). '}'); } diff --git a/lib/noticelist.php b/lib/noticelist.php index 4f997a328..5265326b2 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -426,10 +426,18 @@ class NoticeListItem extends Widget if (empty($name)) { $latdms = $this->decimalDegreesToDMS(abs($lat)); $londms = $this->decimalDegreesToDMS(abs($lon)); + // TRANS: Used in coordinates as abbreviation of north + $north = _('N'); + // TRANS: Used in coordinates as abbreviation of south + $south = _('S'); + // TRANS: Used in coordinates as abbreviation of east + $east = _('E'); + // TRANS: Used in coordinates as abbreviation of west + $west = _('W'); $name = sprintf( _('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'), - $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0?_('N'):_('S')), - $londms['deg'],$londms['min'], $londms['sec'],($lon>0?_('E'):_('W'))); + $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south), + $londms['deg'],$londms['min'], $londms['sec'],($lon>0? $east:$west)); } $url = $location->getUrl(); diff --git a/lib/profileaction.php b/lib/profileaction.php index 82e0224af..504b77566 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -174,6 +174,12 @@ class ProfileAction extends OwnerDesignAction $subbed_count = $this->profile->subscriberCount(); $notice_count = $this->profile->noticeCount(); $group_count = $this->user->getGroups()->N; + $age_days = (time() - strtotime($this->profile->created)) / 86400; + if ($age_days < 1) { + // Rather than extrapolating out to a bajillion... + $age_days = 1; + } + $daily_count = round($notice_count / $age_days); $this->elementStart('div', array('id' => 'entity_statistics', 'class' => 'section')); @@ -224,6 +230,12 @@ class ProfileAction extends OwnerDesignAction $this->element('dd', null, $notice_count); $this->elementEnd('dl'); + $this->elementStart('dl', 'entity_daily_notices'); + // TRANS: Average count of posts made per day since account registration + $this->element('dt', null, _('Daily average')); + $this->element('dd', null, $daily_count); + $this->elementEnd('dl'); + $this->elementEnd('div'); } diff --git a/lib/util.php b/lib/util.php index c0013bb3d..e0669a1d5 100644 --- a/lib/util.php +++ b/lib/util.php @@ -832,7 +832,7 @@ function common_linkify($url) { } if (!empty($f)) { - if ($f->getEnclosure()) { + if ($f->getEnclosure() || File_oembed::staticGet('file_id',$f->id)) { $is_attachment = true; $attachment_id = $f->id; @@ -855,10 +855,10 @@ function common_linkify($url) { return XMLStringer::estring('a', $attrs, $url); } -function common_shorten_links($text) +function common_shorten_links($text, $always = false) { $maxLength = Notice::maxContent(); - if ($maxLength == 0 || mb_strlen($text) <= $maxLength) return $text; + if (!$always && ($maxLength == 0 || mb_strlen($text) <= $maxLength)) return $text; return common_replace_urls_callback($text, array('File_redirection', 'makeShort')); } @@ -1079,24 +1079,38 @@ function common_date_string($dt) if ($now < $t) { // that shouldn't happen! return common_exact_date($dt); } else if ($diff < 60) { + // TRANS: Used in notices to indicate when the notice was made compared to now. return _('a few seconds ago'); } else if ($diff < 92) { + // TRANS: Used in notices to indicate when the notice was made compared to now. return _('about a minute ago'); } else if ($diff < 3300) { + // XXX: should support plural. + // TRANS: Used in notices to indicate when the notice was made compared to now. return sprintf(_('about %d minutes ago'), round($diff/60)); } else if ($diff < 5400) { + // TRANS: Used in notices to indicate when the notice was made compared to now. return _('about an hour ago'); } else if ($diff < 22 * 3600) { + // XXX: should support plural. + // TRANS: Used in notices to indicate when the notice was made compared to now. return sprintf(_('about %d hours ago'), round($diff/3600)); } else if ($diff < 37 * 3600) { + // TRANS: Used in notices to indicate when the notice was made compared to now. return _('about a day ago'); } else if ($diff < 24 * 24 * 3600) { + // XXX: should support plural. + // TRANS: Used in notices to indicate when the notice was made compared to now. return sprintf(_('about %d days ago'), round($diff/(24*3600))); } else if ($diff < 46 * 24 * 3600) { + // TRANS: Used in notices to indicate when the notice was made compared to now. return _('about a month ago'); } else if ($diff < 330 * 24 * 3600) { + // XXX: should support plural. + // TRANS: Used in notices to indicate when the notice was made compared to now. return sprintf(_('about %d months ago'), round($diff/(30*24*3600))); } else if ($diff < 480 * 24 * 3600) { + // TRANS: Used in notices to indicate when the notice was made compared to now. return _('about a year ago'); } else { return common_exact_date($dt); |