* i18n/L10n updates

* whitespace updates.
This commit is contained in:
Siebrand Mazeland 2010-09-18 17:45:18 +02:00
parent 1c5e00df30
commit ba6538ed78
10 changed files with 39 additions and 113 deletions

View File

@ -45,7 +45,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
* @link http://status.net/ * @link http://status.net/
* @link http://twitter.com/ * @link http://twitter.com/
*/ */
class TwitterBridgePlugin extends Plugin class TwitterBridgePlugin extends Plugin
{ {
@ -55,7 +54,6 @@ class TwitterBridgePlugin extends Plugin
/** /**
* Initializer for the plugin. * Initializer for the plugin.
*/ */
function initialize() function initialize()
{ {
// Allow the key and secret to be passed in // Allow the key and secret to be passed in
@ -86,7 +84,6 @@ class TwitterBridgePlugin extends Plugin
* *
* @return boolean result * @return boolean result
*/ */
static function hasKeys() static function hasKeys()
{ {
$ckey = common_config('twitter', 'consumer_key'); $ckey = common_config('twitter', 'consumer_key');
@ -113,7 +110,6 @@ class TwitterBridgePlugin extends Plugin
* *
* @return boolean hook return * @return boolean hook return
*/ */
function onRouterInitialized($m) function onRouterInitialized($m)
{ {
$m->connect('admin/twitter', array('action' => 'twitteradminpanel')); $m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
@ -310,7 +306,6 @@ class TwitterBridgePlugin extends Plugin
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onPluginVersion(&$versions) function onPluginVersion(&$versions)
{ {
$versions[] = array( $versions[] = array(
@ -319,8 +314,8 @@ class TwitterBridgePlugin extends Plugin
'author' => 'Zach Copley, Julien C', 'author' => 'Zach Copley, Julien C',
'homepage' => 'http://status.net/wiki/Plugin:TwitterBridge', 'homepage' => 'http://status.net/wiki/Plugin:TwitterBridge',
'rawdescription' => _m( 'rawdescription' => _m(
'The Twitter "bridge" plugin allows you to integrate ' . 'The Twitter "bridge" plugin allows integration ' .
'your StatusNet instance with ' . 'of a StatusNet instance with ' .
'<a href="http://twitter.com/">Twitter</a>.' '<a href="http://twitter.com/">Twitter</a>.'
) )
); );
@ -374,7 +369,6 @@ class TwitterBridgePlugin extends Plugin
* *
* @return boolean hook value; true means continue processing, false means stop. * @return boolean hook value; true means continue processing, false means stop.
*/ */
function onCheckSchema() function onCheckSchema()
{ {
$schema = Schema::get(); $schema = Schema::get();
@ -416,7 +410,6 @@ class TwitterBridgePlugin extends Plugin
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onStartDeleteOwnNotice(User $user, Notice $notice) function onStartDeleteOwnNotice(User $user, Notice $notice)
{ {
$n2s = Notice_to_status::staticGet('notice_id', $notice->id); $n2s = Notice_to_status::staticGet('notice_id', $notice->id);
@ -452,7 +445,6 @@ class TwitterBridgePlugin extends Plugin
* @param Notice $notice being favored * @param Notice $notice being favored
* @return hook return value * @return hook return value
*/ */
function onEndFavorNotice(Profile $profile, Notice $notice) function onEndFavorNotice(Profile $profile, Notice $notice)
{ {
$flink = Foreign_link::getByUserID($profile->id, $flink = Foreign_link::getByUserID($profile->id,
@ -489,7 +481,6 @@ class TwitterBridgePlugin extends Plugin
* *
* @return hook return value * @return hook return value
*/ */
function onEndDisfavorNotice(Profile $profile, Notice $notice) function onEndDisfavorNotice(Profile $profile, Notice $notice)
{ {
$flink = Foreign_link::getByUserID($profile->id, $flink = Foreign_link::getByUserID($profile->id,

View File

@ -48,7 +48,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
* *
* @see DB_DataObject * @see DB_DataObject
*/ */
class Twitter_synch_status extends Memcached_DataObject class Twitter_synch_status extends Memcached_DataObject
{ {
public $__table = 'twitter_synch_status'; // table name public $__table = 'twitter_synch_status'; // table name
@ -67,7 +66,6 @@ class Twitter_synch_status extends Memcached_DataObject
* @return Twitter_synch_status object found, or null for no hits * @return Twitter_synch_status object found, or null for no hits
* *
*/ */
function staticGet($k, $v=null) function staticGet($k, $v=null)
{ {
throw new Exception("Use pkeyGet() for this class."); throw new Exception("Use pkeyGet() for this class.");
@ -81,7 +79,6 @@ class Twitter_synch_status extends Memcached_DataObject
* @return Twitter_synch_status object found, or null for no hits * @return Twitter_synch_status object found, or null for no hits
* *
*/ */
function pkeyGet($kv) function pkeyGet($kv)
{ {
return Memcached_DataObject::pkeyGet('Twitter_synch_status', $kv); return Memcached_DataObject::pkeyGet('Twitter_synch_status', $kv);
@ -95,7 +92,6 @@ class Twitter_synch_status extends Memcached_DataObject
* *
* @return array array of column definitions * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('foreign_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, return array('foreign_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
@ -115,7 +111,6 @@ class Twitter_synch_status extends Memcached_DataObject
* *
* @return array list of key field names * @return array list of key field names
*/ */
function keys() function keys()
{ {
return array_keys($this->keyTypes()); return array_keys($this->keyTypes());
@ -133,7 +128,6 @@ class Twitter_synch_status extends Memcached_DataObject
* 'K' for primary key: for compound keys, add an entry for each component; * 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here. * 'U' for unique keys: compound keys are not well supported here.
*/ */
function keyTypes() function keyTypes()
{ {
return array('foreign_id' => 'K', return array('foreign_id' => 'K',
@ -150,7 +144,6 @@ class Twitter_synch_status extends Memcached_DataObject
* *
* @return array magic three-false array that stops auto-incrementing. * @return array magic three-false array that stops auto-incrementing.
*/ */
function sequenceKey() function sequenceKey()
{ {
return array(false, false, false); return array(false, false, false);
@ -174,7 +167,6 @@ class Twitter_synch_status extends Memcached_DataObject
'timeline' => $timeline)); 'timeline' => $timeline));
if (empty($tss)) { if (empty($tss)) {
$tss = new Twitter_synch_status(); $tss = new Twitter_synch_status();
$tss->foreign_id = $foreign_id; $tss->foreign_id = $foreign_id;
@ -186,9 +178,7 @@ class Twitter_synch_status extends Memcached_DataObject
$tss->insert(); $tss->insert();
return true; return true;
} else { } else {
$orig = clone($tss); $orig = clone($tss);
$tss->last_id = $last_id; $tss->last_id = $last_id;

View File

@ -45,7 +45,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class SyncTwitterFriendsDaemon extends ParallelizingDaemon class SyncTwitterFriendsDaemon extends ParallelizingDaemon
{ {
/** /**
@ -59,7 +58,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
* @return void * @return void
* *
**/ **/
function __construct($id = null, $interval = 60, function __construct($id = null, $interval = 60,
$max_children = 2, $debug = null) $max_children = 2, $debug = null)
{ {
@ -71,7 +69,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
* *
* @return string Name of the daemon. * @return string Name of the daemon.
*/ */
function name() function name()
{ {
return ('synctwitterfriends.' . $this->_id); return ('synctwitterfriends.' . $this->_id);
@ -110,12 +107,10 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
} }
function childTask($flink) { function childTask($flink) {
// Each child ps needs its own DB connection // Each child ps needs its own DB connection
// Note: DataObject::getDatabaseConnection() creates // Note: DataObject::getDatabaseConnection() creates
// a new connection if there isn't one already // a new connection if there isn't one already
$conn = &$flink->getDatabaseConnection(); $conn = &$flink->getDatabaseConnection();
$this->subscribeTwitterFriends($flink); $this->subscribeTwitterFriends($flink);
@ -127,7 +122,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
// XXX: Couldn't find a less brutal way to blow // XXX: Couldn't find a less brutal way to blow
// away a cached connection // away a cached connection
global $_DB_DATAOBJECT; global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']); unset($_DB_DATAOBJECT['CONNECTIONS']);
} }
@ -277,4 +271,3 @@ if (have_option('d') || have_option('debug')) {
$syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug); $syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug);
$syncer->runOnce(); $syncer->runOnce();

View File

@ -62,7 +62,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class TwitterStatusFetcher extends ParallelizingDaemon class TwitterStatusFetcher extends ParallelizingDaemon
{ {
/** /**
@ -87,7 +86,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
* *
* @return string Name of the daemon. * @return string Name of the daemon.
*/ */
function name() function name()
{ {
return ('twitterstatusfetcher.'.$this->_id); return ('twitterstatusfetcher.'.$this->_id);
@ -99,7 +97,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
* *
* @return array flinks an array of Foreign_link objects * @return array flinks an array of Foreign_link objects
*/ */
function getObjects() function getObjects()
{ {
global $_DB_DATAOBJECT; global $_DB_DATAOBJECT;
@ -133,12 +130,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon
} }
function childTask($flink) { function childTask($flink) {
// Each child ps needs its own DB connection // Each child ps needs its own DB connection
// Note: DataObject::getDatabaseConnection() creates // Note: DataObject::getDatabaseConnection() creates
// a new connection if there isn't one already // a new connection if there isn't one already
$conn = &$flink->getDatabaseConnection(); $conn = &$flink->getDatabaseConnection();
$this->getTimeline($flink); $this->getTimeline($flink);
@ -150,7 +145,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// XXX: Couldn't find a less brutal way to blow // XXX: Couldn't find a less brutal way to blow
// away a cached connection // away a cached connection
global $_DB_DATAOBJECT; global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']); unset($_DB_DATAOBJECT['CONNECTIONS']);
} }
@ -201,9 +195,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// Reverse to preserve order // Reverse to preserve order
foreach (array_reverse($timeline) as $status) { foreach (array_reverse($timeline) as $status) {
// Hacktastic: filter out stuff coming from this StatusNet // Hacktastic: filter out stuff coming from this StatusNet
$source = mb_strtolower(common_config('integration', 'source')); $source = mb_strtolower(common_config('integration', 'source'));
if (preg_match("/$source/", mb_strtolower($status->source))) { if (preg_match("/$source/", mb_strtolower($status->source))) {
@ -214,7 +206,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// Don't save it if the user is protected // Don't save it if the user is protected
// FIXME: save it but treat it as private // FIXME: save it but treat it as private
if ($status->user->protected) { if ($status->user->protected) {
continue; continue;
} }
@ -232,7 +223,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
} }
// Okay, record the time we synced with Twitter for posterity // Okay, record the time we synced with Twitter for posterity
$flink->last_noticesync = common_sql_now(); $flink->last_noticesync = common_sql_now();
$flink->update(); $flink->update();
} }
@ -250,7 +240,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$statusUri = $this->makeStatusURI($status->user->screen_name, $status->id); $statusUri = $this->makeStatusURI($status->user->screen_name, $status->id);
// check to see if we've already imported the status // check to see if we've already imported the status
$n2s = Notice_to_status::staticGet('status_id', $status->id); $n2s = Notice_to_status::staticGet('status_id', $status->id);
if (!empty($n2s)) { if (!empty($n2s)) {
@ -263,7 +252,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
} }
// If it's a retweet, save it as a repeat! // If it's a retweet, save it as a repeat!
if (!empty($status->retweeted_status)) { if (!empty($status->retweeted_status)) {
common_log(LOG_INFO, "Status {$status->id} is a retweet of {$status->retweeted_status->id}."); common_log(LOG_INFO, "Status {$status->id} is a retweet of {$status->retweeted_status->id}.");
$original = $this->saveStatus($status->retweeted_status); $original = $this->saveStatus($status->retweeted_status);
@ -273,7 +261,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$author = $original->getProfile(); $author = $original->getProfile();
// TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'. // TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'.
// TRANS: %1$s is the repeated user's name, %2$s is the repeated notice. // TRANS: %1$s is the repeated user's name, %2$s is the repeated notice.
$content = sprintf(_('RT @%1$s %2$s'), $content = sprintf(_m('RT @%1$s %2$s'),
$author->nickname, $author->nickname,
$original->content); $original->content);
@ -365,7 +353,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
* *
* @return string URI * @return string URI
*/ */
function makeStatusURI($username, $id) function makeStatusURI($username, $id)
{ {
return 'http://twitter.com/' return 'http://twitter.com/'
@ -383,7 +370,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
* *
* @return mixed value the first Profile with that url, or null * @return mixed value the first Profile with that url, or null
*/ */
function getProfileByUrl($nickname, $profileurl) function getProfileByUrl($nickname, $profileurl)
{ {
$profile = new Profile(); $profile = new Profile();
@ -407,7 +393,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
* *
* @return mixed value a matching Notice or null * @return mixed value a matching Notice or null
*/ */
function checkDupe($profile, $statusUri) function checkDupe($profile, $statusUri)
{ {
$notice = new Notice(); $notice = new Notice();
@ -426,7 +411,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
function ensureProfile($user) function ensureProfile($user)
{ {
// check to see if there's already a profile for this user // check to see if there's already a profile for this user
$profileurl = 'http://twitter.com/' . $user->screen_name; $profileurl = 'http://twitter.com/' . $user->screen_name;
$profile = $this->getProfileByUrl($user->screen_name, $profileurl); $profile = $this->getProfileByUrl($user->screen_name, $profileurl);
@ -440,7 +424,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
return $profile; return $profile;
} else { } else {
common_debug($this->name() . ' - Adding profile and remote profile ' . common_debug($this->name() . ' - Adding profile and remote profile ' .
"for Twitter user: $profileurl."); "for Twitter user: $profileurl.");
@ -472,7 +455,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$remote_pro = Remote_profile::staticGet('uri', $profileurl); $remote_pro = Remote_profile::staticGet('uri', $profileurl);
if (empty($remote_pro)) { if (empty($remote_pro)) {
$remote_pro = new Remote_profile(); $remote_pro = new Remote_profile();
$remote_pro->id = $id; $remote_pro->id = $id;
@ -619,7 +601,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$avatar = $profile->getAvatar($sizes[$size]); $avatar = $profile->getAvatar($sizes[$size]);
// Delete the avatar, if present // Delete the avatar, if present
if ($avatar) { if ($avatar) {
$avatar->delete(); $avatar->delete();
} }
@ -644,10 +625,8 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$avatar->height = 48; $avatar->height = 48;
break; break;
default: default:
// Note: Twitter's big avatars are a different size than // Note: Twitter's big avatars are a different size than
// StatusNet's (StatusNet's = 96) // StatusNet's (StatusNet's = 96)
$avatar->width = 73; $avatar->width = 73;
$avatar->height = 73; $avatar->height = 73;
} }
@ -822,4 +801,3 @@ if (have_option('d') || have_option('debug')) {
$fetcher = new TwitterStatusFetcher($id, 60, 2, $debug); $fetcher = new TwitterStatusFetcher($id, 60, 2, $debug);
$fetcher->runOnce(); $fetcher->runOnce();

View File

@ -69,7 +69,6 @@ function save_twitter_user($twitter_id, $screen_name)
{ {
// Check to see whether the Twitter user is already in the system, // Check to see whether the Twitter user is already in the system,
// and update its screen name and uri if so. // and update its screen name and uri if so.
$fuser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE); $fuser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE);
if (!empty($fuser)) { if (!empty($fuser)) {
@ -87,9 +86,7 @@ function save_twitter_user($twitter_id, $screen_name)
} }
} else { } else {
// Kill any old, invalid records for this screen name // Kill any old, invalid records for this screen name
$fuser = Foreign_user::getByNickname($screen_name, TWITTER_SERVICE); $fuser = Foreign_user::getByNickname($screen_name, TWITTER_SERVICE);
if (!empty($fuser)) { if (!empty($fuser)) {
@ -110,13 +107,11 @@ function save_twitter_user($twitter_id, $screen_name)
} }
function is_twitter_bound($notice, $flink) { function is_twitter_bound($notice, $flink) {
// Check to see if notice should go to Twitter // Check to see if notice should go to Twitter
if (!empty($flink) && ($flink->noticesync & FOREIGN_NOTICE_SEND)) { if (!empty($flink) && ($flink->noticesync & FOREIGN_NOTICE_SEND)) {
// If it's not a Twitter-style reply, or if the user WANTS to send replies, // If it's not a Twitter-style reply, or if the user WANTS to send replies,
// or if it's in reply to a twitter notice // or if it's in reply to a twitter notice
if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) || if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) ||
($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) || ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) ||
is_twitter_notice($notice->reply_to)) { is_twitter_notice($notice->reply_to)) {
@ -242,7 +237,6 @@ function broadcast_oauth($notice, $flink) {
} }
// Notice crossed the great divide // Notice crossed the great divide
$msg = sprintf('Twitter bridge - posted notice %d to Twitter using ' . $msg = sprintf('Twitter bridge - posted notice %d to Twitter using ' .
'OAuth for User %s (user id %d).', 'OAuth for User %s (user id %d).',
$notice->id, $notice->id,
@ -378,4 +372,3 @@ function mail_twitter_bridge_removed($user)
common_switch_locale(); common_switch_locale();
return mail_to_user($user, $subject, $body); return mail_to_user($user, $subject, $body);
} }

View File

@ -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 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class TwitteradminpanelAction extends AdminPanelAction class TwitteradminpanelAction extends AdminPanelAction
{ {
/** /**
@ -48,7 +47,6 @@ class TwitteradminpanelAction extends AdminPanelAction
* *
* @return string page title * @return string page title
*/ */
function title() function title()
{ {
return _m('Twitter'); return _m('Twitter');
@ -59,7 +57,6 @@ class TwitteradminpanelAction extends AdminPanelAction
* *
* @return string instructions * @return string instructions
*/ */
function getInstructions() function getInstructions()
{ {
return _m('Twitter bridge settings'); return _m('Twitter bridge settings');
@ -70,7 +67,6 @@ class TwitteradminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function showForm() function showForm()
{ {
$form = new TwitterAdminPanelForm($this); $form = new TwitterAdminPanelForm($this);
@ -83,7 +79,6 @@ class TwitteradminpanelAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function saveSettings() function saveSettings()
{ {
static $settings = array( static $settings = array(
@ -173,7 +168,6 @@ class TwitterAdminPanelForm extends AdminForm
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'twitteradminpanel'; return 'twitteradminpanel';
@ -184,7 +178,6 @@ class TwitterAdminPanelForm extends AdminForm
* *
* @return string class of the form * @return string class of the form
*/ */
function formClass() function formClass()
{ {
return 'form_settings'; return 'form_settings';
@ -195,7 +188,6 @@ class TwitterAdminPanelForm extends AdminForm
* *
* @return string URL of the action * @return string URL of the action
*/ */
function action() function action()
{ {
return common_local_url('twitteradminpanel'); return common_local_url('twitteradminpanel');
@ -206,7 +198,6 @@ class TwitterAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formData() function formData()
{ {
$this->out->elementStart( $this->out->elementStart(
@ -239,7 +230,7 @@ class TwitterAdminPanelForm extends AdminForm
if (!empty($globalConsumerKey) && !empty($globalConsumerSec)) { if (!empty($globalConsumerKey) && !empty($globalConsumerSec)) {
$this->li(); $this->li();
$this->out->element('p', 'form_guide', _('Note: a global consumer key and secret are set.')); $this->out->element('p', 'form_guide', _m('Note: a global consumer key and secret are set.'));
$this->unli(); $this->unli();
} }
@ -292,9 +283,8 @@ class TwitterAdminPanelForm extends AdminForm
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Save'), 'submit', null, _('Save Twitter settings')); $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Twitter settings'));
} }
} }

View File

@ -117,13 +117,13 @@ class TwitterauthorizationAction extends Action
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
$this->showForm(_('There was a problem with your session token. Try again, please.')); $this->showForm(_m('There was a problem with your session token. Try again, please.'));
return; return;
} }
if ($this->arg('create')) { if ($this->arg('create')) {
if (!$this->boolean('license')) { if (!$this->boolean('license')) {
$this->showForm(_('You can\'t register if you don\'t agree to the license.'), $this->showForm(_m('You can\'t register if you don\'t agree to the license.'),
$this->trimmed('newname')); $this->trimmed('newname'));
return; return;
} }
@ -132,7 +132,7 @@ class TwitterauthorizationAction extends Action
$this->connectNewUser(); $this->connectNewUser();
} else { } else {
common_debug('Twitter bridge - ' . print_r($this->args, true)); common_debug('Twitter bridge - ' . print_r($this->args, true));
$this->showForm(_('Something weird happened.'), $this->showForm(_m('Something weird happened.'),
$this->trimmed('newname')); $this->trimmed('newname'));
} }
} else { } else {
@ -231,7 +231,6 @@ class TwitterauthorizationAction extends Action
} }
if (common_logged_in()) { if (common_logged_in()) {
// Save the access token and Twitter user info // Save the access token and Twitter user info
$user = common_current_user(); $user = common_current_user();
@ -298,7 +297,7 @@ class TwitterauthorizationAction extends Action
if (empty($flink_id)) { if (empty($flink_id)) {
common_log_db_error($flink, 'INSERT', __FILE__); common_log_db_error($flink, 'INSERT', __FILE__);
$this->serverError(_('Couldn\'t link your Twitter account.')); $this->serverError(_m('Couldn\'t link your Twitter account.'));
} }
return $flink_id; return $flink_id;
@ -310,13 +309,13 @@ class TwitterauthorizationAction extends Action
$this->element('div', array('class' => 'error'), $this->error); $this->element('div', array('class' => 'error'), $this->error);
} else { } else {
$this->element('div', 'instructions', $this->element('div', 'instructions',
sprintf(_('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'))); 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')));
} }
} }
function title() function title()
{ {
return _('Twitter Account Setup'); return _m('Twitter Account Setup');
} }
function showForm($error=null, $username=null) function showForm($error=null, $username=null)
@ -349,7 +348,7 @@ class TwitterauthorizationAction extends Action
'class' => 'form_settings', 'class' => 'form_settings',
'action' => common_local_url('twitterauthorization'))); 'action' => common_local_url('twitterauthorization')));
$this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options')); $this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options'));
$this->element('legend', null, _('Connection options')); $this->element('legend', null, _m('Connection options'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->element('input', array('type' => 'checkbox', $this->element('input', array('type' => 'checkbox',
@ -358,7 +357,7 @@ class TwitterauthorizationAction extends Action
'name' => 'license', 'name' => 'license',
'value' => 'true')); 'value' => 'true'));
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
$message = _('My text and files are available under %s ' . $message = _m('My text and files are available under %s ' .
'except this private data: password, ' . 'except this private data: password, ' .
'email address, IM address, and phone number.'); 'email address, IM address, and phone number.');
$link = '<a href="' . $link = '<a href="' .
@ -379,33 +378,33 @@ class TwitterauthorizationAction extends Action
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->element('legend', null, $this->element('legend', null,
_('Create new account')); _m('Create new account'));
$this->element('p', null, $this->element('p', null,
_('Create a new user with this nickname.')); _m('Create a new user with this nickname.'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('newname', _('New nickname'), $this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '', ($this->username) ? $this->username : '',
_('1-64 lowercase letters or numbers, no punctuation or spaces')); _m('1-64 lowercase letters or numbers, no punctuation or spaces'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('create', _('Create')); $this->submit('create', _m('Create'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->element('legend', null, $this->element('legend', null,
_('Connect existing account')); _m('Connect existing account'));
$this->element('p', null, $this->element('p', null,
_('If you already have an account, login with your username and password to connect it to your Twitter account.')); _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('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('nickname', _('Existing nickname')); $this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->password('password', _('Password')); $this->password('password', _m('Password'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('connect', _('Connect')); $this->submit('connect', _m('Connect'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -421,7 +420,7 @@ class TwitterauthorizationAction extends Action
function createNewUser() function createNewUser()
{ {
if (common_config('site', 'closed')) { if (common_config('site', 'closed')) {
$this->clientError(_('Registration not allowed.')); $this->clientError(_m('Registration not allowed.'));
return; return;
} }
@ -430,14 +429,14 @@ class TwitterauthorizationAction extends Action
if (common_config('site', 'inviteonly')) { if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode']; $code = $_SESSION['invitecode'];
if (empty($code)) { if (empty($code)) {
$this->clientError(_('Registration not allowed.')); $this->clientError(_m('Registration not allowed.'));
return; return;
} }
$invite = Invitation::staticGet($code); $invite = Invitation::staticGet($code);
if (empty($invite)) { if (empty($invite)) {
$this->clientError(_('Not a valid invitation code.')); $this->clientError(_m('Not a valid invitation code.'));
return; return;
} }
} }
@ -447,17 +446,17 @@ class TwitterauthorizationAction extends Action
if (!Validate::string($nickname, array('min_length' => 1, if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64, 'max_length' => 64,
'format' => NICKNAME_FMT))) { 'format' => NICKNAME_FMT))) {
$this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.')); $this->showForm(_m('Nickname must have only lowercase letters and numbers and no spaces.'));
return; return;
} }
if (!User::allowed_nickname($nickname)) { if (!User::allowed_nickname($nickname)) {
$this->showForm(_('Nickname not allowed.')); $this->showForm(_m('Nickname not allowed.'));
return; return;
} }
if (User::staticGet('nickname', $nickname)) { if (User::staticGet('nickname', $nickname)) {
$this->showForm(_('Nickname already in use. Try another one.')); $this->showForm(_m('Nickname already in use. Try another one.'));
return; return;
} }
@ -472,7 +471,7 @@ class TwitterauthorizationAction extends Action
$user = User::register($args); $user = User::register($args);
if (empty($user)) { if (empty($user)) {
$this->serverError(_('Error registering user.')); $this->serverError(_m('Error registering user.'));
return; return;
} }
@ -483,7 +482,7 @@ class TwitterauthorizationAction extends Action
save_twitter_user($this->twuid, $this->tw_fields['screen_name']); save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) { if (!$result) {
$this->serverError(_('Error connecting user to Twitter.')); $this->serverError(_m('Error connecting user to Twitter.'));
return; return;
} }
@ -503,7 +502,7 @@ class TwitterauthorizationAction extends Action
$password = $this->trimmed('password'); $password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) { if (!common_check_user($nickname, $password)) {
$this->showForm(_('Invalid username or password.')); $this->showForm(_m('Invalid username or password.'));
return; return;
} }
@ -521,7 +520,7 @@ class TwitterauthorizationAction extends Action
save_twitter_user($this->twuid, $this->tw_fields['screen_name']); save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) { if (!$result) {
$this->serverError(_('Error connecting user to Twitter.')); $this->serverError(_m('Error connecting user to Twitter.'));
return; return;
} }
@ -541,7 +540,7 @@ class TwitterauthorizationAction extends Action
$result = $this->flinkUser($user->id, $this->twuid); $result = $this->flinkUser($user->id, $this->twuid);
if (empty($result)) { if (empty($result)) {
$this->serverError(_('Error connecting user to Twitter.')); $this->serverError(_m('Error connecting user to Twitter.'));
return; return;
} }

View File

@ -46,7 +46,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
* *
* @see SettingsAction * @see SettingsAction
*/ */
class TwitterloginAction extends Action class TwitterloginAction extends Action
{ {
function handle($args) function handle($args)
@ -54,7 +53,7 @@ class TwitterloginAction extends Action
parent::handle($args); parent::handle($args);
if (common_is_real_login()) { if (common_is_real_login()) {
$this->clientError(_('Already logged in.')); $this->clientError(_m('Already logged in.'));
} }
$this->showPage(); $this->showPage();
@ -62,12 +61,12 @@ class TwitterloginAction extends Action
function title() function title()
{ {
return _('Twitter Login'); return _m('Twitter Login');
} }
function getInstructions() function getInstructions()
{ {
return _('Login with your Twitter account'); return _m('Login with your Twitter account');
} }
function showPageNotice() function showPageNotice()
@ -85,7 +84,7 @@ class TwitterloginAction extends Action
null, null,
array('signin' => true)))); array('signin' => true))));
$this->element('img', array('src' => common_path('plugins/TwitterBridge/Sign-in-with-Twitter-lighter.png'), $this->element('img', array('src' => common_path('plugins/TwitterBridge/Sign-in-with-Twitter-lighter.png'),
'alt' => 'Sign in with Twitter')); 'alt' => _m('Sign in with Twitter')));
$this->elementEnd('a'); $this->elementEnd('a');
} }

View File

@ -200,7 +200,6 @@ class TwitterOAuthClient extends OAuthClient
function statusesHomeTimeline($since_id = null, $max_id = null, function statusesHomeTimeline($since_id = null, $max_id = null,
$cnt = null, $page = null) $cnt = null, $page = null)
{ {
$url = 'https://twitter.com/statuses/home_timeline.json'; $url = 'https://twitter.com/statuses/home_timeline.json';
$params = array('include_entities' => 'true'); $params = array('include_entities' => 'true');

View File

@ -45,7 +45,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
* *
* @see SettingsAction * @see SettingsAction
*/ */
class TwittersettingsAction extends ConnectSettingsAction class TwittersettingsAction extends ConnectSettingsAction
{ {
/** /**
@ -79,7 +78,6 @@ class TwittersettingsAction extends ConnectSettingsAction
* *
* @return void * @return void
*/ */
function showContent() function showContent()
{ {
@ -139,7 +137,7 @@ class TwittersettingsAction extends ConnectSettingsAction
$this->text(_m(' first.')); $this->text(_m(' first.'));
$this->elementEnd('p'); $this->elementEnd('p');
} else { } else {
// TRANS: %1$s is the current website name.
$note = _m('Keep your %1$s account but disconnect from Twitter. ' . $note = _m('Keep your %1$s account but disconnect from Twitter. ' .
'You can use your %1$s password to log in.'); 'You can use your %1$s password to log in.');
@ -219,7 +217,6 @@ class TwittersettingsAction extends ConnectSettingsAction
* *
* @return void * @return void
*/ */
function handlePost() function handlePost()
{ {
// CSRF protection // CSRF protection
@ -244,7 +241,6 @@ class TwittersettingsAction extends ConnectSettingsAction
* *
* @return void * @return void
*/ */
function removeTwitterAccount() function removeTwitterAccount()
{ {
$user = common_current_user(); $user = common_current_user();
@ -266,7 +262,6 @@ class TwittersettingsAction extends ConnectSettingsAction
* *
* @return void * @return void
*/ */
function savePreferences() function savePreferences()
{ {
$noticesend = $this->boolean('noticesend'); $noticesend = $this->boolean('noticesend');
@ -295,5 +290,4 @@ class TwittersettingsAction extends ConnectSettingsAction
$this->showForm(_m('Twitter preferences saved.'), true); $this->showForm(_m('Twitter preferences saved.'), true);
} }
} }