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 '

REDIRECT TO HOME

'; } } else { @@ -46,7 +46,6 @@ class FacebookinviteAction extends FacebookAction function showContent() { - // If the user has opted not to initially allow the app to have // Facebook status update permission, store that preference. Only // promt the user the first time she uses the app @@ -56,7 +55,6 @@ class FacebookinviteAction extends FacebookAction } if ($this->flink) { - $this->user = $this->flink->getUser(); // If this is the first time the user has started the app @@ -69,7 +67,6 @@ class FacebookinviteAction extends FacebookAction return; } } - } else { $this->showLoginForm(); } @@ -88,6 +85,8 @@ class FacebookinviteAction extends FacebookAction function title() { + // @todo FIXME: Give a more precise description? Suggestion: "Login with Facebook Connect" + // TRANS: Page title. return sprintf(_m('Login')); } @@ -95,5 +94,4 @@ class FacebookinviteAction extends FacebookAction { } - } diff --git a/plugins/Facebook/facebooknoticeform.php b/plugins/Facebook/facebooknoticeform.php index 5989147f49..d52222c933 100644 --- a/plugins/Facebook/facebooknoticeform.php +++ b/plugins/Facebook/facebooknoticeform.php @@ -2,7 +2,7 @@ /** * StatusNet, the distributed open-source microblogging tool * - * Form for posting a notice from within the Facebook App. + * Form for posting a notice from within the Facebook App. * * This is a stripped down version of the normal NoticeForm (sans * location stuff and media upload stuff). I'm not sure we can share the @@ -53,31 +53,26 @@ require_once INSTALLDIR . '/lib/form.php'; * * @see HTMLOutputter */ - class FacebookNoticeForm extends Form { /** * Current action, used for returning to this page. */ - var $action = null; /** * Pre-filled content of the form */ - var $content = null; /** * The current user */ - var $user = null; /** * The notice being replied to */ - var $inreplyto = null; /** @@ -87,7 +82,6 @@ class FacebookNoticeForm extends Form * @param string $action action to return to, if any * @param string $content content to pre-fill */ - function __construct($out=null, $action=null, $content=null, $post_action=null, $user=null, $inreplyto=null) { parent::__construct($out); @@ -102,7 +96,7 @@ class FacebookNoticeForm extends Form } else { $this->user = common_current_user(); } - + // Note: Facebook doesn't allow multipart/form-data posting to // canvas pages, so don't try to set it--no file uploads, at // least not this way. It can be done using multiple servers @@ -114,7 +108,6 @@ class FacebookNoticeForm extends Form * * @return string ID of the form */ - function id() { return 'form_notice'; @@ -125,7 +118,6 @@ class FacebookNoticeForm extends Form * * @return string class of the form */ - function formClass() { return 'form_notice'; @@ -136,7 +128,6 @@ class FacebookNoticeForm extends Form * * @return string URL of the action */ - function action() { return $this->post_action; @@ -149,7 +140,8 @@ class FacebookNoticeForm extends Form */ function formLegend() { - $this->out->element('legend', null, _('Send a notice')); + // TRANS: Legend. + $this->out->element('legend', null, _m('Send a notice')); } /** @@ -157,12 +149,12 @@ class FacebookNoticeForm extends Form * * @return void */ - function formData() { if (Event::handle('StartShowNoticeFormData', array($this))) { $this->out->element('label', array('for' => 'notice_data-text'), - sprintf(_('What\'s up, %s?'), $this->user->nickname)); + // TRANS: Field label. + sprintf(_m('What\'s up, %s?'), $this->user->nickname)); // XXX: vary by defined max size $this->out->element('textarea', array('id' => 'notice_data-text', 'cols' => 35, @@ -174,7 +166,7 @@ class FacebookNoticeForm extends Form if ($contentLimit > 0) { $this->out->elementStart('dl', 'form_note'); - $this->out->element('dt', null, _('Available characters')); + $this->out->element('dt', null, _m('Available characters')); $this->out->element('dd', array('id' => 'notice_text-count'), $contentLimit); $this->out->elementEnd('dl'); @@ -194,13 +186,13 @@ class FacebookNoticeForm extends Form * * @return void */ - function formActions() { $this->out->element('input', array('id' => 'notice_action-submit', 'class' => 'submit', 'name' => 'status_submit', 'type' => 'submit', - 'value' => _('Send'))); + // TRANS: Button text. + 'value' => _m('BUTTON','Send'))); } } diff --git a/plugins/Facebook/facebookremove.php b/plugins/Facebook/facebookremove.php index 09cb333428..b048a435f5 100644 --- a/plugins/Facebook/facebookremove.php +++ b/plugins/Facebook/facebookremove.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookremoveAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -65,5 +64,4 @@ class FacebookremoveAction extends FacebookAction 'unsuccessfully tried to remove a foreign link to Facebook!'); } } - } diff --git a/plugins/Facebook/facebooksettings.php b/plugins/Facebook/facebooksettings.php index f94a346b57..1379b9a9cc 100644 --- a/plugins/Facebook/facebooksettings.php +++ b/plugins/Facebook/facebooksettings.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebooksettingsAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -40,7 +39,6 @@ class FacebooksettingsAction extends FacebookAction * * @return void */ - function showContent() { if ($this->arg('save')) { @@ -62,6 +60,7 @@ class FacebooksettingsAction extends FacebookAction if ($result === false) { $this->showForm(_m('There was a problem saving your sync preferences!')); } else { + // TRANS: Confirmation that synchronisation settings have been saved into the system. $this->showForm(_m('Sync preferences saved.'), true); } } @@ -99,16 +98,16 @@ class FacebooksettingsAction extends FacebookAction $this->elementStart('li'); - $this->submit('save', _m('Save')); + // TRANS: Submit button to save synchronisation settings. + $this->submit('save', _m('BUTTON','Save')); $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('form'); - } else { - + // TRANS: %s is the application name. $instructions = sprintf(_m('If you would like %s to automatically update ' . 'your Facebook status with your latest notice, you need ' . 'to give it permission.'), $this->app_name); @@ -127,12 +126,11 @@ class FacebooksettingsAction extends FacebookAction $this->elementEnd('li'); $this->elementEnd('ul'); } - } function title() { + // TRANS: Page title for synchronisation settings. return _m('Sync preferences'); } - } diff --git a/plugins/Facebook/facebookutil.php b/plugins/Facebook/facebookutil.php index 1290fed557..e78856f7c4 100644 --- a/plugins/Facebook/facebookutil.php +++ b/plugins/Facebook/facebookutil.php @@ -45,13 +45,11 @@ function getFacebook() } function isFacebookBound($notice, $flink) { - if (empty($flink)) { return false; } // Avoid a loop - if ($notice->source == 'Facebook') { common_log(LOG_INFO, "Skipping notice $notice->id because its " . 'source is Facebook.'); @@ -59,7 +57,6 @@ function isFacebookBound($notice, $flink) { } // If the user does not want to broadcast to Facebook, move along - if (!($flink->noticesync & FOREIGN_NOTICE_SEND == FOREIGN_NOTICE_SEND)) { common_log(LOG_INFO, "Skipping notice $notice->id " . 'because user has FOREIGN_NOTICE_SEND bit off.'); @@ -68,14 +65,12 @@ function isFacebookBound($notice, $flink) { // If it's not a reply, or if the user WANTS to send @-replies, // then, yeah, it can go to Facebook. - if (!preg_match('/@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) || ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY)) { return true; } return false; - } function facebookBroadcastNotice($notice) @@ -87,16 +82,12 @@ function facebookBroadcastNotice($notice) ); if (isFacebookBound($notice, $flink)) { - // Okay, we're good to go, update the FB status - $fbuid = $flink->foreign_id; $user = $flink->getUser(); try { - // Check permissions - common_debug( 'FacebookPlugin - checking for publish_stream permission for user ' . "$user->nickname ($user->id), Facebook UID: $fbuid" @@ -105,7 +96,6 @@ function facebookBroadcastNotice($notice) // NOTE: $facebook->api_client->users_hasAppPermission('publish_stream', $fbuid) // has been returning bogus results, so we're using FQL to check for // publish_stream permission now - $fql = "SELECT publish_stream FROM permissions WHERE uid = $fbuid"; $result = $facebook->api_client->fql_query($fql); @@ -152,7 +142,6 @@ function facebookBroadcastNotice($notice) } // Post to Facebook - if ($notice->hasAttachments() && $canPublish == 1) { publishStream($notice, $user, $fbuid); } elseif ($canUpdate == 1 || $canPublish == 1) { @@ -165,7 +154,6 @@ function facebookBroadcastNotice($notice) } // Finally, attempt to update the user's profile box - if ($canPublish == 1 || $canUpdate == 1) { updateProfileBox($facebook, $flink, $notice, $user); } @@ -412,7 +400,6 @@ function remove_facebook_app($flink) common_log(LOG_WARNING, $msg); } - } /** @@ -423,7 +410,6 @@ function remove_facebook_app($flink) * * @return boolean success flag */ - function mail_facebook_app_removed($user) { $profile = $user->getProfile(); @@ -447,5 +433,4 @@ function mail_facebook_app_removed($user) common_switch_locale(); return mail_to_user($user, $subject, $body); - }