diff --git a/plugins/Facebook/FBC_XDReceiver.php b/plugins/Facebook/FBC_XDReceiver.php index 2bc790d5a0..bf4b59bba1 100644 --- a/plugins/Facebook/FBC_XDReceiver.php +++ b/plugins/Facebook/FBC_XDReceiver.php @@ -1,4 +1,7 @@ elementEnd('html'); } - } - diff --git a/plugins/Facebook/FBConnectAuth.php b/plugins/Facebook/FBConnectAuth.php index 8eba7fc135..f06dffaaab 100644 --- a/plugins/Facebook/FBConnectAuth.php +++ b/plugins/Facebook/FBConnectAuth.php @@ -60,12 +60,10 @@ class FBConnectauthAction extends Action parent::handle($args); if (common_is_real_login()) { - // User is already logged in. Does she already have a linked Facebook acct? $flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE); if (!empty($flink)) { - // User already has a linked Facebook account and shouldn't be here common_debug('Facebook Connect Plugin - ' . 'There is already a local user (' . $flink->user_id . @@ -74,8 +72,7 @@ class FBConnectauthAction extends Action // We don't want these cookies getFacebook()->clear_cookie_state(); - $this->clientError(_m('There is already a local user linked with this Facebook.')); - + $this->clientError(_m('There is already a local user linked with this Facebook account.')); } else { // User came from the Facebook connect settings tab, and @@ -102,7 +99,7 @@ class FBConnectauthAction extends Action } else { common_debug('Facebook Connect Plugin - ' . print_r($this->args, true)); - $this->showForm(_m('Something weird happened.'), + $this->showForm(_m('An unknown error has occured.'), $this->trimmed('newname')); } } else { @@ -116,12 +113,14 @@ class FBConnectauthAction extends Action $this->element('div', array('class' => 'error'), $this->error); } else { $this->element('div', 'instructions', + // TRANS: %s is the site name. sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Facebook 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('Facebook Account Setup'); } @@ -155,6 +154,7 @@ class FBConnectauthAction extends Action 'class' => 'form_settings', 'action' => common_local_url('FBConnectAuth'))); $this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options')); + // TRANS: Legend. $this->element('legend', null, _m('Connection options')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); @@ -164,7 +164,8 @@ class FBConnectauthAction extends Action 'name' => 'license', 'value' => 'true')); $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); - $message = _('My text and files are available under %s ' . + // TRANS: %s is the name of the license used by the user for their status updates. + $message = _m('My text and files are available under %s ' . 'except this private data: password, ' . 'email address, IM address, and phone number.'); $link = 'reqFbScripts($action)) { - // XXX: Horrible hack to make Safari, FF2, and Chrome work with // Facebook Connect. These browser cannot use Facebook's // DOM parsing routines unless the mime type of the page is @@ -238,9 +229,7 @@ class FacebookPlugin extends Plugin 'lang' => $language)); return false; - } else { - return true; } } @@ -255,7 +244,6 @@ class FacebookPlugin extends Plugin * @return void * */ - function onEndShowScripts($action) { if ($this->reqFbScripts($action)) { @@ -306,12 +294,10 @@ class FacebookPlugin extends Plugin $js = sprintf($js, $apikey, $login_url, $logout_url); // Compress the bugger down a bit - $js = str_replace(' ', '', $js); $action->inlineScript($js); } - } /** @@ -323,7 +309,6 @@ class FacebookPlugin extends Plugin * @return void * */ - function onEndShowFooter($action) { if ($this->reqFbScripts($action)) { @@ -340,7 +325,6 @@ class FacebookPlugin extends Plugin * @return void * */ - function onEndShowStatusNetStyles($action) { if ($this->reqFbScripts($action)) { @@ -357,7 +341,6 @@ class FacebookPlugin extends Plugin * * @return boolean true */ - function reqFbScripts($action) { if (!self::hasKeys()) { @@ -365,7 +348,6 @@ class FacebookPlugin extends Plugin } // If you're logged in w/FB Connect, you always need the FB stuff - $fbuid = $this->loggedIn(); if (!empty($fbuid)) { @@ -373,7 +355,6 @@ class FacebookPlugin extends Plugin } // List of actions that require FB stuff - $needy = array('FBConnectLoginAction', 'FBConnectauthAction', 'FBConnectSettingsAction'); @@ -383,7 +364,6 @@ class FacebookPlugin extends Plugin } return false; - } /** @@ -391,7 +371,6 @@ class FacebookPlugin extends Plugin * * @return mixed $fbuid the Facebook ID of the logged in user, or null */ - function loggedIn() { $user = common_current_user(); @@ -403,12 +382,9 @@ class FacebookPlugin extends Plugin $fbuid = 0; if (!empty($flink)) { - try { - $facebook = getFacebook(); $fbuid = $facebook->get_loggedin_user(); - } catch (Exception $e) { common_log(LOG_WARNING, 'Facebook Connect Plugin - ' . 'Problem getting Facebook user: ' . @@ -432,17 +408,14 @@ class FacebookPlugin extends Plugin * @return void * */ - function onStartPrimaryNav($action) { if (self::hasKeys()) { $user = common_current_user(); if (!empty($user)) { - $fbuid = $this->loggedIn(); if (!empty($fbuid)) { - /* Default FB silhouette pic for FB users who haven't uploaded a profile pic yet. */ @@ -455,7 +428,7 @@ class FacebookPlugin extends Plugin $action->element('img', array('id' => 'fbc_profile-pic', 'src' => (!empty($url)) ? $url : $silhouetteUrl, - 'alt' => 'Facebook Connect User', + 'alt' => _m('Facebook Connect User'), 'width' => '16'), ''); $iconurl = common_path('plugins/Facebook/fbfavicon.ico'); @@ -477,18 +450,20 @@ class FacebookPlugin extends Plugin * * @return void */ - function onEndLoginGroupNav(&$action) { if (self::hasKeys()) { - $action_name = $action->trimmed('action'); $action->menuItem(common_local_url('FBConnectLogin'), - _m('Facebook'), + // @todo CHECKME: Should be 'Facebook Login'? + // TRANS: Menu item. + _m('MENU','Facebook'), + // TRANS: Tooltip for menu item "Facebook". _m('Login or register using Facebook'), 'FBConnectLogin' === $action_name); } + return true; } @@ -499,18 +474,20 @@ class FacebookPlugin extends Plugin * * @return void */ - function onEndConnectSettingsNav(&$action) { if (self::hasKeys()) { - $action_name = $action->trimmed('action'); $action->menuItem(common_local_url('FBConnectSettings'), - _m('Facebook'), + // @todo CHECKME: Should be 'Facebook Connect'? + // TRANS: Menu item tab. + _m('MENU','Facebook'), + // TRANS: Tooltip for menu item "Facebook". _m('Facebook Connect Settings'), $action_name === 'FBConnectSettings'); } + return true; } @@ -521,7 +498,6 @@ class FacebookPlugin extends Plugin * * @return void */ - function onStartLogout($action) { if (self::hasKeys()) { @@ -550,14 +526,12 @@ class FacebookPlugin extends Plugin * * @return string $url the url for the user's Facebook avatar */ - function getProfilePicURL($fbuid) { $facebook = getFacebook(); $url = null; try { - $fqry = 'SELECT pic_square FROM user WHERE uid = %s'; $result = $facebook->api_client->fql_query(sprintf($fqry, $fbuid)); @@ -582,7 +556,6 @@ class FacebookPlugin extends Plugin * * @return boolean hook return */ - function onStartEnqueueNotice($notice, &$transports) { if (self::hasKeys() && $notice->isLocal()) { @@ -613,14 +586,14 @@ class FacebookPlugin extends Plugin 'version' => self::VERSION, 'author' => 'Zach Copley', 'homepage' => 'http://status.net/wiki/Plugin:Facebook', + // TRANS: Plugin description. 'rawdescription' => _m( - 'The Facebook plugin allows you to integrate ' . - 'your StatusNet instance with ' . + 'The Facebook plugin allows integrating ' . + 'StatusNet instances with ' . 'Facebook ' . 'and Facebook Connect.' ) ); return true; } - } diff --git a/plugins/Facebook/facebookaction.php b/plugins/Facebook/facebookaction.php index 467c6af84f..4c15fc0397 100644 --- a/plugins/Facebook/facebookaction.php +++ b/plugins/Facebook/facebookaction.php @@ -36,7 +36,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebooknoticeform.php'; class FacebookAction extends Action { - var $facebook = null; var $fbuid = null; var $flink = null; @@ -102,7 +101,6 @@ class FacebookAction extends Action * * @return void */ - function startHTML($type=null) { $this->showStylesheets(); @@ -143,7 +141,6 @@ class FacebookAction extends Action function showHead($error, $success) { - if ($error) { $this->element("h1", null, $error); } @@ -168,7 +165,10 @@ class FacebookAction extends Action $this->elementStart('li', array('class' => ($this->action == 'facebookhome') ? 'current' : 'facebook_home')); $this->element('a', - array('href' => 'index.php', 'title' => _m('Home')), _m('Home')); + // TRANS: Link description for 'Home' link that leads to a start page. + array('href' => 'index.php', 'title' => _m('MENU','Home')), + // TRANS: Tooltip for 'Home' link that leads to a start page. + _m('Home')); $this->elementEnd('li'); if (common_config('invite', 'enabled')) { @@ -176,7 +176,10 @@ class FacebookAction extends Action array('class' => ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite')); $this->element('a', - array('href' => 'invite.php', 'title' => _m('Invite')), _m('Invite')); + // TRANS: Link description for 'Invite' link that leads to a page where friends can be invited. + array('href' => 'invite.php', 'title' => _m('MENU','Invite')), + // TRANS: Tooltip for 'Invite' link that leads to a page where friends can be invited. + _m('Invite')); $this->elementEnd('li'); } @@ -185,7 +188,10 @@ class FacebookAction extends Action ($this->action == 'facebooksettings') ? 'current' : 'facebook_settings')); $this->element('a', array('href' => 'settings.php', - 'title' => _m('Settings')), _m('Settings')); + // TRANS: Link description for 'Settings' link that leads to a page user preferences can be set. + 'title' => _m('MENU','Settings')), + // TRANS: Tooltip for 'Settings' link that leads to a page user preferences can be set. + _m('Settings')); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -272,7 +278,8 @@ class FacebookAction extends Action $this->elementEnd('li'); $this->elementEnd('ul'); - $this->submit('submit', _m('Login')); + // TRANS: Login button. + $this->submit('submit', _m('BUTTON','Login')); $this->elementEnd('fieldset'); $this->elementEnd('form'); @@ -283,7 +290,6 @@ class FacebookAction extends Action $this->elementEnd('div'); $this->elementEnd('div'); - } function updateProfileBox($notice) @@ -356,7 +362,6 @@ class FacebookAction extends Action function saveNewNotice() { - $user = $this->flink->getUser(); $content = $this->trimmed('status_textarea'); @@ -368,6 +373,7 @@ class FacebookAction extends Action $content_shortened = common_shorten_links($content); if (Notice::contentTooLong($content_shortened)) { + // @todo FIXME: i18n: Needs plural. $this->showPage(sprintf(_m('That\'s too long. Max notice size is %d chars.'), Notice::maxContent())); return; @@ -379,9 +385,7 @@ class FacebookAction extends Action $cmd = $inter->handle_command($user, $content_shortened); if ($cmd) { - // XXX fix this - $cmd->execute(new WebChannel()); return; } @@ -398,12 +402,10 @@ class FacebookAction extends Action } } - } class FacebookNoticeList extends NoticeList { - /** * constructor * @@ -423,7 +425,6 @@ class FacebookNoticeList extends NoticeList * * @return int count of notices listed. */ - function show() { $this->out->elementStart('div', array('id' =>'notices_primary')); @@ -459,17 +460,14 @@ class FacebookNoticeList extends NoticeList * @return FacebookNoticeListItem a list item for displaying the notice * formatted for display in the Facebook App. */ - function newListItem($notice) { return new FacebookNoticeListItem($notice, $this); } - } class FacebookNoticeListItem extends NoticeListItem { - /** * constructor * @@ -477,7 +475,6 @@ class FacebookNoticeListItem extends NoticeListItem * * @param Notice $notice The notice we'll display */ - function __construct($notice, $out=null) { parent::__construct($notice, $out); @@ -491,7 +488,6 @@ class FacebookNoticeListItem extends NoticeListItem * * @return void */ - function show() { $this->showStart(); @@ -502,12 +498,10 @@ class FacebookNoticeListItem extends NoticeListItem $this->showEnd(); } - } class FacebookProfileBoxNotice extends FacebookNoticeListItem { - /** * constructor * @@ -515,7 +509,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem * * @param Notice $notice The notice we'll display */ - function __construct($notice, $out=null) { parent::__construct($notice, $out); @@ -527,7 +520,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem * * @return void */ - function show() { $this->showNotice(); @@ -537,7 +529,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem function showAppLink() { - $this->facebook = getFacebook(); $app_props = $this->facebook->api_client->Admin_getAppProperties( @@ -551,5 +542,4 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem $this->out->text($this->app_name); $this->out->elementEnd('a'); } - } diff --git a/plugins/Facebook/facebookadminpanel.php b/plugins/Facebook/facebookadminpanel.php index ae1c7302f9..ae26c7d3e8 100644 --- a/plugins/Facebook/facebookadminpanel.php +++ b/plugins/Facebook/facebookadminpanel.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 FacebookadminpanelAction extends AdminPanelAction { /** @@ -48,7 +47,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return string page title */ - function title() { return _m('Facebook'); @@ -59,7 +57,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { return _m('Facebook integration settings'); @@ -70,7 +67,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new FacebookAdminPanelForm($this); @@ -83,7 +79,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { static $settings = array( @@ -100,7 +95,6 @@ class FacebookadminpanelAction extends AdminPanelAction } // This throws an exception on validation errors - $this->validate($values); // assert(all values are valid); @@ -145,7 +139,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return int ID of the form */ - function id() { return 'facebookadminpanel'; @@ -156,7 +149,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return string class of the form */ - function formClass() { return 'form_settings'; @@ -167,7 +159,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return string URL of the action */ - function action() { return common_local_url('facebookadminpanel'); @@ -178,7 +169,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return void */ - function formData() { $this->out->elementStart( @@ -215,9 +205,8 @@ class FacebookAdminPanelForm extends AdminForm * * @return void */ - function formActions() { - $this->out->submit('submit', _('Save'), 'submit', null, _('Save Facebook settings')); + $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Facebook settings')); } } diff --git a/plugins/Facebook/facebookhome.php b/plugins/Facebook/facebookhome.php index 60782f63c9..6090f988c5 100644 --- a/plugins/Facebook/facebookhome.php +++ b/plugins/Facebook/facebookhome.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookhomeAction extends FacebookAction { - var $page = null; function prepare($argarray) @@ -54,7 +53,6 @@ class FacebookhomeAction extends FacebookAction } if ($this->flink) { - $this->user = $this->flink->getUser(); // If this is the first time the user has started the app @@ -82,18 +80,14 @@ class FacebookhomeAction extends FacebookAction // Facebook status update permission? Then show the main page // of the app $this->showPage(); - } else { - // User hasn't authenticated yet, prompt for creds $this->login(); } - } function login() { - $this->showStylesheets(); $nickname = common_canonical_nickname($this->trimmed('nickname')); @@ -102,13 +96,11 @@ class FacebookhomeAction extends FacebookAction $msg = null; if ($nickname) { - if (common_check_user($nickname, $password)) { - $user = User::staticGet('nickname', $nickname); if (!$user) { - $this->showLoginForm(_m("Server error - couldn't get user!")); + $this->showLoginForm(_m("Server error: Couldn't get user!")); } $flink = DB_DataObject::factory('foreign_link'); @@ -126,7 +118,6 @@ class FacebookhomeAction extends FacebookAction $this->getUpdatePermission(); return; - } else { $msg = _m('Incorrect username or password.'); } @@ -134,7 +125,6 @@ class FacebookhomeAction extends FacebookAction $this->showLoginForm($msg); $this->showFooter(); - } function setDefaults() @@ -155,8 +145,15 @@ class FacebookhomeAction extends FacebookAction function title() { if ($this->page > 1) { - return sprintf(_m("%s and friends, page %d"), $this->user->nickname, $this->page); + // @todo FIXME: Core should have methods to get "Full name (nickname)" in a localised form + // so that this can be used consistenly throughout StatusNet without having to implement it + // over and over.. + // TRANS: Page title. + // TRANS: %1$s is a user nickname, %2$s is a page number. + return sprintf(_m("%1$s and friends, page %2$d"), $this->user->nickname, $this->page); } else { + // TRANS: Page title. + // TRANS: %s is a user nickname return sprintf(_m("%s and friends"), $this->user->nickname); } } @@ -175,17 +172,16 @@ class FacebookhomeAction extends FacebookAction function showNoticeList($notice) { - $nl = new NoticeList($notice, $this); return $nl->show(); } function getUpdatePermission() { - $this->showStylesheets(); $this->elementStart('div', array('class' => 'facebook_guide')); + // TRANS: Instructions. %s is the application name. $instructions = sprintf(_m('If you would like the %s app to automatically update ' . 'your Facebook status with your latest notice, you need ' . 'to give it permission.'), $this->app_name); @@ -209,6 +205,7 @@ class FacebookhomeAction extends FacebookAction '&next_cancel=' . $next . '&submit=skip'; $this->elementStart('span', array('class' => 'facebook-button')); + // @todo FIXME: sprintf not needed here? $this->element('a', array('href' => $auth_url), sprintf(_m('Okay, do it!'), $this->app_name)); $this->elementEnd('span'); @@ -216,13 +213,13 @@ class FacebookhomeAction extends FacebookAction $this->elementEnd('li'); $this->elementStart('li', array('id' => 'fb-permissions-item')); - $this->submit('skip', _m('Skip')); + // TRANS: Button text. Clicking the button will skip updating Facebook permissions. + $this->submit('skip', _m('BUTTON','Skip')); $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('form'); $this->elementEnd('div'); - } /** @@ -238,7 +235,6 @@ class FacebookhomeAction extends FacebookAction */ function pagination($have_before, $have_after, $page, $action, $args=null) { - // Does a little before-after block for next/prev page // XXX: Fix so this uses common_local_url() if possible. @@ -254,6 +250,7 @@ class FacebookhomeAction extends FacebookAction $newargs = $args ? array_merge($args, $pargs) : $pargs; $this->elementStart('li', array('class' => 'nav_prev')); $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'prev'), + // TRANS: Pagination link. _m('After')); $this->elementEnd('li'); } @@ -262,6 +259,7 @@ class FacebookhomeAction extends FacebookAction $newargs = $args ? array_merge($args, $pargs) : $pargs; $this->elementStart('li', array('class' => 'nav_next')); $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'next'), + // TRANS: Pagination link. _m('Before')); $this->elementEnd('li'); } @@ -271,5 +269,4 @@ class FacebookhomeAction extends FacebookAction $this->elementEnd('dl'); } } - } diff --git a/plugins/Facebook/facebookinvite.php b/plugins/Facebook/facebookinvite.php index e02c7bf3ed..a50eace12f 100644 --- a/plugins/Facebook/facebookinvite.php +++ b/plugins/Facebook/facebookinvite.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookinviteAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -41,7 +40,6 @@ class FacebookinviteAction extends FacebookAction * * @return void */ - function showForm($error=null) { $this->error = $error; @@ -56,7 +54,6 @@ class FacebookinviteAction extends FacebookAction * * @return void */ - function showContent() { if ($this->arg('ids')) { @@ -68,9 +65,10 @@ class FacebookinviteAction extends FacebookAction function showSuccessContent() { - - $this->element('h2', null, sprintf(_m('Thanks for inviting your friends to use %s'), + // TRANS: %s is the name of the site. + $this->element('h2', null, sprintf(_m('Thanks for inviting your friends to use %s.'), common_config('site', 'name'))); + // TRANS: Followed by an unordered list with invited friends. $this->element('p', null, _m('Invitations have been sent to the following users:')); $friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to access the list? @@ -85,8 +83,7 @@ class FacebookinviteAction extends FacebookAction $this->elementEnd('li'); } - $this->elementEnd("ul"); - + $this->elementEnd('ul'); } function showFormContent() @@ -100,6 +97,7 @@ class FacebookinviteAction extends FacebookAction 'type' => common_config('site', 'name'), 'content' => $content)); $this->hidden('invite', 'true'); + // TRANS: %s is the name of the site. $actiontext = sprintf(_m('Invite your friends to use %s'), common_config('site', 'name')); $multi_params = array('showborder' => 'false'); @@ -122,6 +120,7 @@ class FacebookinviteAction extends FacebookAction if ($exclude_ids) { + // TRANS: %s is the name of the site. $this->element('h2', null, sprintf(_m('Friends already using %s:'), common_config('site', 'name'))); $this->elementStart('ul', array('id' => 'facebook-friends')); @@ -140,7 +139,7 @@ class FacebookinviteAction extends FacebookAction function title() { + // TRANS: Page title. return sprintf(_m('Send invitations')); } - } diff --git a/plugins/Facebook/facebooklogin.php b/plugins/Facebook/facebooklogin.php index 7a173ddaeb..1961be57b6 100644 --- a/plugins/Facebook/facebooklogin.php +++ b/plugins/Facebook/facebooklogin.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookinviteAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -37,6 +36,7 @@ class FacebookinviteAction extends FacebookAction $this->facebook->api_client->data_getUserPreference( FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') { + // @todo FIXME: Missing i18n? echo '