}
require_once INSTALLDIR.'/lib/connectsettingsaction.php';
+require_once INSTALLDIR.'/lib/twitter.php';
define('SUBSCRIPTIONS', 80);
function title()
{
- _('Twitter settings');
+ return _('Twitter settings');
}
/**
$fuser = null;
- $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
+ $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
if ($flink) {
$fuser = $flink->getForeignUser();
$this->elementStart('fieldset', array('id' => 'settings_twitter_account'));
$this->element('legend', null, _('Twitter Account'));
$this->hidden('token', common_session_token());
- $this->elementStart('ul', 'form_datas');
if ($fuser) {
- $this->elementStart('li');
+ $this->elementStart('ul', 'form_data');
+ $this->elementStart('li', array('id' => 'settings_twitter_remove'));
$this->element('span', 'twitter_user', $fuser->nickname);
$this->element('a', array('href' => $fuser->uri), $fuser->uri);
- $this->element('p', 'form_guide',
+ $this->element('p', 'form_note',
_('Current verified Twitter account.'));
$this->hidden('flink_foreign_id', $flink->foreign_id);
- $this->submit('remove', _('Remove'));
$this->elementEnd('li');
+ $this->elementEnd('ul');
+ $this->submit('remove', _('Remove'));
} else {
- $this->elementStart('li');
+ $this->elementStart('ul', 'form_data');
+ $this->elementStart('li', array('id' => 'settings_twitter_login'));
$this->input('twitter_username', _('Twitter user name'),
($this->arg('twitter_username')) ?
$this->arg('twitter_username') :
$this->elementStart('li');
$this->password('twitter_password', _('Twitter password'));
$this->elementend('li');
+ $this->elementEnd('ul');
}
- $this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementStart('fieldset',
array('id' => 'settings_twitter_preferences'));
$this->element('legend', null, _('Preferences'));
- $this->elementStart('ul');
+ $this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->checkbox('noticesync',
_('Automatically send my notices to Twitter.'),
$friends_count = count($friends);
if ($friends_count > 0) {
-
- $this->element('h3', null, _('Twitter Friends'));
- $this->elementStart('div', array('id' => 'subscriptions'));
- $this->elementStart('ul', array('id' => 'subscriptions_avatars'));
+ $this->elementStart('div', array('id' => 'entity_subscriptions',
+ 'class' => 'section'));
+ $this->element('h2', null, _('Twitter Friends'));
+ $this->elementStart('ul', 'entities users xoxo');
for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
continue;
}
- $this->elementStart('li');
+ $this->elementStart('li', 'vcard');
$this->elementStart('a', array('title' => ($other->fullname) ?
$other->fullname :
$other->nickname,
'href' => $other->profileurl,
- 'rel' => 'contact',
- 'class' => 'subscription'));
+ 'class' => 'url'));
$avatar = $other->getAvatar(AVATAR_MINI_SIZE);
$avatar_url = ($avatar) ?
- common_avatar_display_url($avatar) :
- common_default_avatar(AVATAR_MINI_SIZE);
+ $avatar->displayUrl() :
+ Avatar::defaultImage(AVATAR_MINI_SIZE);
$this->element('img', array('src' => $avatar_url,
'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE,
- 'class' => 'avatar mini',
+ 'class' => 'avatar photo',
'alt' => ($other->fullname) ?
$other->fullname :
$other->nickname));
+
+ $this->element('span', 'fn nickname', $other->nickname);
$this->elementEnd('a');
$this->elementEnd('li');
$flink->user_id = $user->id;
$flink->foreign_id = $twit_user->id;
- $flink->service = 1; // Twitter
+ $flink->service = TWITTER_SERVICE;
$flink->credentials = $password;
$flink->created = common_sql_now();
function verifyCredentials($screen_name, $password)
{
- $uri = 'http://twitter.com/account/verifyCredentials.json';
+ $uri = 'http://twitter.com/account/verify_credentials.json';
$data = get_twitter_data($uri, $screen_name, $password);