*/
function onRouterInitialized($m)
{
- $m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
+ $m->connect('panel/twitter', array('action' => 'twitteradminpanel'));
if (self::hasKeys()) {
$m->connect(
/*
* Add a login tab for 'Sign in with Twitter'
*
- * @param Action &action the current action
+ * @param Action $action the current action
*
* @return void
*/
- function onEndLoginGroupNav(&$action)
+ function onEndLoginGroupNav($action)
{
$action_name = $action->trimmed('action');
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
);
}
/**
* Add the Twitter Settings page to the Connect Settings menu
*
- * @param Action &$action The calling page
+ * @param Action $action The calling page
*
* @return boolean hook return
*/
- function onEndConnectSettingsNav(&$action)
+ function onEndConnectSettingsNav($action)
{
if (self::hasKeys()) {
$action_name = $action->trimmed('action');
$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'
);
return false;
case 'TwitterOAuthClient':
case 'TwitterQueueHandler':
+ case 'TweetInQueueHandler':
case 'TwitterImport':
case 'JsonStreamReader':
case 'TwitterStreamReader':
*/
function onStartEnqueueNotice($notice, &$transports)
{
- if (self::hasKeys() && $notice->isLocal()) {
+ if (self::hasKeys() && $notice->isLocal() && $notice->inScope(null)) {
// Avoid a possible loop
if ($notice->source != 'twitter') {
array_push($transports, 'twitter');
*
* @return boolean hook return
*/
- function onGetValidDaemons($daemons)
+ function onGetValidDaemons(&$daemons)
{
if (self::hasKeys()) {
array_push(
return true;
}
+ /**
+ * If the plugin's installed, this should be accessible to admins
+ */
+ function onAdminPanelCheck($name, &$isOK)
+ {
+ if ($name == 'twitter') {
+ $isOK = true;
+ return false;
+ }
+ return true;
+ }
+
/**
* Add a Twitter tab to the admin panel
*
$nav->out->menuItem(
common_local_url('twitteradminpanel'),
+ // TRANS: Menu item in administrative panel that leads to the Twitter bridge configuration.
_m('Twitter'),
- _m('Twitter bridge configuration'),
+ // TRANS: Menu item title in administrative panel that leads to the Twitter bridge configuration.
+ _m('Twitter bridge configuration page.'),
$action_name == 'twitteradminpanel',
'nav_twitter_admin_panel'
);
$versions[] = array(
'name' => 'TwitterBridge',
'version' => self::VERSION,
- 'author' => 'Zach Copley, Julien C',
+ 'author' => 'Zach Copley, Julien C, Jean Baptiste Favre',
'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>.'
)
*/
function onStartDeleteOwnNotice(User $user, Notice $notice)
{
- $n2s = Notice_to_status::staticGet('notice_id', $notice->id);
+ $n2s = Notice_to_status::getKV('notice_id', $notice->id);
if (!empty($n2s)) {
return true;
}
+
+ function onStartGetProfileUri($profile, &$uri)
+ {
+ if (preg_match('!^https?://twitter.com/!', $profile->profileurl)) {
+ $uri = $profile->profileurl;
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Add links in the user's profile block to their Twitter profile URL.
+ *
+ * @param Profile $profile The profile being shown
+ * @param Array &$links Writeable array of arrays (href, text, image).
+ *
+ * @return boolean hook value (true)
+ */
+
+ function onOtherAccountProfiles($profile, &$links)
+ {
+ $fuser = null;
+
+ $flink = Foreign_link::getByUserID($profile->id, TWITTER_SERVICE);
+
+ if (!empty($flink)) {
+ $fuser = $flink->getForeignUser();
+
+ if (!empty($fuser)) {
+ $links[] = array("href" => $fuser->uri,
+ "text" => sprintf(_("@%s on Twitter"), $fuser->nickname),
+ "image" => $this->path("icons/twitter-bird-white-on-blue.png"));
+ }
+ }
+
+ return true;
+ }
}