<?php
+/**
+ * @todo Add header and documentation
+ */
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
*/
class FBC_XDReceiverAction extends Action
{
-
/**
* Do we need to write to the database?
*
* @return boolean true
*/
-
function isReadonly()
{
return true;
*
* @return void
*/
-
function handle($args)
{
// Parent handling, including cache check
$this->elementEnd('html');
}
-
}
-
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 .
// 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
} 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 {
$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');
}
'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');
'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 = '<a href="' .
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
$this->element('legend', null,
+ // TRANS: Legend.
_m('Create new account'));
$this->element('p', null,
_m('Create a new user with this nickname.'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
+ // TRANS: Field label.
$this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '',
_m('1-64 lowercase letters or numbers, no punctuation or spaces'));
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('create', _m('Create'));
+ // TRANS: Submit button.
+ $this->submit('create', _m('BUTTON','Create'));
$this->elementEnd('fieldset');
$this->elementStart('fieldset');
+ // TRANS: Legend.
$this->element('legend', null,
_m('Connect existing account'));
$this->element('p', null,
_m('If you already have an account, login with your username and password to connect it to your Facebook.'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
+ // TRANS: Field label.
$this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li');
$this->elementStart('li');
$this->password('password', _m('Password'));
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('connect', _m('Connect'));
+ // TRANS: Submit button.
+ $this->submit('connect', _m('BUTTON','Connect'));
$this->elementEnd('fieldset');
$this->elementEnd('fieldset');
function createNewUser()
{
if (common_config('site', 'closed')) {
+ // TRANS: Client error trying to register with registrations not allowed.
$this->clientError(_m('Registration not allowed.'));
return;
}
if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode'];
if (empty($code)) {
+ // TRANS: Client error trying to register with registrations 'invite only'.
$this->clientError(_m('Registration not allowed.'));
return;
}
$invite = Invitation::staticGet($code);
if (empty($invite)) {
+ // TRANS: Client error trying to register with an invalid invitation code.
$this->clientError(_m('Not a valid invitation code.'));
return;
}
return null;
}
- // Given a string, try to make it work as a nickname
-
+ /**
+ * Given a string, try to make it work as a nickname
+ */
function nicknamize($str)
{
$str = preg_replace('/\W/', '', $str);
return null;
}
}
-
}
function getInstructions()
{
+ // TRANS: Instructions.
return _m('Login with your Facebook Account');
}
function title()
{
+ // TRANS: Page title.
return _m('Facebook Login');
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class FBConnectSettingsAction extends ConnectSettingsAction
{
/**
*/
function title()
{
+ // TRANS: Page title.
return _m('Facebook Connect Settings');
}
*/
function getInstructions()
{
+ // TRANS: Instructions.
return _m('Manage how your account connects to Facebook');
}
$this->elementStart('fieldset');
+ // TRANS: Legend.
$this->element('legend', null, _m('Disconnect my account from Facebook'));
if (!$user->password) {
$this->element('p', 'instructions',
sprintf($note, $site, $site));
- $this->submit('disconnect', _m('Disconnect'));
+ // TRANS: Submit button.
+ $this->submit('disconnect', _m('BUTTON','Disconnect'));
}
$this->elementEnd('fieldset');
$this->showForm(_m('Not sure what you\'re trying to do.'));
return;
}
-
}
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class FacebookPlugin extends Plugin
{
-
const VERSION = STATUSNET_VERSION;
/**
{
// Allow the key and secret to be passed in
// Control panel will override
-
if (isset($this->apikey)) {
$key = common_config('facebook', 'apikey');
if (empty($key)) {
*
* @return boolean result
*/
-
static function hasKeys()
{
$apiKey = common_config('facebook', 'apikey');
*
* @return boolean hook return
*/
-
function onStartInitializeRouter($m)
{
$m->connect('admin/facebook', array('action' => 'facebookadminpanel'));
if (self::hasKeys()) {
-
// Facebook App stuff
$m->connect('facebook/app', array('action' => 'facebookhome'));
* @return boolean hook return
*
*/
-
function onAutoload($cls)
{
switch ($cls) {
*
* @return boolean hook value
*/
-
function onEndAdminPanelNav($nav)
{
if (AdminPanelAction::canAdmin('facebook')) {
$nav->out->menuItem(
common_local_url('facebookadminpanel'),
- _m('Facebook'),
+ // TRANS: Menu item.
+ _m('MENU','Facebook'),
+ // TRANS: Tooltip for menu item "Facebook".
_m('Facebook integration configuration'),
$action_name == 'facebookadminpanel',
'nav_facebook_admin_panel'
*
* @return void
*/
-
function onStartShowHTML($action)
{
-
if ($this->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
'lang' => $language));
return false;
-
} else {
-
return true;
}
}
* @return void
*
*/
-
function onEndShowScripts($action)
{
if ($this->reqFbScripts($action)) {
$js = sprintf($js, $apikey, $login_url, $logout_url);
// Compress the bugger down a bit
-
$js = str_replace(' ', '', $js);
$action->inlineScript($js);
}
-
}
/**
* @return void
*
*/
-
function onEndShowFooter($action)
{
if ($this->reqFbScripts($action)) {
* @return void
*
*/
-
function onEndShowStatusNetStyles($action)
{
if ($this->reqFbScripts($action)) {
*
* @return boolean true
*/
-
function reqFbScripts($action)
{
if (!self::hasKeys()) {
}
// If you're logged in w/FB Connect, you always need the FB stuff
-
$fbuid = $this->loggedIn();
if (!empty($fbuid)) {
}
// List of actions that require FB stuff
-
$needy = array('FBConnectLoginAction',
'FBConnectauthAction',
'FBConnectSettingsAction');
}
return false;
-
}
/**
*
* @return mixed $fbuid the Facebook ID of the logged in user, or null
*/
-
function loggedIn()
{
$user = common_current_user();
$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: ' .
* @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. */
$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');
*
* @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;
}
*
* @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;
}
*
* @return void
*/
-
function onStartLogout($action)
{
if (self::hasKeys()) {
*
* @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));
*
* @return boolean hook return
*/
-
function onStartEnqueueNotice($notice, &$transports)
{
if (self::hasKeys() && $notice->isLocal()) {
'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 ' .
'<a href="http://facebook.com/">Facebook</a> ' .
'and Facebook Connect.'
)
);
return true;
}
-
}
class FacebookAction extends Action
{
-
var $facebook = null;
var $fbuid = null;
var $flink = null;
*
* @return void
*/
-
function startHTML($type=null)
{
$this->showStylesheets();
function showHead($error, $success)
{
-
if ($error) {
$this->element("h1", null, $error);
}
$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')) {
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');
}
($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');
$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');
$this->elementEnd('div');
$this->elementEnd('div');
-
}
function updateProfileBox($notice)
function saveNewNotice()
{
-
$user = $this->flink->getUser();
$content = $this->trimmed('status_textarea');
$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;
$cmd = $inter->handle_command($user, $content_shortened);
if ($cmd) {
-
// XXX fix this
-
$cmd->execute(new WebChannel());
return;
}
}
}
-
}
class FacebookNoticeList extends NoticeList
{
-
/**
* constructor
*
*
* @return int count of notices listed.
*/
-
function show()
{
$this->out->elementStart('div', array('id' =>'notices_primary'));
* @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
*
*
* @param Notice $notice The notice we'll display
*/
-
function __construct($notice, $out=null)
{
parent::__construct($notice, $out);
*
* @return void
*/
-
function show()
{
$this->showStart();
$this->showEnd();
}
-
}
class FacebookProfileBoxNotice extends FacebookNoticeListItem
{
-
/**
* constructor
*
*
* @param Notice $notice The notice we'll display
*/
-
function __construct($notice, $out=null)
{
parent::__construct($notice, $out);
*
* @return void
*/
-
function show()
{
$this->showNotice();
function showAppLink()
{
-
$this->facebook = getFacebook();
$app_props = $this->facebook->api_client->Admin_getAppProperties(
$this->out->text($this->app_name);
$this->out->elementEnd('a');
}
-
}
* @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
{
/**
*
* @return string page title
*/
-
function title()
{
return _m('Facebook');
*
* @return string instructions
*/
-
function getInstructions()
{
return _m('Facebook integration settings');
*
* @return void
*/
-
function showForm()
{
$form = new FacebookAdminPanelForm($this);
*
* @return void
*/
-
function saveSettings()
{
static $settings = array(
}
// This throws an exception on validation errors
-
$this->validate($values);
// assert(all values are valid);
*
* @return int ID of the form
*/
-
function id()
{
return 'facebookadminpanel';
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_settings';
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('facebookadminpanel');
*
* @return void
*/
-
function formData()
{
$this->out->elementStart(
*
* @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'));
}
}
class FacebookhomeAction extends FacebookAction
{
-
var $page = null;
function prepare($argarray)
}
if ($this->flink) {
-
$this->user = $this->flink->getUser();
// If this is the first time the user has started the app
// 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'));
$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');
$this->getUpdatePermission();
return;
-
} else {
$msg = _m('Incorrect username or password.');
}
$this->showLoginForm($msg);
$this->showFooter();
-
}
function setDefaults()
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);
}
}
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);
'&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');
$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');
-
}
/**
*/
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.
$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');
}
$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');
}
$this->elementEnd('dl');
}
}
-
}
class FacebookinviteAction extends FacebookAction
{
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showForm($error=null)
{
$this->error = $error;
*
* @return void
*/
-
function showContent()
{
if ($this->arg('ids')) {
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?
$this->elementEnd('li');
}
- $this->elementEnd("ul");
-
+ $this->elementEnd('ul');
}
function showFormContent()
'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');
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'));
function title()
{
+ // TRANS: Page title.
return sprintf(_m('Send invitations'));
}
-
}
class FacebookinviteAction extends FacebookAction
{
-
function handle($args)
{
parent::handle($args);
$this->facebook->api_client->data_getUserPreference(
FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') {
+ // @todo FIXME: Missing i18n?
echo '<h1>REDIRECT TO HOME</h1>';
}
} else {
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
}
if ($this->flink) {
-
$this->user = $this->flink->getUser();
// If this is the first time the user has started the app
return;
}
}
-
} else {
$this->showLoginForm();
}
function title()
{
+ // @todo FIXME: Give a more precise description? Suggestion: "Login with Facebook Connect"
+ // TRANS: Page title.
return sprintf(_m('Login'));
}
{
}
-
}
/**
* 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
*
* @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;
/**
* @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);
} 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
*
* @return string ID of the form
*/
-
function id()
{
return 'form_notice';
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_notice';
*
* @return string URL of the action
*/
-
function action()
{
return $this->post_action;
*/
function formLegend()
{
- $this->out->element('legend', null, _('Send a notice'));
+ // TRANS: Legend.
+ $this->out->element('legend', null, _m('Send a notice'));
}
/**
*
* @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,
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');
*
* @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')));
}
}
class FacebookremoveAction extends FacebookAction
{
-
function handle($args)
{
parent::handle($args);
'unsuccessfully tried to remove a foreign link to Facebook!');
}
}
-
}
class FacebooksettingsAction extends FacebookAction
{
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showContent()
{
if ($this->arg('save')) {
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);
}
}
$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);
$this->elementEnd('li');
$this->elementEnd('ul');
}
-
}
function title()
{
+ // TRANS: Page title for synchronisation settings.
return _m('Sync preferences');
}
-
}
}
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.');
}
// 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.');
// 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)
);
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"
// 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);
}
// Post to Facebook
-
if ($notice->hasAttachments() && $canPublish == 1) {
publishStream($notice, $user, $fbuid);
} elseif ($canUpdate == 1 || $canPublish == 1) {
}
// Finally, attempt to update the user's profile box
-
if ($canPublish == 1 || $canUpdate == 1) {
updateProfileBox($facebook, $flink, $notice, $user);
}
common_log(LOG_WARNING, $msg);
}
-
}
/**
*
* @return boolean success flag
*/
-
function mail_facebook_app_removed($user)
{
$profile = $user->getProfile();
common_switch_locale();
return mail_to_user($user, $subject, $body);
-
}