X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FFacebook%2Ffacebookhome.php;h=8b8b9744585ffbeed04feb82e53f82be32ae54f2;hb=834acaaa794254dfb9dc7e57dab498001d975d11;hp=91c0cc6b861ee4e8ac3da3419958215b7b7024c3;hpb=4e9ec0d0e1aeb43b432f4692b4819beb9408ad3b;p=quix0rs-gnu-social.git diff --git a/plugins/Facebook/facebookhome.php b/plugins/Facebook/facebookhome.php index 91c0cc6b86..8b8b974458 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(_("Server error - couldn't get user!")); + $this->showLoginForm(_m("Server error: Couldn't get user!")); } $flink = DB_DataObject::factory('foreign_link'); @@ -126,15 +118,13 @@ class FacebookhomeAction extends FacebookAction $this->getUpdatePermission(); return; - } else { - $msg = _('Incorrect username or password.'); + $msg = _m('Incorrect username or password.'); } } $this->showLoginForm($msg); $this->showFooter(); - } function setDefaults() @@ -155,9 +145,16 @@ class FacebookhomeAction extends FacebookAction function title() { if ($this->page > 1) { - return sprintf(_("%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 { - return sprintf(_("%s and friends"), $this->user->nickname); + // TRANS: Page title. + // TRANS: %s is a user nickname + return sprintf(_m("%s and friends"), $this->user->nickname); } } @@ -175,18 +172,17 @@ 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')); - $instructions = sprintf(_('If you would like the %s app to automatically update ' . + // 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,20 +205,21 @@ 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(_('Okay, do it!'), $this->app_name)); + sprintf(_m('Okay, do it!'), $this->app_name)); $this->elementEnd('span'); $this->elementEnd('li'); $this->elementStart('li', array('id' => 'fb-permissions-item')); - $this->submit('skip', _('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,15 +235,13 @@ 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. if ($have_before || $have_after) { - $this->elementStart('div', array('class' => 'pagination')); - $this->elementStart('dl', null); - $this->element('dt', null, _('Pagination')); + $this->elementStart('dl', 'pagination'); + $this->element('dt', null, _m('Pagination')); $this->elementStart('dd', null); $this->elementStart('ul', array('class' => 'nav')); } @@ -255,7 +250,8 @@ 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'), - _('After')); + // TRANS: Pagination link. + _m('After')); $this->elementEnd('li'); } if ($have_after) { @@ -263,15 +259,14 @@ 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'), - _('Before')); + // TRANS: Pagination link. + _m('Before')); $this->elementEnd('li'); } if ($have_before || $have_after) { $this->elementEnd('ul'); $this->elementEnd('dd'); $this->elementEnd('dl'); - $this->elementEnd('div'); } } - }