Update whitespace.
i18n/L10n fixes.
* @return Notice_to_status object found, or null for no hits
*
*/
-
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Notice_to_status', $k, $v);
*
* @return array array of column definitions
*/
-
function table()
{
return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
*
* @return array list of key field names
*/
-
function keys()
{
return array_keys($this->keyTypes());
* 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here.
*/
-
function keyTypes()
{
return array('notice_id' => 'K', 'status_id' => 'U');
*
* @return array magic three-false array that stops auto-incrementing.
*/
-
function sequenceKey()
{
return array(false, false, false);
*
* @return Notice_to_status new object for this value
*/
-
static function saveNew($notice_id, $status_id)
{
if (empty($notice_id)) {
if (self::hasKeys() && common_config('twitter', 'signin')) {
$action->menuItem(
common_local_url('twitterlogin'),
- _m('Twitter'),
- _m('Login or register using Twitter'),
+ // TRANS: Menu item in login navigation.
+ _m('MENU','Twitter'),
+ // TRANS: Title for menu item in login navigation.
+ _m('Login or register using Twitter.'),
'twitterlogin' === $action_name
);
}
$action->menuItem(
common_local_url('twittersettings'),
- _m('Twitter'),
+ // TRANS: Menu item in connection settings navigation.
+ _m('MENU','Twitter'),
+ // TRANS: Title for menu item in connection settings navigation.
_m('Twitter integration options'),
$action_name === 'twittersettings'
);
'version' => self::VERSION,
'author' => 'Zach Copley, Julien C',
'homepage' => 'http://status.net/wiki/Plugin:TwitterBridge',
- 'rawdescription' => _m(
- 'The Twitter "bridge" plugin allows integration ' .
+ // TRANS: Plugin description.
+ 'rawdescription' => _m('The Twitter "bridge" plugin allows integration ' .
'of a StatusNet instance with ' .
'<a href="http://twitter.com/">Twitter</a>.'
)
* @param mixed $v Value to lookup
*
* @return Twitter_synch_status object found, or null for no hits
- *
*/
function staticGet($k, $v=null)
{
} else if ($scheme == 'https') {
$rawScheme = 'ssl';
} else {
- throw new ServerException('Invalid URL scheme for HTTP stream reader');
+ // TRANS: Server exception thrown when an invalid URL scheme is detected.
+ throw new ServerException(_m('Invalid URL scheme for HTTP stream reader.'));
}
$host = parse_url($url, PHP_URL_HOST);
public function handleInput($socket)
{
if ($this->socket !== $socket) {
- throw new Exception('Got input from unexpected socket!');
+ // TRANS: Exception thrown when input from an inexpected socket is encountered.
+ throw new Exception(_m('Got input from unexpected socket!'));
}
try {
$this->handleLineActive($line);
break;
default:
- throw new Exception('Invalid state in handleLine: ' . $this->state);
+ // TRANS: Exception thrown when an invalid state is encountered in handleLine.
+ // TRANS: %s is the invalid state.
+ throw new Exception(sprintf(_m('Invalid state in handleLine: %s.'),$this->state));
}
}
{
$bits = explode(' ', $line, 3);
if (count($bits) != 3) {
- throw new Exception("Invalid HTTP response line: $line");
+ // TRANS: Exception thrown when an invalid response line is encountered.
+ // TRANS: %s is the invalid line.
+ throw new Exception(sprintf(_m('Invalid HTTP response line: %s.'),$line));
}
list($http, $status, $text) = $bits;
if (substr($http, 0, 5) != 'HTTP/') {
- throw new Exception("Invalid HTTP response line chunk '$http': $line");
+ // TRANS: Exception thrown when an invalid response line part is encountered.
+ // TRANS: %1$s is the chunk, %2$s is the line.
+ throw new Exception(sprintf(_m('Invalid HTTP response line chunk "%1$s": %2$s.'),$http, $line));
}
if ($status != '200') {
- throw new Exception("Bad HTTP response code $status: $line");
+ // TRANS: Exception thrown when an invalid response code is encountered.
+ // TRANS: %1$s is the response code, %2$s is the line.
+ throw new Exception(sprintf(_m('Bad HTTP response code %1$s: %2$s.'),$status,$line));
}
common_log(LOG_DEBUG, "$this->id $line");
$this->state = 'headers';
$fuser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE);
if (!empty($fuser)) {
-
// Delete old record if Twitter user changed screen name
if ($fuser->nickname != $screen_name) {
*/
function title()
{
- return _m('Twitter');
+ // TRANS: Page title for Twitter administration panel.
+ return _m('TITLE','Twitter');
}
/**
*/
function getInstructions()
{
+ // TRANS: Instructions for Twitter bridge administration page.
return _m('Twitter bridge settings');
}
if (mb_strlen($values['twitter']['consumer_key']) > 255) {
$this->clientError(
- _m("Invalid consumer key. Max length is 255 characters.")
+ // TRANS: Client error displayed when a consumer key is invalid because it is too long.
+ _m('Invalid consumer key. Maximum length is 255 characters.')
);
}
if (mb_strlen($values['twitter']['consumer_secret']) > 255) {
$this->clientError(
- _m("Invalid consumer secret. Max length is 255 characters.")
+ // TRANS: Client error displayed when a consumer secret is invalid because it is too long.
+ _m('Invalid consumer secret. Maximum length is 255 characters.')
);
}
}
'fieldset',
array('id' => 'settings_twitter-application')
);
+ // TRANS: Fieldset legend for Twitter application settings.
$this->out->element('legend', null, _m('Twitter application settings'));
$this->out->elementStart('ul', 'form_data');
$this->li();
$this->input(
'consumer_key',
+ // TRANS: Field label for Twitter assigned consumer key.
_m('Consumer key'),
- _m('Consumer key assigned by Twitter'),
+ // TRANS: Field title for Twitter assigned consumer key.
+ _m('The consumer key assigned by Twitter.'),
'twitter'
);
$this->unli();
$this->li();
$this->input(
'consumer_secret',
- _m('Consumer secret'),
- _m('Consumer secret assigned by Twitter'),
+ // TRANS: Field label for Twitter assigned consumer secret.
+ _m('Consumer secret'),
+ // TRANS: Field title for Twitter assigned consumer secret.
+ _m('The consumer secret assigned by Twitter.'),
'twitter'
);
$this->unli();
if (!empty($globalConsumerKey) && !empty($globalConsumerSec)) {
$this->li();
- $this->out->element('p', 'form_guide', _m('Note: a global consumer key and secret are set.'));
+ // TRANS: Form guide displayed when two required fields have already been provided.
+ $this->out->element('p', 'form_guide', _m('Note: A global consumer key and secret are set.'));
$this->unli();
}
$this->li();
$this->input(
'source',
- _m('Integration source'),
- _m('Name of your Twitter application'),
+ // TRANS: Field label for Twitter application name.
+ _m('Integration source'),
+ // TRANS: Field title for Twitter application name.
+ _m('The name of your Twitter application.'),
'integration'
);
$this->unli();
'fieldset',
array('id' => 'settings_twitter-options')
);
+ // TRANS: Fieldset legend for Twitter integration options.
$this->out->element('legend', null, _m('Options'));
$this->out->elementStart('ul', 'form_data');
$this->li();
$this->out->checkbox(
+ // TRANS: Checkbox label for global setting.
'signin', _m('Enable "Sign-in with Twitter"'),
(bool) $this->value('signin', 'twitter'),
- _m('Allow users to login with their Twitter credentials')
+ // TRANS: Checkbox title.
+ _m('This allow users to login with their Twitter credentials.')
);
$this->unli();
if (Event::handle('TwitterBridgeAdminImportControl')) {
$this->li();
$this->out->checkbox(
+ // TRANS: Checkbox label for global setting.
'enabled', _m('Enable Twitter import'),
(bool) $this->value('enabled', 'twitterimport'),
+ // TRANS: Checkbox title for global setting.
_m('Allow users to import their Twitter friends\' timelines. Requires daemons to be manually configured.')
);
$this->unli();
*/
function formActions()
{
- $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Twitter settings'));
+ // TRANS: Button text for saving the administrative Twitter bridge settings.
+ $this->out->submit('submit', _m('BUTTON','Save'), 'submit', null,
+ // TRANS: Button title for saving the administrative Twitter bridge settings.
+ _m('Save the Twitter bridge settings.'));
}
}
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
+ // TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_m('There was a problem with your session token. Try again, please.'));
return;
}
if ($this->arg('create')) {
if (!$this->boolean('license')) {
+ // TRANS: Form validation error displayed when the checkbox to agree to the license has not been checked.
$this->showForm(_m('You cannot register if you do not agree to the license.'),
$this->trimmed('newname'));
return;
$this->connectNewUser();
} else {
common_debug('Twitter bridge - ' . print_r($this->args, true));
+ // TRANS: Form validation error displayed when an unhandled error occurs.
$this->showForm(_m('Something weird happened.'),
$this->trimmed('newname'));
}
function authorizeRequestToken()
{
try {
-
// Get a new request token and authorize it
$client = new TwitterOAuthClient();
$_SESSION['twitter_request_token_secret'] = $req_tok->secret;
$auth_link = $client->getAuthorizeLink($req_tok, $this->signin);
-
} catch (OAuthClientException $e) {
$msg = sprintf(
'OAuth client error - code: %1s, msg: %2s',
);
common_log(LOG_INFO, 'Twitter bridge - ' . $msg);
$this->serverError(
+ // TRANS: Server error displayed when linking to a Twitter account fails.
_m('Could not link your Twitter account.')
);
}
if ($_SESSION['twitter_request_token'] != $this->oauth_token) {
$this->serverError(
- _m('Couldn\'t link your Twitter account: oauth_token mismatch.')
+ // TRANS: Server error displayed when linking to a Twitter account fails because of an incorrect oauth_token.
+ _m('Could not link your Twitter account: oauth_token mismatch.')
);
}
);
common_log(LOG_INFO, 'Twitter bridge - ' . $msg);
$this->serverError(
- _m('Couldn\'t link your Twitter account.')
+ // TRANS: Server error displayed when linking to a Twitter account fails.
+ _m('Could not link your Twitter account.')
);
}
if (empty($flink_id)) {
common_log_db_error($flink, 'INSERT', __FILE__);
- $this->serverError(_m('Couldn\'t link your Twitter account.'));
+ // TRANS: Server error displayed when linking to a Twitter account fails.
+ $this->serverError(_m('Could not link your Twitter account.'));
}
return $flink_id;
$this->element('div', array('class' => 'error'), $this->error);
} else {
$this->element('div', 'instructions',
- sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Twitter account to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
+ // TRANS: Page instruction. %s is the StatusNet sitename.
+ sprintf(_m('This is the first time you have logged into %s so we must connect your Twitter account to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
}
}
function title()
{
+ // TRANS: Page title.
return _m('Twitter Account Setup');
}
'class' => 'form_settings',
'action' => common_local_url('twitterauthorization')));
$this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options'));
+ // TRANS: Fieldset legend.
$this->element('legend', null, _m('Connection options'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
'name' => 'license',
'value' => 'true'));
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
+ // TRANS: Text for license agreement checkbox.
+ // TRANS: %s is the license as configured for the StatusNet site.
$message = _m('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
$this->element('legend', null,
+ // TRANS: Fieldset legend.
_m('Create new account'));
$this->element('p', null,
+ // TRANS: Sub form introduction text.
_m('Create a new user with this nickname.'));
$this->elementStart('ul', 'form_data');
Event::handle('StartRegistrationFormData', array($this));
$this->elementStart('li');
+ // TRANS: Field label.
$this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '',
+ // TRANS: Field title for nickname field.
_m('1-64 lowercase letters or numbers, no punctuation or spaces.'));
$this->elementEnd('li');
$this->elementStart('li');
+ // TRANS: Field label.
$this->input('email', _m('LABEL','Email'), $this->getEmail(),
+ // TRANS: Field title for e-mail address field.
_m('Used only for updates, announcements, '.
'and password recovery'));
$this->elementEnd('li');
Event::handle('EndRegistrationFormData', array($this));
$this->elementEnd('ul');
- $this->submit('create', _m('Create'));
+ // TRANS: Button text for creating a new StatusNet account in the Twitter connect page.
+ $this->submit('create', _m('BUTTON','Create'));
$this->elementEnd('fieldset');
$this->elementStart('fieldset');
$this->element('legend', null,
+ // TRANS: Fieldset legend.
_m('Connect existing account'));
$this->element('p', null,
+ // TRANS: Sub form introduction text.
_m('If you already have an account, login with your username and password to connect it to your Twitter account.'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
+ // TRANS: Field label.
$this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li');
$this->elementStart('li');
+ // TRANS: Field label.
$this->password('password', _m('Password'));
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('connect', _m('Connect'));
+ // TRANS: Button text for connecting an existing StatusNet account in the Twitter connect page..
+ $this->submit('connect', _m('BUTTON','Connect'));
$this->elementEnd('fieldset');
$this->elementEnd('fieldset');
}
if (common_config('site', 'closed')) {
+ // TRANS: Client error displayed when trying to create a new user while creating new users is not allowed.
$this->clientError(_m('Registration not allowed.'));
return;
}
if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode'];
if (empty($code)) {
+ // TRANS: Client error displayed when trying to create a new user while creating new users is not allowed.
$this->clientError(_m('Registration not allowed.'));
return;
}
$invite = Invitation::staticGet($code);
if (empty($invite)) {
+ // TRANS: Client error displayed when trying to create a new user with an invalid invitation code.
$this->clientError(_m('Not a valid invitation code.'));
return;
}
}
if (!User::allowed_nickname($nickname)) {
+ // TRANS: Client error displayed when trying to create a new user with an invalid username.
$this->showForm(_m('Nickname not allowed.'));
return;
}
if (User::staticGet('nickname', $nickname)) {
+ // TRANS: Client error displayed when trying to create a new user with a username that is already in use.
$this->showForm(_m('Nickname already in use. Try another one.'));
return;
}
$user = User::register($args);
if (empty($user)) {
+ // TRANS: Server error displayed when creating a new user has failed.
$this->serverError(_m('Error registering user.'));
return;
}
save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) {
+ // TRANS: Server error displayed when connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
return;
}
$password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) {
+ // TRANS: Form validation error displayed when connecting an existing user to a Twitter user fails because
+ // TRANS: the provided username and/or password are incorrect.
$this->showForm(_m('Invalid username or password.'));
return;
}
save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) {
+ // TRANS: Server error displayed connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
return;
}
$result = $this->flinkUser($user->id, $this->twuid);
if (empty($result)) {
+ // TRANS: Server error displayed connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
return;
}
}
}
}
-}
\ No newline at end of file
+}
parent::handle($args);
if (common_is_real_login()) {
+ // TRANS: Client error displayed when trying to log in using Twitter while already logged in to StatusNet.
$this->clientError(_m('Already logged in.'));
}
function title()
{
- return _m('Twitter Login');
+ // TRANS: Title for login using Twitter page.
+ return _m('TITLE','Twitter Login');
}
function getInstructions()
{
+ // TRANS: Instructions for login using Twitter page.
return _m('Login with your Twitter account');
}
null,
array('signin' => true))));
$this->element('img', array('src' => Plugin::staticPath('TwitterBridge', 'Sign-in-with-Twitter-lighter.png'),
+ // TRANS: Alternative text for "sign in with Twitter" image.
'alt' => _m('Sign in with Twitter')));
$this->elementEnd('a');
}
*
* @param string $url
* @param array $params
- * @return string
+ * @return string
*/
protected function oAuthUrl($url, $params=array())
{
/**
* Call event handler callbacks for the given event.
- *
+ *
* @param string $event
* @param mixed $arg1 ... one or more params to pass on
*/