summaryrefslogtreecommitdiff
path: root/plugins/TwitterBridge
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TwitterBridge')
-rw-r--r--plugins/TwitterBridge/TwitterBridgePlugin.php14
-rw-r--r--plugins/TwitterBridge/Twitter_synch_status.php10
-rwxr-xr-xplugins/TwitterBridge/daemons/synctwitterfriends.php7
-rwxr-xr-xplugins/TwitterBridge/daemons/twitterstatusfetcher.php24
-rw-r--r--plugins/TwitterBridge/locale/TwitterBridge.pot255
-rw-r--r--plugins/TwitterBridge/twitter.php20
-rw-r--r--plugins/TwitterBridge/twitteradminpanel.php14
-rw-r--r--plugins/TwitterBridge/twitterauthorization.php59
-rw-r--r--plugins/TwitterBridge/twitterlogin.php9
-rw-r--r--plugins/TwitterBridge/twitteroauthclient.php1
-rw-r--r--plugins/TwitterBridge/twittersettings.php11
11 files changed, 241 insertions, 183 deletions
diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php
index 34b82ef83..097d4486f 100644
--- a/plugins/TwitterBridge/TwitterBridgePlugin.php
+++ b/plugins/TwitterBridge/TwitterBridgePlugin.php
@@ -45,17 +45,14 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
* @link http://status.net/
* @link http://twitter.com/
*/
-
class TwitterBridgePlugin extends Plugin
{
-
const VERSION = STATUSNET_VERSION;
public $adminImportControl = false; // Should the 'import' checkbox be exposed in the admin panel?
/**
* Initializer for the plugin.
*/
-
function initialize()
{
// Allow the key and secret to be passed in
@@ -86,7 +83,6 @@ class TwitterBridgePlugin extends Plugin
*
* @return boolean result
*/
-
static function hasKeys()
{
$ckey = common_config('twitter', 'consumer_key');
@@ -113,7 +109,6 @@ class TwitterBridgePlugin extends Plugin
*
* @return boolean hook return
*/
-
function onRouterInitialized($m)
{
$m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
@@ -310,7 +305,6 @@ class TwitterBridgePlugin extends Plugin
*
* @return boolean hook value
*/
-
function onPluginVersion(&$versions)
{
$versions[] = array(
@@ -319,8 +313,8 @@ class TwitterBridgePlugin extends Plugin
'author' => 'Zach Copley, Julien C',
'homepage' => 'http://status.net/wiki/Plugin:TwitterBridge',
'rawdescription' => _m(
- 'The Twitter "bridge" plugin allows you to integrate ' .
- 'your StatusNet instance with ' .
+ 'The Twitter "bridge" plugin allows integration ' .
+ 'of a StatusNet instance with ' .
'<a href="http://twitter.com/">Twitter</a>.'
)
);
@@ -374,7 +368,6 @@ class TwitterBridgePlugin extends Plugin
*
* @return boolean hook value; true means continue processing, false means stop.
*/
-
function onCheckSchema()
{
$schema = Schema::get();
@@ -416,7 +409,6 @@ class TwitterBridgePlugin extends Plugin
*
* @return boolean hook value
*/
-
function onStartDeleteOwnNotice(User $user, Notice $notice)
{
$n2s = Notice_to_status::staticGet('notice_id', $notice->id);
@@ -452,7 +444,6 @@ class TwitterBridgePlugin extends Plugin
* @param Notice $notice being favored
* @return hook return value
*/
-
function onEndFavorNotice(Profile $profile, Notice $notice)
{
$flink = Foreign_link::getByUserID($profile->id,
@@ -489,7 +480,6 @@ class TwitterBridgePlugin extends Plugin
*
* @return hook return value
*/
-
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
$flink = Foreign_link::getByUserID($profile->id,
diff --git a/plugins/TwitterBridge/Twitter_synch_status.php b/plugins/TwitterBridge/Twitter_synch_status.php
index 2a5f1fd60..a8337862c 100644
--- a/plugins/TwitterBridge/Twitter_synch_status.php
+++ b/plugins/TwitterBridge/Twitter_synch_status.php
@@ -48,7 +48,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
*
* @see DB_DataObject
*/
-
class Twitter_synch_status extends Memcached_DataObject
{
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
*
*/
-
function staticGet($k, $v=null)
{
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
*
*/
-
function pkeyGet($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
*/
-
function table()
{
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
*/
-
function keys()
{
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;
* 'U' for unique keys: compound keys are not well supported here.
*/
-
function keyTypes()
{
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.
*/
-
function sequenceKey()
{
return array(false, false, false);
@@ -174,7 +167,6 @@ class Twitter_synch_status extends Memcached_DataObject
'timeline' => $timeline));
if (empty($tss)) {
-
$tss = new Twitter_synch_status();
$tss->foreign_id = $foreign_id;
@@ -186,9 +178,7 @@ class Twitter_synch_status extends Memcached_DataObject
$tss->insert();
return true;
-
} else {
-
$orig = clone($tss);
$tss->last_id = $last_id;
diff --git a/plugins/TwitterBridge/daemons/synctwitterfriends.php b/plugins/TwitterBridge/daemons/synctwitterfriends.php
index 02546a02c..38a8b89eb 100755
--- a/plugins/TwitterBridge/daemons/synctwitterfriends.php
+++ b/plugins/TwitterBridge/daemons/synctwitterfriends.php
@@ -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
* @link http://status.net/
*/
-
class SyncTwitterFriendsDaemon extends ParallelizingDaemon
{
/**
@@ -59,7 +58,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
* @return void
*
**/
-
function __construct($id = null, $interval = 60,
$max_children = 2, $debug = null)
{
@@ -71,7 +69,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
*
* @return string Name of the daemon.
*/
-
function name()
{
return ('synctwitterfriends.' . $this->_id);
@@ -110,12 +107,10 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
}
function childTask($flink) {
-
// Each child ps needs its own DB connection
// Note: DataObject::getDatabaseConnection() creates
// a new connection if there isn't one already
-
$conn = &$flink->getDatabaseConnection();
$this->subscribeTwitterFriends($flink);
@@ -127,7 +122,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
// XXX: Couldn't find a less brutal way to blow
// away a cached connection
-
global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']);
}
@@ -277,4 +271,3 @@ if (have_option('d') || have_option('debug')) {
$syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug);
$syncer->runOnce();
-
diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
index 181be3dcf..590fa2954 100755
--- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
+++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
@@ -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
* @link http://status.net/
*/
-
class TwitterStatusFetcher extends ParallelizingDaemon
{
/**
@@ -87,7 +86,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return string Name of the daemon.
*/
-
function name()
{
return ('twitterstatusfetcher.'.$this->_id);
@@ -99,7 +97,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return array flinks an array of Foreign_link objects
*/
-
function getObjects()
{
global $_DB_DATAOBJECT;
@@ -133,12 +130,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon
}
function childTask($flink) {
-
// Each child ps needs its own DB connection
// Note: DataObject::getDatabaseConnection() creates
// a new connection if there isn't one already
-
$conn = &$flink->getDatabaseConnection();
$this->getTimeline($flink);
@@ -150,7 +145,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// XXX: Couldn't find a less brutal way to blow
// away a cached connection
-
global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']);
}
@@ -201,9 +195,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// Reverse to preserve order
foreach (array_reverse($timeline) as $status) {
-
// Hacktastic: filter out stuff coming from this StatusNet
-
$source = mb_strtolower(common_config('integration', '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
// FIXME: save it but treat it as private
-
if ($status->user->protected) {
continue;
}
@@ -232,7 +223,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
}
// Okay, record the time we synced with Twitter for posterity
-
$flink->last_noticesync = common_sql_now();
$flink->update();
}
@@ -250,7 +240,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$statusUri = $this->makeStatusURI($status->user->screen_name, $status->id);
// check to see if we've already imported the status
-
$n2s = Notice_to_status::staticGet('status_id', $status->id);
if (!empty($n2s)) {
@@ -263,7 +252,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
}
// If it's a retweet, save it as a repeat!
-
if (!empty($status->retweeted_status)) {
common_log(LOG_INFO, "Status {$status->id} is a retweet of {$status->retweeted_status->id}.");
$original = $this->saveStatus($status->retweeted_status);
@@ -273,7 +261,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$author = $original->getProfile();
// 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.
- $content = sprintf(_('RT @%1$s %2$s'),
+ $content = sprintf(_m('RT @%1$s %2$s'),
$author->nickname,
$original->content);
@@ -365,7 +353,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return string URI
*/
-
function makeStatusURI($username, $id)
{
return 'http://twitter.com/'
@@ -383,7 +370,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return mixed value the first Profile with that url, or null
*/
-
function getProfileByUrl($nickname, $profileurl)
{
$profile = new Profile();
@@ -407,7 +393,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return mixed value a matching Notice or null
*/
-
function checkDupe($profile, $statusUri)
{
$notice = new Notice();
@@ -426,7 +411,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
function ensureProfile($user)
{
// check to see if there's already a profile for this user
-
$profileurl = 'http://twitter.com/' . $user->screen_name;
$profile = $this->getProfileByUrl($user->screen_name, $profileurl);
@@ -440,7 +424,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
return $profile;
} else {
-
common_debug($this->name() . ' - Adding profile and remote profile ' .
"for Twitter user: $profileurl.");
@@ -472,7 +455,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$remote_pro = Remote_profile::staticGet('uri', $profileurl);
if (empty($remote_pro)) {
-
$remote_pro = new Remote_profile();
$remote_pro->id = $id;
@@ -619,7 +601,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$avatar = $profile->getAvatar($sizes[$size]);
// Delete the avatar, if present
-
if ($avatar) {
$avatar->delete();
}
@@ -644,10 +625,8 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$avatar->height = 48;
break;
default:
-
// Note: Twitter's big avatars are a different size than
// StatusNet's (StatusNet's = 96)
-
$avatar->width = 73;
$avatar->height = 73;
}
@@ -840,4 +819,3 @@ if (have_option('d') || have_option('debug')) {
$fetcher = new TwitterStatusFetcher($id, 60, 2, $debug);
$fetcher->runOnce();
-
diff --git a/plugins/TwitterBridge/locale/TwitterBridge.pot b/plugins/TwitterBridge/locale/TwitterBridge.pot
index b5f906174..5a75bc5f8 100644
--- a/plugins/TwitterBridge/locale/TwitterBridge.pot
+++ b/plugins/TwitterBridge/locale/TwitterBridge.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-09-14 22:56+0000\n"
+"POT-Creation-Date: 2010-09-19 15:29+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,16 +16,16 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: twitter.php:363
+#: twitter.php:350
msgid "Your Twitter bridge has been disabled."
msgstr ""
-#: twitter.php:367
+#: twitter.php:354
#, php-format
msgid ""
"Hi, %1$s. We're sorry to inform you that your link to Twitter has been "
"disabled. We no longer seem to have permission to update your Twitter "
-"status. (Did you revoke %3$s's access?)\n"
+"status. Did you maybe revoke %3$s's access?\n"
"\n"
"You can re-enable your Twitter bridge by visiting your Twitter settings "
"page:\n"
@@ -33,95 +33,136 @@ msgid ""
"\t%2$s\n"
"\n"
"Regards,\n"
-"%3$s\n"
+"%3$s"
msgstr ""
-#: TwitterBridgePlugin.php:156 TwitterBridgePlugin.php:179
-#: TwitterBridgePlugin.php:296 twitteradminpanel.php:54
+#: TwitterBridgePlugin.php:151 TwitterBridgePlugin.php:174
+#: TwitterBridgePlugin.php:291 twitteradminpanel.php:52
msgid "Twitter"
msgstr ""
-#: TwitterBridgePlugin.php:157
+#: TwitterBridgePlugin.php:152
msgid "Login or register using Twitter"
msgstr ""
-#: TwitterBridgePlugin.php:180
+#: TwitterBridgePlugin.php:175
msgid "Twitter integration options"
msgstr ""
-#: TwitterBridgePlugin.php:297
+#: TwitterBridgePlugin.php:292
msgid "Twitter bridge configuration"
msgstr ""
-#: TwitterBridgePlugin.php:322
+#: TwitterBridgePlugin.php:316
msgid ""
-"The Twitter \"bridge\" plugin allows you to integrate your StatusNet "
-"instance with <a href=\"http://twitter.com/\">Twitter</a>."
+"The Twitter \"bridge\" plugin allows integration of a StatusNet instance "
+"with <a href=\"http://twitter.com/\">Twitter</a>."
msgstr ""
-#: twitteradminpanel.php:65
+#: twitteradminpanel.php:62
msgid "Twitter bridge settings"
msgstr ""
-#: twitteradminpanel.php:150
+#: twitteradminpanel.php:145
msgid "Invalid consumer key. Max length is 255 characters."
msgstr ""
-#: twitteradminpanel.php:156
+#: twitteradminpanel.php:151
msgid "Invalid consumer secret. Max length is 255 characters."
msgstr ""
-#: twitteradminpanel.php:216
+#: twitteradminpanel.php:207
msgid "Twitter application settings"
msgstr ""
-#: twitteradminpanel.php:222
+#: twitteradminpanel.php:213
msgid "Consumer key"
msgstr ""
-#: twitteradminpanel.php:223
+#: twitteradminpanel.php:214
msgid "Consumer key assigned by Twitter"
msgstr ""
-#: twitteradminpanel.php:231
+#: twitteradminpanel.php:222
msgid "Consumer secret"
msgstr ""
-#: twitteradminpanel.php:232
+#: twitteradminpanel.php:223
msgid "Consumer secret assigned by Twitter"
msgstr ""
-#: twitteradminpanel.php:249
+#: twitteradminpanel.php:233
+msgid "Note: a global consumer key and secret are set."
+msgstr ""
+
+#: twitteradminpanel.php:240
msgid "Integration source"
msgstr ""
-#: twitteradminpanel.php:250
+#: twitteradminpanel.php:241
msgid "Name of your Twitter application"
msgstr ""
-#: twitteradminpanel.php:262
+#: twitteradminpanel.php:253
msgid "Options"
msgstr ""
-#: twitteradminpanel.php:269
+#: twitteradminpanel.php:260
msgid "Enable \"Sign-in with Twitter\""
msgstr ""
-#: twitteradminpanel.php:271
+#: twitteradminpanel.php:262
msgid "Allow users to login with their Twitter credentials"
msgstr ""
-#: twitteradminpanel.php:278
+#: twitteradminpanel.php:269
msgid "Enable Twitter import"
msgstr ""
-#: twitteradminpanel.php:280
+#: twitteradminpanel.php:271
msgid ""
"Allow users to import their Twitter friends' timelines. Requires daemons to "
"be manually configured."
msgstr ""
+#: twitteradminpanel.php:288 twittersettings.php:200
+msgid "Save"
+msgstr ""
+
+#: twitteradminpanel.php:288
+msgid "Save Twitter settings"
+msgstr ""
+
+#: twitterlogin.php:56
+msgid "Already logged in."
+msgstr ""
+
+#: twitterlogin.php:64
+msgid "Twitter Login"
+msgstr ""
+
+#: twitterlogin.php:69
+msgid "Login with your Twitter account"
+msgstr ""
+
+#: twitterlogin.php:87
+msgid "Sign in with Twitter"
+msgstr ""
+
+#: twitterauthorization.php:120 twittersettings.php:226
+msgid "There was a problem with your session token. Try again, please."
+msgstr ""
+
+#: twitterauthorization.php:126
+msgid "You can't register if you don't agree to the license."
+msgstr ""
+
+#: twitterauthorization.php:135
+msgid "Something weird happened."
+msgstr ""
+
#: twitterauthorization.php:181 twitterauthorization.php:229
+#: twitterauthorization.php:300
msgid "Couldn't link your Twitter account."
msgstr ""
@@ -129,99 +170,197 @@ msgstr ""
msgid "Couldn't link your Twitter account: oauth_token mismatch."
msgstr ""
-#: twittersettings.php:59
+#: twitterauthorization.php:312
+#, php-format
+msgid ""
+"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."
+msgstr ""
+
+#: twitterauthorization.php:318
+msgid "Twitter Account Setup"
+msgstr ""
+
+#: twitterauthorization.php:351
+msgid "Connection options"
+msgstr ""
+
+#: twitterauthorization.php:360
+#, php-format
+msgid ""
+"My text and files are available under %s except this private data: password, "
+"email address, IM address, and phone number."
+msgstr ""
+
+#: twitterauthorization.php:381
+msgid "Create new account"
+msgstr ""
+
+#: twitterauthorization.php:383
+msgid "Create a new user with this nickname."
+msgstr ""
+
+#: twitterauthorization.php:386
+msgid "New nickname"
+msgstr ""
+
+#: twitterauthorization.php:388
+msgid "1-64 lowercase letters or numbers, no punctuation or spaces"
+msgstr ""
+
+#: twitterauthorization.php:391
+msgid "Create"
+msgstr ""
+
+#: twitterauthorization.php:396
+msgid "Connect existing account"
+msgstr ""
+
+#: twitterauthorization.php:398
+msgid ""
+"If you already have an account, login with your username and password to "
+"connect it to your Twitter account."
+msgstr ""
+
+#: twitterauthorization.php:401
+msgid "Existing nickname"
+msgstr ""
+
+#: twitterauthorization.php:404
+msgid "Password"
+msgstr ""
+
+#: twitterauthorization.php:407
+msgid "Connect"
+msgstr ""
+
+#: twitterauthorization.php:423 twitterauthorization.php:432
+msgid "Registration not allowed."
+msgstr ""
+
+#: twitterauthorization.php:439
+msgid "Not a valid invitation code."
+msgstr ""
+
+#: twitterauthorization.php:449
+msgid "Nickname must have only lowercase letters and numbers and no spaces."
+msgstr ""
+
+#: twitterauthorization.php:454
+msgid "Nickname not allowed."
+msgstr ""
+
+#: twitterauthorization.php:459
+msgid "Nickname already in use. Try another one."
+msgstr ""
+
+#: twitterauthorization.php:474
+msgid "Error registering user."
+msgstr ""
+
+#: twitterauthorization.php:485 twitterauthorization.php:523
+#: twitterauthorization.php:543
+msgid "Error connecting user to Twitter."
+msgstr ""
+
+#: twitterauthorization.php:505
+msgid "Invalid username or password."
+msgstr ""
+
+#: twittersettings.php:58
msgid "Twitter settings"
msgstr ""
-#: twittersettings.php:70
+#: twittersettings.php:69
msgid ""
"Connect your Twitter account to share your updates with your Twitter friends "
"and vice-versa."
msgstr ""
-#: twittersettings.php:118
+#: twittersettings.php:116
msgid "Twitter account"
msgstr ""
-#: twittersettings.php:123
+#: twittersettings.php:121
msgid "Connected Twitter account"
msgstr ""
-#: twittersettings.php:128
+#: twittersettings.php:126
msgid "Disconnect my account from Twitter"
msgstr ""
-#: twittersettings.php:133
+#: twittersettings.php:132
msgid "Disconnecting your Twitter could make it impossible to log in! Please "
msgstr ""
-#: twittersettings.php:137
+#: twittersettings.php:136
msgid "set a password"
msgstr ""
-#: twittersettings.php:139
+#: twittersettings.php:138
msgid " first."
msgstr ""
-#: twittersettings.php:143
+#. TRANS: %1$s is the current website name.
+#: twittersettings.php:142
#, php-format
msgid ""
"Keep your %1$s account but disconnect from Twitter. You can use your %1$s "
"password to log in."
msgstr ""
-#: twittersettings.php:151
+#: twittersettings.php:150
msgid "Disconnect"
msgstr ""
-#: twittersettings.php:158
+#: twittersettings.php:157
msgid "Preferences"
msgstr ""
-#: twittersettings.php:162
+#: twittersettings.php:161
msgid "Automatically send my notices to Twitter."
msgstr ""
-#: twittersettings.php:169
+#: twittersettings.php:168
msgid "Send local \"@\" replies to Twitter."
msgstr ""
-#: twittersettings.php:176
+#: twittersettings.php:175
msgid "Subscribe to my Twitter friends here."
msgstr ""
-#: twittersettings.php:185
-msgid "Import my Friends Timeline."
-msgstr ""
-
-#: twittersettings.php:201
-msgid "Save"
+#: twittersettings.php:184
+msgid "Import my friends timeline."
msgstr ""
-#: twittersettings.php:203
+#: twittersettings.php:202
msgid "Add"
msgstr ""
-#: twittersettings.php:228
-msgid "There was a problem with your session token. Try again, please."
-msgstr ""
-
-#: twittersettings.php:238
+#: twittersettings.php:236
msgid "Unexpected form submission."
msgstr ""
-#: twittersettings.php:257
+#: twittersettings.php:254
msgid "Couldn't remove Twitter user."
msgstr ""
-#: twittersettings.php:261
+#: twittersettings.php:258
msgid "Twitter account disconnected."
msgstr ""
-#: twittersettings.php:282 twittersettings.php:292
+#: twittersettings.php:278 twittersettings.php:288
msgid "Couldn't save Twitter preferences."
msgstr ""
-#: twittersettings.php:296
+#: twittersettings.php:292
msgid "Twitter preferences saved."
msgstr ""
+
+#. 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.
+#: daemons/twitterstatusfetcher.php:264
+#, php-format
+msgid "RT @%1$s %2$s"
+msgstr ""
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index 90b0f0f14..f913e4aea 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -30,7 +30,6 @@ function add_twitter_user($twitter_id, $screen_name)
// Clear out any bad old foreign_users with the new user's legit URL
// This can happen when users move around or fakester accounts get
// repoed, and things like that.
-
$luser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE);
if (!empty($luser)) {
@@ -69,7 +68,6 @@ function save_twitter_user($twitter_id, $screen_name)
{
// Check to see whether the Twitter user is already in the system,
// and update its screen name and uri if so.
-
$fuser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE);
if (!empty($fuser)) {
@@ -87,9 +85,7 @@ function save_twitter_user($twitter_id, $screen_name)
}
} else {
-
// Kill any old, invalid records for this screen name
-
$fuser = Foreign_user::getByNickname($screen_name, TWITTER_SERVICE);
if (!empty($fuser)) {
@@ -110,13 +106,11 @@ function save_twitter_user($twitter_id, $screen_name)
}
function is_twitter_bound($notice, $flink) {
-
// Check to see if notice should go to Twitter
if (!empty($flink) && ($flink->noticesync & FOREIGN_NOTICE_SEND)) {
// 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
-
if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) ||
($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) ||
is_twitter_notice($notice->reply_to)) {
@@ -140,7 +134,6 @@ function broadcast_twitter($notice)
TWITTER_SERVICE);
// Don't bother with basic auth, since it's no longer allowed
-
if (!empty($flink) && TwitterOAuthClient::isPackedToken($flink->credentials)) {
if (!empty($notice->repeat_of) && is_twitter_notice($notice->repeat_of)) {
$retweet = retweet_notice($flink, Notice::staticGet('id', $notice->repeat_of));
@@ -229,7 +222,6 @@ function broadcast_oauth($notice, $flink) {
// This could represent a failure posting,
// or the Twitter API might just be behaving flakey.
-
$errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' .
'trying to post notice %d for User %s (user id %d).',
$notice->id,
@@ -242,7 +234,6 @@ function broadcast_oauth($notice, $flink) {
}
// Notice crossed the great divide
-
$msg = sprintf('Twitter bridge - posted notice %d to Twitter using ' .
'OAuth for User %s (user id %d).',
$notice->id,
@@ -327,11 +318,9 @@ function remove_twitter_link($flink)
// Notify the user that her Twitter bridge is down
if (isset($user->email)) {
-
$result = mail_twitter_bridge_removed($user);
if (!$result) {
-
$msg = 'Unable to send email to notify ' .
"$user->nickname (user id: $user->id) " .
'that their Twitter bridge link was ' .
@@ -340,7 +329,6 @@ function remove_twitter_link($flink)
common_log(LOG_WARNING, $msg);
}
}
-
}
/**
@@ -353,7 +341,6 @@ function remove_twitter_link($flink)
*
* @return boolean success flag
*/
-
function mail_twitter_bridge_removed($user)
{
$profile = $user->getProfile();
@@ -366,11 +353,11 @@ function mail_twitter_bridge_removed($user)
$body = sprintf(_m('Hi, %1$s. We\'re sorry to inform you that your ' .
'link to Twitter has been disabled. We no longer seem to have ' .
- 'permission to update your Twitter status. (Did you revoke ' .
- '%3$s\'s access?)' . "\n\n" .
+ 'permission to update your Twitter status. Did you maybe revoke ' .
+ '%3$s\'s access?' . "\n\n" .
'You can re-enable your Twitter bridge by visiting your ' .
"Twitter settings page:\n\n\t%2\$s\n\n" .
- "Regards,\n%3\$s\n"),
+ "Regards,\n%3\$s"),
$profile->getBestName(),
common_local_url('twittersettings'),
common_config('site', 'name'));
@@ -378,4 +365,3 @@ function mail_twitter_bridge_removed($user)
common_switch_locale();
return mail_to_user($user, $subject, $body);
}
-
diff --git a/plugins/TwitterBridge/twitteradminpanel.php b/plugins/TwitterBridge/twitteradminpanel.php
index 69f8da078..d05a2c6b3 100644
--- a/plugins/TwitterBridge/twitteradminpanel.php
+++ b/plugins/TwitterBridge/twitteradminpanel.php
@@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class TwitteradminpanelAction extends AdminPanelAction
{
/**
@@ -48,7 +47,6 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return string page title
*/
-
function title()
{
return _m('Twitter');
@@ -59,7 +57,6 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return string instructions
*/
-
function getInstructions()
{
return _m('Twitter bridge settings');
@@ -70,7 +67,6 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return void
*/
-
function showForm()
{
$form = new TwitterAdminPanelForm($this);
@@ -83,7 +79,6 @@ class TwitteradminpanelAction extends AdminPanelAction
*
* @return void
*/
-
function saveSettings()
{
static $settings = array(
@@ -173,7 +168,6 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return int ID of the form
*/
-
function id()
{
return 'twitteradminpanel';
@@ -184,7 +178,6 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_settings';
@@ -195,7 +188,6 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('twitteradminpanel');
@@ -206,7 +198,6 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return void
*/
-
function formData()
{
$this->out->elementStart(
@@ -239,7 +230,7 @@ class TwitterAdminPanelForm extends AdminForm
if (!empty($globalConsumerKey) && !empty($globalConsumerSec)) {
$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();
}
@@ -292,9 +283,8 @@ class TwitterAdminPanelForm extends AdminForm
*
* @return void
*/
-
function formActions()
{
- $this->out->submit('submit', _('Save'), 'submit', null, _('Save Twitter settings'));
+ $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Twitter settings'));
}
}
diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php
index 7a896e168..931a03723 100644
--- a/plugins/TwitterBridge/twitterauthorization.php
+++ b/plugins/TwitterBridge/twitterauthorization.php
@@ -117,13 +117,13 @@ class TwitterauthorizationAction extends Action
$token = $this->trimmed('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;
}
if ($this->arg('create')) {
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'));
return;
}
@@ -132,7 +132,7 @@ class TwitterauthorizationAction extends Action
$this->connectNewUser();
} else {
common_debug('Twitter bridge - ' . print_r($this->args, true));
- $this->showForm(_('Something weird happened.'),
+ $this->showForm(_m('Something weird happened.'),
$this->trimmed('newname'));
}
} else {
@@ -231,7 +231,6 @@ class TwitterauthorizationAction extends Action
}
if (common_logged_in()) {
-
// Save the access token and Twitter user info
$user = common_current_user();
@@ -298,7 +297,7 @@ class TwitterauthorizationAction extends Action
if (empty($flink_id)) {
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;
@@ -310,13 +309,13 @@ class TwitterauthorizationAction extends Action
$this->element('div', array('class' => 'error'), $this->error);
} else {
$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()
{
- return _('Twitter Account Setup');
+ return _m('Twitter Account Setup');
}
function showForm($error=null, $username=null)
@@ -349,7 +348,7 @@ class TwitterauthorizationAction extends Action
'class' => 'form_settings',
'action' => common_local_url('twitterauthorization')));
$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('li');
$this->element('input', array('type' => 'checkbox',
@@ -358,7 +357,7 @@ class TwitterauthorizationAction extends Action
'name' => 'license',
'value' => 'true'));
$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, ' .
'email address, IM address, and phone number.');
$link = '<a href="' .
@@ -379,33 +378,33 @@ class TwitterauthorizationAction extends Action
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
$this->element('legend', null,
- _('Create new account'));
+ _m('Create new account'));
$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('li');
- $this->input('newname', _('New nickname'),
+ $this->input('newname', _m('New nickname'),
($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('ul');
- $this->submit('create', _('Create'));
+ $this->submit('create', _m('Create'));
$this->elementEnd('fieldset');
$this->elementStart('fieldset');
$this->element('legend', null,
- _('Connect existing account'));
+ _m('Connect existing account'));
$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('li');
- $this->input('nickname', _('Existing nickname'));
+ $this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li');
$this->elementStart('li');
- $this->password('password', _('Password'));
+ $this->password('password', _m('Password'));
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('connect', _('Connect'));
+ $this->submit('connect', _m('Connect'));
$this->elementEnd('fieldset');
$this->elementEnd('fieldset');
@@ -421,7 +420,7 @@ class TwitterauthorizationAction extends Action
function createNewUser()
{
if (common_config('site', 'closed')) {
- $this->clientError(_('Registration not allowed.'));
+ $this->clientError(_m('Registration not allowed.'));
return;
}
@@ -430,14 +429,14 @@ class TwitterauthorizationAction extends Action
if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode'];
if (empty($code)) {
- $this->clientError(_('Registration not allowed.'));
+ $this->clientError(_m('Registration not allowed.'));
return;
}
$invite = Invitation::staticGet($code);
if (empty($invite)) {
- $this->clientError(_('Not a valid invitation code.'));
+ $this->clientError(_m('Not a valid invitation code.'));
return;
}
}
@@ -447,17 +446,17 @@ class TwitterauthorizationAction extends Action
if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'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;
}
if (!User::allowed_nickname($nickname)) {
- $this->showForm(_('Nickname not allowed.'));
+ $this->showForm(_m('Nickname not allowed.'));
return;
}
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;
}
@@ -472,7 +471,7 @@ class TwitterauthorizationAction extends Action
$user = User::register($args);
if (empty($user)) {
- $this->serverError(_('Error registering user.'));
+ $this->serverError(_m('Error registering user.'));
return;
}
@@ -483,7 +482,7 @@ class TwitterauthorizationAction extends Action
save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) {
- $this->serverError(_('Error connecting user to Twitter.'));
+ $this->serverError(_m('Error connecting user to Twitter.'));
return;
}
@@ -503,7 +502,7 @@ class TwitterauthorizationAction extends Action
$password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) {
- $this->showForm(_('Invalid username or password.'));
+ $this->showForm(_m('Invalid username or password.'));
return;
}
@@ -521,7 +520,7 @@ class TwitterauthorizationAction extends Action
save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) {
- $this->serverError(_('Error connecting user to Twitter.'));
+ $this->serverError(_m('Error connecting user to Twitter.'));
return;
}
@@ -541,7 +540,7 @@ class TwitterauthorizationAction extends Action
$result = $this->flinkUser($user->id, $this->twuid);
if (empty($result)) {
- $this->serverError(_('Error connecting user to Twitter.'));
+ $this->serverError(_m('Error connecting user to Twitter.'));
return;
}
diff --git a/plugins/TwitterBridge/twitterlogin.php b/plugins/TwitterBridge/twitterlogin.php
index 79421fb27..5b5bfae19 100644
--- a/plugins/TwitterBridge/twitterlogin.php
+++ b/plugins/TwitterBridge/twitterlogin.php
@@ -46,7 +46,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
*
* @see SettingsAction
*/
-
class TwitterloginAction extends Action
{
function handle($args)
@@ -54,7 +53,7 @@ class TwitterloginAction extends Action
parent::handle($args);
if (common_is_real_login()) {
- $this->clientError(_('Already logged in.'));
+ $this->clientError(_m('Already logged in.'));
}
$this->showPage();
@@ -62,12 +61,12 @@ class TwitterloginAction extends Action
function title()
{
- return _('Twitter Login');
+ return _m('Twitter Login');
}
function getInstructions()
{
- return _('Login with your Twitter account');
+ return _m('Login with your Twitter account');
}
function showPageNotice()
@@ -85,7 +84,7 @@ class TwitterloginAction extends Action
null,
array('signin' => true))));
$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');
}
diff --git a/plugins/TwitterBridge/twitteroauthclient.php b/plugins/TwitterBridge/twitteroauthclient.php
index 876e30425..345510a0d 100644
--- a/plugins/TwitterBridge/twitteroauthclient.php
+++ b/plugins/TwitterBridge/twitteroauthclient.php
@@ -200,7 +200,6 @@ class TwitterOAuthClient extends OAuthClient
function statusesHomeTimeline($since_id = null, $max_id = null,
$cnt = null, $page = null)
{
-
$url = 'https://twitter.com/statuses/home_timeline.json';
$params = array('include_entities' => 'true');
diff --git a/plugins/TwitterBridge/twittersettings.php b/plugins/TwitterBridge/twittersettings.php
index 631b29f52..dab8ab34f 100644
--- a/plugins/TwitterBridge/twittersettings.php
+++ b/plugins/TwitterBridge/twittersettings.php
@@ -45,7 +45,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
*
* @see SettingsAction
*/
-
class TwittersettingsAction extends ConnectSettingsAction
{
/**
@@ -79,7 +78,6 @@ class TwittersettingsAction extends ConnectSettingsAction
*
* @return void
*/
-
function showContent()
{
@@ -130,6 +128,7 @@ class TwittersettingsAction extends ConnectSettingsAction
if (!$user->password) {
$this->elementStart('p', array('class' => 'form_guide'));
+ // @todo FIXME: Bad i18n (patchwork in three parts).
$this->text(_m('Disconnecting your Twitter ' .
'could make it impossible to log in! Please '));
$this->element('a',
@@ -139,7 +138,7 @@ class TwittersettingsAction extends ConnectSettingsAction
$this->text(_m(' first.'));
$this->elementEnd('p');
} else {
-
+ // TRANS: %1$s is the current website name.
$note = _m('Keep your %1$s account but disconnect from Twitter. ' .
'You can use your %1$s password to log in.');
@@ -182,7 +181,7 @@ class TwittersettingsAction extends ConnectSettingsAction
if (common_config('twitterimport','enabled')) {
$this->elementStart('li');
$this->checkbox('noticerecv',
- _m('Import my Friends Timeline.'),
+ _m('Import my friends timeline.'),
($flink) ?
($flink->noticesync & FOREIGN_NOTICE_RECV) :
false);
@@ -219,7 +218,6 @@ class TwittersettingsAction extends ConnectSettingsAction
*
* @return void
*/
-
function handlePost()
{
// CSRF protection
@@ -244,7 +242,6 @@ class TwittersettingsAction extends ConnectSettingsAction
*
* @return void
*/
-
function removeTwitterAccount()
{
$user = common_current_user();
@@ -266,7 +263,6 @@ class TwittersettingsAction extends ConnectSettingsAction
*
* @return void
*/
-
function savePreferences()
{
$noticesend = $this->boolean('noticesend');
@@ -295,5 +291,4 @@ class TwittersettingsAction extends ConnectSettingsAction
$this->showForm(_m('Twitter preferences saved.'), true);
}
-
}