Convert all actions to use new UI functions

I did a massive search-and-replace to get all the action subclasses to
use the new output function (common_element() -> $this->element(), etc.)

There's still a lot to do, but it's a first step
This commit is contained in:
Evan Prodromou 2009-01-15 22:57:15 +00:00
parent 2b2fb27621
commit eaa81d25fa
55 changed files with 799 additions and 780 deletions

View File

@ -57,7 +57,7 @@ class AllAction extends StreamAction
function show_header($user)
{
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('allrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rss+xml',

View File

@ -159,10 +159,10 @@ class ApiAction extends Action
if ($this->content_type == 'xml') {
header('Content-Type: application/xml; charset=utf-8');
common_start_xml();
common_element_start('hash');
common_element('error', null, $msg);
common_element('request', null, $_SERVER['REQUEST_URI']);
common_element_end('hash');
$this->elementStart('hash');
$this->element('error', null, $msg);
$this->element('request', null, $_SERVER['REQUEST_URI']);
$this->elementEnd('hash');
common_end_xml();
} else if ($this->content_type == 'json') {
header('Content-Type: application/json; charset=utf-8');

View File

@ -81,34 +81,34 @@ class BlockAction extends Action
common_show_header(_('Block user'));
common_element('p', null,
$this->element('p', null,
_('Are you sure you want to block this user? '.
'Afterwards, they will be unsubscribed from you, '.
'unable to subscribe to you in the future, and '.
'you will not be notified of any @-replies from them.'));
common_element_start('form', array('id' => 'block-' . $id,
$this->elementStart('form', array('id' => 'block-' . $id,
'method' => 'post',
'class' => 'block',
'action' => common_local_url('block')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
common_element('input', array('id' => 'blockto-' . $id,
$this->element('input', array('id' => 'blockto-' . $id,
'name' => 'blockto',
'type' => 'hidden',
'value' => $id));
foreach ($this->args as $k => $v) {
if (substr($k, 0, 9) == 'returnto-') {
common_hidden($k, $v);
$this->hidden($k, $v);
}
}
common_submit('no', _('No'));
common_submit('yes', _('Yes'));
$this->submit('no', _('No'));
$this->submit('yes', _('Yes'));
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}

View File

@ -90,7 +90,7 @@ class ConfirmaddressAction extends Action
$cur->query('COMMIT');
common_show_header(_('Confirm Address'));
common_element('p', null,
$this->element('p', null,
sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
common_show_footer();
}

View File

@ -51,24 +51,24 @@ class DeletenoticeAction extends DeleteAction
common_show_header($this->get_title(), array($this, 'show_header'), $error,
array($this, 'show_top'));
common_element_start('form', array('id' => 'notice_delete_form',
$this->elementStart('form', array('id' => 'notice_delete_form',
'method' => 'post',
'action' => common_local_url('deletenotice')));
common_hidden('token', common_session_token());
common_hidden('notice', $this->trimmed('notice'));
common_element_start('p');
common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
$this->hidden('token', common_session_token());
$this->hidden('notice', $this->trimmed('notice'));
$this->elementStart('p');
$this->element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
common_element('input', array('id' => 'submit_no',
$this->element('input', array('id' => 'submit_no',
'name' => 'submit',
'type' => 'submit',
'value' => _('No')));
common_element('input', array('id' => 'submit_yes',
$this->element('input', array('id' => 'submit_yes',
'name' => 'submit',
'type' => 'submit',
'value' => _('Yes')));
common_element_end('p');
common_element_end('form');
$this->elementEnd('p');
$this->elementEnd('form');
common_show_footer();
}

View File

@ -49,15 +49,15 @@ class DeleteprofileAction extends Action
function show_feeds_list($feeds)
{
common_element_start('div', array('class' => 'feedsdel'));
common_element('p', null, 'Feeds:');
common_element_start('ul', array('class' => 'xoxo'));
$this->elementStart('div', array('class' => 'feedsdel'));
$this->element('p', null, 'Feeds:');
$this->elementStart('ul', array('class' => 'xoxo'));
foreach ($feeds as $key => $value) {
$this->common_feed_item($feeds[$key]);
}
common_element_end('ul');
common_element_end('div');
$this->elementEnd('ul');
$this->elementEnd('div');
}
//TODO move to common.php (and retrace its origin)
@ -81,19 +81,19 @@ class DeleteprofileAction extends Action
$feed['textContent'] = "FOAF";
break;
}
common_element_start('li');
common_element('a', array('href' => $feed['href'],
$this->elementStart('li');
$this->element('a', array('href' => $feed['href'],
'class' => $feed_classname,
'type' => $feed_mimetype,
'title' => $feed_title),
$feed['textContent']);
common_element_end('li');
$this->elementEnd('li');
}
function show_form($msg=null, $success=false)
{
$this->form_header(_('Delete my account'), $msg, $success);
common_element('h2', null, _('Delete my account confirmation'));
$this->element('h2', null, _('Delete my account confirmation'));
$this->show_confirm_delete_form();
common_show_footer();
}
@ -105,13 +105,13 @@ class DeleteprofileAction extends Action
$notices->profile_id = $user->id;
$notice_count = (int) $notices->count();
common_element_start('form', array('method' => 'POST',
$this->elementStart('form', array('method' => 'POST',
'id' => 'delete',
'action' =>
common_local_url('deleteprofile')));
common_hidden('token', common_session_token());
common_element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
$this->hidden('token', common_session_token());
$this->element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
$this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
'type' => 'rss',
@ -122,10 +122,10 @@ class DeleteprofileAction extends Action
'version' => 'FOAF',
'item' => 'foaf')));
common_checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
$this->checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
common_submit('deleteaccount', _('Delete my account'));
common_element_end('form');
$this->submit('deleteaccount', _('Delete my account'));
$this->elementEnd('form');
}
function handle_post()
@ -238,9 +238,9 @@ class DeleteprofileAction extends Action
} else {
$inst = $this->get_instructions();
$output = common_markup_to_html($inst);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
}
$this->settings_menu();
}
@ -272,7 +272,7 @@ class DeleteprofileAction extends Action
_('Other options')));
$action = $this->trimmed('action');
common_element_start('ul', array('id' => 'nav_views'));
$this->elementStart('ul', array('id' => 'nav_views'));
foreach ($menu as $menuaction => $menudesc) {
if ($menuaction == 'imsettings' &&
!common_config('xmpp', 'enabled')) {
@ -283,7 +283,7 @@ class DeleteprofileAction extends Action
$menudesc[1],
$action == $menuaction);
}
common_element_end('ul');
$this->elementEnd('ul');
}
}

View File

@ -70,13 +70,13 @@ class DisfavorAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Add to favorites'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Add to favorites'));
$this->elementEnd('head');
$this->elementStart('body');
common_favor_form($notice);
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('showfavorites',
array('nickname' => $user->nickname)));

View File

@ -34,7 +34,7 @@ class DocAction extends Action
$c = file_get_contents($filename);
$output = common_markup_to_html($c);
common_show_header(_(ucfirst($title)));
common_raw($output);
$this->raw($output);
common_show_footer();
}
}

View File

@ -33,83 +33,83 @@ class EmailsettingsAction extends SettingsAction
{
$user = common_current_user();
$this->form_header(_('Email Settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'emailsettings',
'action' =>
common_local_url('emailsettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
common_element('h2', null, _('Address'));
$this->element('h2', null, _('Address'));
if ($user->email) {
common_element_start('p');
common_element('span', 'address confirmed', $user->email);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address confirmed', $user->email);
$this->element('span', 'input_instructions',
_('Current confirmed email address.'));
common_hidden('email', $user->email);
common_element_end('p');
common_submit('remove', _('Remove'));
$this->hidden('email', $user->email);
$this->elementEnd('p');
$this->submit('remove', _('Remove'));
} else {
$confirm = $this->get_confirmation();
if ($confirm) {
common_element_start('p');
common_element('span', 'address unconfirmed', $confirm->address);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address unconfirmed', $confirm->address);
$this->element('span', 'input_instructions',
_('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
common_hidden('email', $confirm->address);
common_element_end('p');
common_submit('cancel', _('Cancel'));
$this->hidden('email', $confirm->address);
$this->elementEnd('p');
$this->submit('cancel', _('Cancel'));
} else {
common_input('email', _('Email Address'),
$this->input('email', _('Email Address'),
($this->arg('email')) ? $this->arg('email') : null,
_('Email address, like "UserName@example.org"'));
common_submit('add', _('Add'));
$this->submit('add', _('Add'));
}
}
if ($user->email) {
common_element('h2', null, _('Incoming email'));
$this->element('h2', null, _('Incoming email'));
if ($user->incomingemail) {
common_element_start('p');
common_element('span', 'address', $user->incomingemail);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address', $user->incomingemail);
$this->element('span', 'input_instructions',
_('Send email to this address to post new notices.'));
common_element_end('p');
common_submit('removeincoming', _('Remove'));
$this->elementEnd('p');
$this->submit('removeincoming', _('Remove'));
}
common_element_start('p');
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'input_instructions',
_('Make a new email address for posting to; cancels the old one.'));
common_element_end('p');
common_submit('newincoming', _('New'));
$this->elementEnd('p');
$this->submit('newincoming', _('New'));
}
common_element('h2', null, _('Preferences'));
$this->element('h2', null, _('Preferences'));
common_checkbox('emailnotifysub',
$this->checkbox('emailnotifysub',
_('Send me notices of new subscriptions through email.'),
$user->emailnotifysub);
common_checkbox('emailnotifyfav',
$this->checkbox('emailnotifyfav',
_('Send me email when someone adds my notice as a favorite.'),
$user->emailnotifyfav);
common_checkbox('emailnotifymsg',
$this->checkbox('emailnotifymsg',
_('Send me email when someone sends me a private message.'),
$user->emailnotifymsg);
common_checkbox('emailnotifynudge',
$this->checkbox('emailnotifynudge',
_('Allow friends to nudge me and send me an email.'),
$user->emailnotifynudge);
common_checkbox('emailpost',
$this->checkbox('emailpost',
_('I want to post notices by email.'),
$user->emailpost);
common_checkbox('emailmicroid',
$this->checkbox('emailmicroid',
_('Publish a MicroID for my email address.'),
$user->emailmicroid);
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}

View File

@ -105,7 +105,7 @@ class FacebookhomeAction extends FacebookAction
$this->show_header('Home');
if ($msg) {
common_element('fb:success', array('message' => $msg));
$this->element('fb:success', array('message' => $msg));
}
echo $this->show_notices($user);

View File

@ -43,22 +43,22 @@ class FacebookinviteAction extends FacebookAction
$this->show_header('Invite');
common_element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
common_element('p', null, _('Invitations have been sent to the following users:'));
$this->element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
$this->element('p', null, _('Invitations have been sent to the following users:'));
$friend_ids = $_POST['ids']; // Hmm... $this->arg('ids') doesn't seem to work
common_element_start("ul");
$this->elementStart("ul");
foreach ($friend_ids as $friend) {
common_element_start('li');
common_element('fb:profile-pic', array('uid' => $friend));
common_element('fb:name', array('uid' => $friend,
$this->elementStart('li');
$this->element('fb:profile-pic', array('uid' => $friend));
$this->element('fb:name', array('uid' => $friend,
'capitalize' => 'true'));
common_element_end('li');
$this->elementEnd('li');
}
common_element_end("ul");
$this->elementEnd("ul");
$this->show_footer();
}
@ -77,32 +77,32 @@ class FacebookinviteAction extends FacebookAction
$content = _('You have been invited to Identi.ca!') .
htmlentities('<fb:req-choice url="http://apps.facebook.com/identica_app/" label="Add"/>');
common_element_start('fb:request-form', array('action' => 'invite.php',
$this->elementStart('fb:request-form', array('action' => 'invite.php',
'method' => 'post',
'invite' => 'true',
'type' => 'Identi.ca',
'content' => $content));
common_hidden('invite', 'true');
$this->hidden('invite', 'true');
$actiontext = 'Invite your friends to use Identi.ca.';
common_element('fb:multi-friend-selector', array('showborder' => 'false',
$this->element('fb:multi-friend-selector', array('showborder' => 'false',
'actiontext' => $actiontext,
'exclude_ids' => implode(',', $exclude_ids),
'bypass' => 'cancel'));
common_element_end('fb:request-form');
$this->elementEnd('fb:request-form');
common_element('h2', null, _('Friends already using Identi.ca:'));
common_element_start("ul");
$this->element('h2', null, _('Friends already using Identi.ca:'));
$this->elementStart("ul");
foreach ($exclude_ids as $friend) {
common_element_start('li');
common_element('fb:profile-pic', array('uid' => $friend));
common_element('fb:name', array('uid' => $friend,
$this->elementStart('li');
$this->element('fb:profile-pic', array('uid' => $friend));
$this->element('fb:name', array('uid' => $friend,
'capitalize' => 'true'));
common_element_end('li');
$this->elementEnd('li');
}
common_element_end("ul");
$this->elementEnd("ul");
$this->show_footer();

View File

@ -68,43 +68,43 @@ class FacebooksettingsAction extends FacebookAction
$this->show_header('Settings', $msg, $success);
common_element_start('fb:if-section-not-added', array('section' => 'profile'));
common_element('h2', null, _('Add an Identi.ca box to my profile'));
common_element_start('p');
common_element('fb:add-section-button', array('section' => 'profile'));
common_element_end('p');
$this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
$this->element('h2', null, _('Add an Identi.ca box to my profile'));
$this->elementStart('p');
$this->element('fb:add-section-button', array('section' => 'profile'));
$this->elementEnd('p');
common_element_end('fb:if-section-not-added');
common_element_start('p');
common_element_start('fb:prompt-permission', array('perms' => 'status_update'));
common_element('h2', null, _('Allow Identi.ca to update my Facebook status'));
common_element_end('fb:prompt-permission');
common_element_end('p');
$this->elementEnd('fb:if-section-not-added');
$this->elementStart('p');
$this->elementStart('fb:prompt-permission', array('perms' => 'status_update'));
$this->element('h2', null, _('Allow Identi.ca to update my Facebook status'));
$this->elementEnd('fb:prompt-permission');
$this->elementEnd('p');
if ($facebook->api_client->users_hasAppPermission('status_update')) {
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'facebook_settings'));
common_element('h2', null, _('Sync preferences'));
$this->element('h2', null, _('Sync preferences'));
common_checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
$this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
common_checkbox('replysync', _('Send local "@" replies to Facebook.'),
$this->checkbox('replysync', _('Send local "@" replies to Facebook.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
// function common_input($id, $label, $value=null,$instructions=null)
// function $this->input($id, $label, $value=null,$instructions=null)
$prefix = $facebook->api_client->data_getUserPreference(1);
common_input('prefix', _('Prefix'),
$this->input('prefix', _('Prefix'),
($prefix) ? $prefix : null,
_('A string to prefix notices with.'));
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
}

View File

@ -69,13 +69,13 @@ class FavorAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Disfavor favorite'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Disfavor favorite'));
$this->elementEnd('head');
$this->elementStart('body');
common_disfavor_form($notice);
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('showfavorites',
array('nickname' => $user->nickname)));

View File

@ -43,9 +43,9 @@ class FavoritedAction extends StreamAction
{
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
$this->public_views_menu();
}
@ -81,7 +81,7 @@ class FavoritedAction extends StreamAction
$notice = new Notice;
$notice->query(sprintf($qry, common_config('popular', 'dropoff')));
common_element_start('ul', array('id' => 'notices'));
$this->elementStart('ul', array('id' => 'notices'));
$cnt = 0;
@ -96,7 +96,7 @@ class FavoritedAction extends StreamAction
$item->show();
}
common_element_end('ul');
$this->elementEnd('ul');
common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'favorited');

View File

@ -44,9 +44,9 @@ class FeaturedAction extends StreamAction
{
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
$this->public_views_menu();
}

View File

@ -101,7 +101,7 @@ class FinishaddopenidAction extends Action
function message($msg)
{
common_show_header(_('OpenID Login'));
common_element('p', null, $msg);
$this->element('p', null, $msg);
common_show_footer();
}
}

View File

@ -57,10 +57,10 @@ class FinishopenidloginAction extends Action
function show_top($error=null)
{
if ($error) {
common_element('div', array('class' => 'error'), $error);
$this->element('div', array('class' => 'error'), $error);
} else {
global $config;
common_element('div', 'instructions',
$this->element('div', 'instructions',
sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
}
}
@ -70,36 +70,36 @@ class FinishopenidloginAction extends Action
common_show_header(_('OpenID Account Setup'), null, $error,
array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'account_connect',
'action' => common_local_url('finishopenidlogin')));
common_hidden('token', common_session_token());
common_element('h2', null,
$this->hidden('token', common_session_token());
$this->element('h2', null,
_('Create new account'));
common_element('p', null,
$this->element('p', null,
_('Create a new user with this nickname.'));
common_input('newname', _('New nickname'),
$this->input('newname', _('New nickname'),
($username) ? $username : '',
_('1-64 lowercase letters or numbers, no punctuation or spaces'));
common_element_start('p');
common_element('input', array('type' => 'checkbox',
$this->elementStart('p');
$this->element('input', array('type' => 'checkbox',
'id' => 'license',
'name' => 'license',
'value' => 'true'));
common_text(_('My text and files are available under '));
common_element('a', array(href => common_config('license', 'url')),
$this->text(_('My text and files are available under '));
$this->element('a', array(href => common_config('license', 'url')),
common_config('license', 'title'));
common_text(_(' except this private data: password, email address, IM address, phone number.'));
common_element_end('p');
common_submit('create', _('Create'));
common_element('h2', null,
$this->text(_(' except this private data: password, email address, IM address, phone number.'));
$this->elementEnd('p');
$this->submit('create', _('Create'));
$this->element('h2', null,
_('Connect existing account'));
common_element('p', null,
$this->element('p', null,
_('If you already have an account, login with your username and password to connect it to your OpenID.'));
common_input('nickname', _('Existing nickname'));
common_password('password', _('Password'));
common_submit('connect', _('Connect'));
common_element_end('form');
$this->input('nickname', _('Existing nickname'));
$this->password('password', _('Password'));
$this->submit('connect', _('Connect'));
$this->elementEnd('form');
common_show_footer();
}
@ -154,7 +154,7 @@ class FinishopenidloginAction extends Action
function message($msg)
{
common_show_header(_('OpenID Login'));
common_element('p', null, $msg);
$this->element('p', null, $msg);
common_show_footer();
}

View File

@ -54,7 +54,7 @@ class FoafAction extends Action
header('Content-Type: application/rdf+xml');
common_start_xml();
common_element_start('rdf:RDF', array('xmlns:rdf' =>
$this->elementStart('rdf:RDF', array('xmlns:rdf' =>
'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'xmlns:rdfs' =>
'http://www.w3.org/2000/01/rdf-schema#',
@ -67,25 +67,25 @@ class FoafAction extends Action
$this->show_ppd('', $user->uri);
# XXX: might not be a person
common_element_start('Person', array('rdf:about' =>
$this->elementStart('Person', array('rdf:about' =>
$user->uri));
common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
$this->element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
if ($profile->fullname) {
common_element('name', null, $profile->fullname);
$this->element('name', null, $profile->fullname);
}
if ($profile->homepage) {
common_element('homepage', array('rdf:resource' => $profile->homepage));
$this->element('homepage', array('rdf:resource' => $profile->homepage));
}
if ($profile->bio) {
common_element('rdfs:comment', null, $profile->bio);
$this->element('rdfs:comment', null, $profile->bio);
}
# XXX: more structured location data
if ($profile->location) {
common_element_start('based_near');
common_element_start('geo:SpatialThing');
common_element('name', null, $profile->location);
common_element_end('geo:SpatialThing');
common_element_end('based_near');
$this->elementStart('based_near');
$this->elementStart('geo:SpatialThing');
$this->element('name', null, $profile->location);
$this->elementEnd('geo:SpatialThing');
$this->elementEnd('based_near');
}
$this->show_microblogging_account($profile, common_root_url());
@ -93,18 +93,18 @@ class FoafAction extends Action
$avatar = $profile->getOriginalAvatar();
if ($avatar) {
common_element_start('img');
common_element_start('Image', array('rdf:about' => $avatar->url));
$this->elementStart('img');
$this->elementStart('Image', array('rdf:about' => $avatar->url));
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
$scaled = $profile->getAvatar($size);
if (!$scaled->original) { # sometimes the original has one of our scaled sizes
common_element_start('thumbnail');
common_element('Image', array('rdf:about' => $scaled->url));
common_element_end('thumbnail');
$this->elementStart('thumbnail');
$this->element('Image', array('rdf:about' => $scaled->url));
$this->elementEnd('thumbnail');
}
}
common_element_end('Image');
common_element_end('img');
$this->elementEnd('Image');
$this->elementEnd('img');
}
# Get people user is subscribed to
@ -126,7 +126,7 @@ class FoafAction extends Action
common_debug('Got a bad subscription: '.print_r($sub,true));
continue;
}
common_element('knows', array('rdf:resource' => $other->uri));
$this->element('knows', array('rdf:resource' => $other->uri));
$person[$other->uri] = array(LISTENEE, $other);
}
}
@ -156,7 +156,7 @@ class FoafAction extends Action
}
}
common_element_end('Person');
$this->elementEnd('Person');
foreach ($person as $uri => $p) {
$foaf_url = null;
@ -164,44 +164,44 @@ class FoafAction extends Action
$foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
}
$profile = Profile::staticGet($p[1]->id);
common_element_start('Person', array('rdf:about' => $uri));
$this->elementStart('Person', array('rdf:about' => $uri));
if ($p[0] == LISTENER || $p[0] == BOTH) {
common_element('knows', array('rdf:resource' => $user->uri));
$this->element('knows', array('rdf:resource' => $user->uri));
}
$this->show_microblogging_account($profile, ($p[1] instanceof User) ?
common_root_url() : null);
if ($foaf_url) {
common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
$this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
}
common_element_end('Person');
$this->elementEnd('Person');
if ($foaf_url) {
$this->show_ppd($foaf_url, $uri);
}
}
common_element_end('rdf:RDF');
$this->elementEnd('rdf:RDF');
}
function show_ppd($foaf_url, $person_uri)
{
common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
common_element('maker', array('rdf:resource' => $person_uri));
common_element('primaryTopic', array('rdf:resource' => $person_uri));
common_element_end('PersonalProfileDocument');
$this->elementStart('PersonalProfileDocument', array('rdf:about' => $foaf_url));
$this->element('maker', array('rdf:resource' => $person_uri));
$this->element('primaryTopic', array('rdf:resource' => $person_uri));
$this->elementEnd('PersonalProfileDocument');
}
function show_microblogging_account($profile, $service=null)
{
# Their account
common_element_start('holdsAccount');
common_element_start('OnlineAccount');
$this->elementStart('holdsAccount');
$this->elementStart('OnlineAccount');
if ($service) {
common_element('accountServiceHomepage', array('rdf:resource' =>
$this->element('accountServiceHomepage', array('rdf:resource' =>
$service));
}
common_element('accountName', null, $profile->nickname);
common_element('homepage', array('rdf:resource' => $profile->profileurl));
common_element_end('OnlineAccount');
common_element_end('holdsAccount');
$this->element('accountName', null, $profile->nickname);
$this->element('homepage', array('rdf:resource' => $profile->profileurl));
$this->elementEnd('OnlineAccount');
$this->elementEnd('holdsAccount');
}
}

View File

@ -34,57 +34,57 @@ class ImsettingsAction extends SettingsAction
{
$user = common_current_user();
$this->form_header(_('IM Settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'imsettings',
'action' =>
common_local_url('imsettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
common_element('h2', null, _('Address'));
$this->element('h2', null, _('Address'));
if ($user->jabber) {
common_element_start('p');
common_element('span', 'address confirmed', $user->jabber);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address confirmed', $user->jabber);
$this->element('span', 'input_instructions',
_('Current confirmed Jabber/GTalk address.'));
common_hidden('jabber', $user->jabber);
common_element_end('p');
common_submit('remove', _('Remove'));
$this->hidden('jabber', $user->jabber);
$this->elementEnd('p');
$this->submit('remove', _('Remove'));
} else {
$confirm = $this->get_confirmation();
if ($confirm) {
common_element_start('p');
common_element('span', 'address unconfirmed', $confirm->address);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address unconfirmed', $confirm->address);
$this->element('span', 'input_instructions',
sprintf(_('Awaiting confirmation on this address. Check your Jabber/GTalk account for a message with further instructions. (Did you add %s to your buddy list?)'), jabber_daemon_address()));
common_hidden('jabber', $confirm->address);
common_element_end('p');
common_submit('cancel', _('Cancel'));
$this->hidden('jabber', $confirm->address);
$this->elementEnd('p');
$this->submit('cancel', _('Cancel'));
} else {
common_input('jabber', _('IM Address'),
$this->input('jabber', _('IM Address'),
($this->arg('jabber')) ? $this->arg('jabber') : null,
sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
common_submit('add', _('Add'));
$this->submit('add', _('Add'));
}
}
common_element('h2', null, _('Preferences'));
$this->element('h2', null, _('Preferences'));
common_checkbox('jabbernotify',
$this->checkbox('jabbernotify',
_('Send me notices through Jabber/GTalk.'),
$user->jabbernotify);
common_checkbox('updatefrompresence',
$this->checkbox('updatefrompresence',
_('Post a notice when my Jabber/GTalk status changes.'),
$user->updatefrompresence);
common_checkbox('jabberreplies',
$this->checkbox('jabberreplies',
_('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
$user->jabberreplies);
common_checkbox('jabbermicroid',
$this->checkbox('jabbermicroid',
_('Publish a MicroID for my Jabber/GTalk address.'),
$user->jabbermicroid);
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}

View File

@ -89,29 +89,29 @@ class InviteAction extends Action
common_show_header(_('Invitation(s) sent'));
if ($already) {
common_element('p', null, _('You are already subscribed to these users:'));
common_element_start('ul');
$this->element('p', null, _('You are already subscribed to these users:'));
$this->elementStart('ul');
foreach ($already as $other) {
common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
$this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
}
common_element_end('ul');
$this->elementEnd('ul');
}
if ($subbed) {
common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
common_element_start('ul');
$this->element('p', null, _('These people are already users and you were automatically subscribed to them:'));
$this->elementStart('ul');
foreach ($subbed as $other) {
common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
$this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
}
common_element_end('ul');
$this->elementEnd('ul');
}
if ($sent) {
common_element('p', null, _('Invitation(s) sent to the following people:'));
common_element_start('ul');
$this->element('p', null, _('Invitation(s) sent to the following people:'));
$this->elementStart('ul');
foreach ($sent as $other) {
common_element('li', null, $other);
$this->element('li', null, $other);
}
common_element_end('ul');
common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
$this->elementEnd('ul');
$this->element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
}
common_show_footer();
}
@ -119,12 +119,12 @@ class InviteAction extends Action
function show_top($error=null)
{
if ($error) {
common_element('p', 'error', $error);
$this->element('p', 'error', $error);
} else {
common_element_start('div', 'instructions');
common_element('p', null,
$this->elementStart('div', 'instructions');
$this->element('p', null,
_('Use this form to invite your friends and colleagues to use this service.'));
common_element_end('div');
$this->elementEnd('div');
}
}
@ -135,22 +135,22 @@ class InviteAction extends Action
common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'invite',
'action' => common_local_url('invite')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
common_textarea('addresses', _('Email addresses'),
$this->textarea('addresses', _('Email addresses'),
$this->trimmed('addresses'),
_('Addresses of friends to invite (one per line)'));
common_textarea('personal', _('Personal message'),
$this->textarea('personal', _('Personal message'),
$this->trimmed('personal'),
_('Optionally add a personal message to the invitation.'));
common_submit('send', _('Send'));
$this->submit('send', _('Send'));
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}

View File

@ -106,22 +106,45 @@ class LoginAction extends Action
function show_form($error=null)
{
common_show_header(_('Login'), null, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
$this->error = $error;
$this->showPage();
}
function title()
{
return _('Login');
}
function showPageNotice()
{
if ($this->error) {
$this->element('p', 'error', $this->error);
} else {
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
}
}
function showContent()
{
$this->elementStart('form', array('method' => 'post',
'id' => 'login',
'action' => common_local_url('login')));
common_input('nickname', _('Nickname'));
common_password('password', _('Password'));
common_checkbox('rememberme', _('Remember me'), false,
$this->input('nickname', _('Nickname'));
$this->password('password', _('Password'));
$this->checkbox('rememberme', _('Remember me'), false,
_('Automatically login in the future; ' .
'not for shared computers!'));
common_submit('submit', _('Login'));
common_hidden('token', common_session_token());
common_element_end('form');
common_element_start('p');
common_element('a', array('href' => common_local_url('recoverpassword')),
$this->submit('submit', _('Login'));
$this->hidden('token', common_session_token());
$this->elementEnd('form');
$this->elementStart('p');
$this->element('a', array('href' => common_local_url('recoverpassword')),
_('Lost or forgotten password?'));
common_element_end('p');
$this->elementEnd('p');
common_show_footer();
}
@ -146,14 +169,5 @@ class LoginAction extends Action
function show_top($error=null)
{
if ($error) {
common_element('p', 'error', $error);
} else {
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
}
}
}

View File

@ -127,7 +127,7 @@ class NewmessageAction extends Action
array($this, 'show_top'));
if ($msg) {
common_element('p', array('id'=>'error'), $msg);
$this->element('p', array('id'=>'error'), $msg);
}
common_show_footer();

View File

@ -92,13 +92,13 @@ class NewnoticeAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Notice posted'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Notice posted'));
$this->elementEnd('head');
$this->elementStart('body');
$this->show_notice($notice);
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
$returnto = $this->trimmed('returnto');
@ -116,13 +116,13 @@ class NewnoticeAction extends Action
function ajax_error_msg($msg)
{
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Ajax Error'));
common_element_end('head');
common_element_start('body');
common_element('p', array('id' => 'error'), $msg);
common_element_end('body');
common_element_end('html');
$this->elementStart('head');
$this->element('title', null, _('Ajax Error'));
$this->elementEnd('head');
$this->elementStart('body');
$this->element('p', array('id' => 'error'), $msg);
$this->elementEnd('body');
$this->elementEnd('html');
}
function show_top($content=null)
@ -147,7 +147,7 @@ class NewnoticeAction extends Action
common_show_header(_('New notice'), null, $content,
array($this, 'show_top'));
if ($msg) {
common_element('p', array('id' => 'error'), $msg);
$this->element('p', array('id' => 'error'), $msg);
}
common_show_footer();
}

View File

@ -58,7 +58,7 @@ class NoticesearchAction extends SearchAction
}
if ($cnt > 0) {
$terms = preg_split('/[\s,]+/', $q);
common_element_start('ul', array('id' => 'notices'));
$this->elementStart('ul', array('id' => 'notices'));
for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
if ($notice->fetch()) {
$this->show_notice($notice, $terms);
@ -67,9 +67,9 @@ class NoticesearchAction extends SearchAction
break;
}
}
common_element_end('ul');
$this->elementEnd('ul');
} else {
common_element('p', 'error', _('No results'));
$this->element('p', 'error', _('No results'));
}
common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
@ -82,7 +82,7 @@ class NoticesearchAction extends SearchAction
$q = $arr[0];
}
if ($q) {
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('noticesearchrss',
array('q' => $q)),
'type' => 'application/rss+xml',
@ -101,58 +101,58 @@ class NoticesearchAction extends SearchAction
return;
}
# XXX: RDFa
common_element_start('li', array('class' => 'notice_single',
$this->elementStart('li', array('class' => 'notice_single',
'id' => 'notice-' . $notice->id));
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
common_element_start('a', array('href' => $profile->profileurl));
common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
$this->elementStart('a', array('href' => $profile->profileurl));
$this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
'class' => 'avatar stream',
'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE,
'alt' =>
($profile->fullname) ? $profile->fullname :
$profile->nickname));
common_element_end('a');
common_element('a', array('href' => $profile->profileurl,
$this->elementEnd('a');
$this->element('a', array('href' => $profile->profileurl,
'class' => 'nickname'),
$profile->nickname);
# FIXME: URL, image, video, audio
common_element_start('p', array('class' => 'content'));
$this->elementStart('p', array('class' => 'content'));
if ($notice->rendered) {
common_raw($this->highlight($notice->rendered, $terms));
$this->raw($this->highlight($notice->rendered, $terms));
} else {
# XXX: may be some uncooked notices in the DB,
# we cook them right now. This should probably disappear in future
# versions (>> 0.4.x)
common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
$this->raw($this->highlight(common_render_content($notice->content, $notice), $terms));
}
common_element_end('p');
$this->elementEnd('p');
$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
common_element_start('p', 'time');
common_element('a', array('class' => 'permalink',
$this->elementStart('p', 'time');
$this->element('a', array('class' => 'permalink',
'href' => $noticeurl,
'title' => common_exact_date($notice->created)),
common_date_string($notice->created));
if ($notice->reply_to) {
$replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
common_text(' (');
common_element('a', array('class' => 'inreplyto',
$this->text(' (');
$this->element('a', array('class' => 'inreplyto',
'href' => $replyurl),
_('in reply to...'));
common_text(')');
$this->text(')');
}
common_element_start('a',
$this->elementStart('a',
array('href' => common_local_url('newnotice',
array('replyto' => $profile->nickname)),
'onclick' => 'doreply("'.$profile->nickname.'"); return false',
'title' => _('reply'),
'class' => 'replybutton'));
common_hidden('posttoken', common_session_token());
$this->hidden('posttoken', common_session_token());
common_raw('&rarr;');
common_element_end('a');
common_element_end('p');
common_element_end('li');
$this->raw('&rarr;');
$this->elementEnd('a');
$this->elementEnd('p');
$this->elementEnd('li');
}
function highlight($text, $terms)

View File

@ -59,13 +59,13 @@ class NudgeAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Nudge sent'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Nudge sent'));
$this->elementEnd('head');
$this->elementStart('body');
common_nudge_response();
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
// display a confirmation to the user
common_redirect(common_local_url('showstream',

View File

@ -66,13 +66,13 @@ class OpenidloginAction extends Action
function show_top($error=null)
{
if ($error) {
common_element('div', array('class' => 'error'), $error);
$this->element('div', array('class' => 'error'), $error);
} else {
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
}
}
@ -80,18 +80,18 @@ class OpenidloginAction extends Action
{
common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
$formaction = common_local_url('openidlogin');
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'openidlogin',
'action' => $formaction));
common_hidden('token', common_session_token());
common_input('openid_url', _('OpenID URL'),
$this->hidden('token', common_session_token());
$this->input('openid_url', _('OpenID URL'),
$openid_url,
_('Your OpenID URL'));
common_checkbox('rememberme', _('Remember me'), false,
$this->checkbox('rememberme', _('Remember me'), false,
_('Automatically login in the future; ' .
'not for shared computers!'));
common_submit('submit', _('Login'));
common_element_end('form');
$this->submit('submit', _('Login'));
$this->elementEnd('form');
common_show_footer();
}
}

View File

@ -39,28 +39,28 @@ class OpenidsettingsAction extends SettingsAction
$this->form_header(_('OpenID settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'openidadd',
'action' =>
common_local_url('openidsettings')));
common_hidden('token', common_session_token());
common_element('h2', null, _('Add OpenID'));
common_element('p', null,
$this->hidden('token', common_session_token());
$this->element('h2', null, _('Add OpenID'));
$this->element('p', null,
_('If you want to add an OpenID to your account, ' .
'enter it in the box below and click "Add".'));
common_element_start('p');
common_element('label', array('for' => 'openid_url'),
$this->elementStart('p');
$this->element('label', array('for' => 'openid_url'),
_('OpenID URL'));
common_element('input', array('name' => 'openid_url',
$this->element('input', array('name' => 'openid_url',
'type' => 'text',
'id' => 'openid_url'));
common_element('input', array('type' => 'submit',
$this->element('input', array('type' => 'submit',
'id' => 'add',
'name' => 'add',
'class' => 'submit',
'value' => _('Add')));
common_element_end('p');
common_element_end('form');
$this->elementEnd('p');
$this->elementEnd('form');
$oid = new User_openid();
$oid->user_id = $user->id;
@ -69,48 +69,48 @@ class OpenidsettingsAction extends SettingsAction
if ($cnt > 0) {
common_element('h2', null, _('Remove OpenID'));
$this->element('h2', null, _('Remove OpenID'));
if ($cnt == 1 && !$user->password) {
common_element('p', null,
$this->element('p', null,
_('Removing your only OpenID would make it impossible to log in! ' .
'If you need to remove it, add another OpenID first.'));
if ($oid->fetch()) {
common_element_start('p');
common_element('a', array('href' => $oid->canonical),
$this->elementStart('p');
$this->element('a', array('href' => $oid->canonical),
$oid->display);
common_element_end('p');
$this->elementEnd('p');
}
} else {
common_element('p', null,
$this->element('p', null,
_('You can remove an OpenID from your account '.
'by clicking the button marked "Remove".'));
$idx = 0;
while ($oid->fetch()) {
common_element_start('form', array('method' => 'POST',
$this->elementStart('form', array('method' => 'POST',
'id' => 'openiddelete' . $idx,
'action' =>
common_local_url('openidsettings')));
common_element_start('p');
common_hidden('token', common_session_token());
common_element('a', array('href' => $oid->canonical),
$this->elementStart('p');
$this->hidden('token', common_session_token());
$this->element('a', array('href' => $oid->canonical),
$oid->display);
common_element('input', array('type' => 'hidden',
$this->element('input', array('type' => 'hidden',
'id' => 'openid_url'.$idx,
'name' => 'openid_url',
'value' => $oid->canonical));
common_element('input', array('type' => 'submit',
$this->element('input', array('type' => 'submit',
'id' => 'remove'.$idx,
'name' => 'remove',
'class' => 'submit',
'value' => _('Remove')));
common_element_end('p');
common_element_end('form');
$this->elementEnd('p');
$this->elementEnd('form');
$idx++;
}
}

View File

@ -41,21 +41,21 @@ class OpensearchAction extends Action
header('Content-Type: text/html');
common_start_xml();
common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
$this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
$short_name = common_config('site', 'name').' '.$short_name;
common_element('ShortName', null, $short_name);
common_element('Contact', null, common_config('site', 'email'));
common_element('Url', array('type' => 'text/html', 'method' => 'get',
$this->element('ShortName', null, $short_name);
$this->element('Contact', null, common_config('site', 'email'));
$this->element('Url', array('type' => 'text/html', 'method' => 'get',
'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
common_element('AdultContent', null, 'false');
common_element('Language', null, common_language());
common_element('OutputEncoding', null, 'UTF-8');
common_element('InputEncoding', null, 'UTF-8');
$this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
$this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
$this->element('AdultContent', null, 'false');
$this->element('Language', null, common_language());
$this->element('OutputEncoding', null, 'UTF-8');
$this->element('InputEncoding', null, 'UTF-8');
common_element_end('OpenSearchDescription');
$this->elementEnd('OpenSearchDescription');
common_end_xml();
}
}

View File

@ -35,12 +35,12 @@ class OthersettingsAction extends SettingsAction
$this->form_header(_('Other Settings'), $msg, $success);
common_element('h2', null, _('URL Auto-shortening'));
common_element_start('form', array('method' => 'post',
$this->element('h2', null, _('URL Auto-shortening'));
$this->elementStart('form', array('method' => 'post',
'id' => 'othersettings',
'action' =>
common_local_url('othersettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
$services = array(
'' => 'None',
@ -54,13 +54,13 @@ class OthersettingsAction extends SettingsAction
'metamark.net' => 'metamark.net'
);
common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
$this->dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
// common_element('h2', null, _('Delete my account'));
// $this->element('h2', null, _('Delete my account'));
// $this->show_delete_form();
common_show_footer();
@ -68,15 +68,15 @@ class OthersettingsAction extends SettingsAction
function show_feeds_list($feeds)
{
common_element_start('div', array('class' => 'feedsdel'));
common_element('p', null, 'Feeds:');
common_element_start('ul', array('class' => 'xoxo'));
$this->elementStart('div', array('class' => 'feedsdel'));
$this->element('p', null, 'Feeds:');
$this->elementStart('ul', array('class' => 'xoxo'));
foreach ($feeds as $key => $value) {
$this->common_feed_item($feeds[$key]);
}
common_element_end('ul');
common_element_end('div');
$this->elementEnd('ul');
$this->elementEnd('div');
}
//TODO move to common.php (and retrace its origin)
@ -100,13 +100,13 @@ class OthersettingsAction extends SettingsAction
$feed['textContent'] = "FOAF";
break;
}
common_element_start('li');
common_element('a', array('href' => $feed['href'],
$this->elementStart('li');
$this->element('a', array('href' => $feed['href'],
'class' => $feed_classname,
'type' => $feed_mimetype,
'title' => $feed_title),
$feed['textContent']);
common_element_end('li');
$this->elementEnd('li');
}
// function show_delete_form() {
@ -115,13 +115,13 @@ class OthersettingsAction extends SettingsAction
// $notices->profile_id = $user->id;
// $notice_count = (int) $notices->count();
//
// common_element_start('form', array('method' => 'POST',
// $this->elementStart('form', array('method' => 'POST',
// 'id' => 'delete',
// 'action' =>
// common_local_url('deleteprofile')));
//
// common_hidden('token', common_session_token());
// common_element('p', null, "You can copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
// $this->hidden('token', common_session_token());
// $this->element('p', null, "You can copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
//
// $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
// 'type' => 'rss',
@ -132,8 +132,8 @@ class OthersettingsAction extends SettingsAction
// 'version' => 'FOAF',
// 'item' => 'foaf')));
//
// common_submit('deleteaccount', _('Delete my account'));
// common_element_end('form');
// $this->submit('deleteaccount', _('Delete my account'));
// $this->elementEnd('form');
// }
function handle_post()

View File

@ -60,7 +60,7 @@ class PeoplesearchAction extends SearchAction
$results = new PeopleSearchResults($profile, $terms);
$results->show_list();
} else {
common_element('p', 'error', _('No results'));
$this->element('p', 'error', _('No results'));
}
$profile->free();

View File

@ -90,11 +90,11 @@ class PeopletagAction extends Action
{
$instr = sprintf(_('These are users who have tagged themselves "%s" ' .
'to show a common interest, characteristic, hobby or job.'), $tag);
common_element_start('div', 'instructions');
common_element_start('p');
common_text($instr);
common_element_end('p');
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->elementStart('p');
$this->text($instr);
$this->elementEnd('p');
$this->elementEnd('div');
}
function get_title()

View File

@ -34,11 +34,11 @@ class ProfilesettingsAction extends SettingsAction
{
$this->form_header(_('Profile settings'), $msg, $success);
$this->show_settings_form();
common_element('h2', null, _('Avatar'));
$this->element('h2', null, _('Avatar'));
$this->show_avatar_form();
common_element('h2', null, _('Change password'));
$this->element('h2', null, _('Change password'));
$this->show_password_form();
// common_element('h2', null, _('Delete my account'));
// $this->element('h2', null, _('Delete my account'));
// $this->show_delete_form();
common_show_footer();
}
@ -74,46 +74,46 @@ class ProfilesettingsAction extends SettingsAction
$user = common_current_user();
$profile = $user->getProfile();
common_element_start('form', array('method' => 'POST',
$this->elementStart('form', array('method' => 'POST',
'id' => 'profilesettings',
'action' => common_local_url('profilesettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
# too much common patterns here... abstractable?
common_input('nickname', _('Nickname'),
$this->input('nickname', _('Nickname'),
($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
_('1-64 lowercase letters or numbers, no punctuation or spaces'));
common_input('fullname', _('Full name'),
$this->input('fullname', _('Full name'),
($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
common_input('homepage', _('Homepage'),
$this->input('homepage', _('Homepage'),
($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
_('URL of your homepage, blog, or profile on another site'));
common_textarea('bio', _('Bio'),
$this->textarea('bio', _('Bio'),
($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
_('Describe yourself and your interests in 140 chars'));
common_input('location', _('Location'),
$this->input('location', _('Location'),
($this->arg('location')) ? $this->arg('location') : $profile->location,
_('Where you are, like "City, State (or Region), Country"'));
common_input('tags', _('Tags'),
$this->input('tags', _('Tags'),
($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
_('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
$language = common_language();
common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
$this->dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
$timezone = common_timezone();
$timezones = array();
foreach(DateTimeZone::listIdentifiers() as $k => $v) {
$timezones[$v] = $v;
}
common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
$this->dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
$this->checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
}
@ -132,62 +132,62 @@ class ProfilesettingsAction extends SettingsAction
$original = $profile->getOriginalAvatar();
common_element_start('form', array('enctype' => 'multipart/form-data',
$this->elementStart('form', array('enctype' => 'multipart/form-data',
'method' => 'POST',
'id' => 'avatar',
'action' =>
common_local_url('profilesettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
if ($original) {
common_element_start('div', array('id'=>'avatar_original', 'class'=>'avatar_view'));
common_element('h3', null, _("Original:"));
common_element_start('div', array('id'=>'avatar_original_view'));
common_element('img', array('src' => $original->url,
$this->elementStart('div', array('id'=>'avatar_original', 'class'=>'avatar_view'));
$this->element('h3', null, _("Original:"));
$this->elementStart('div', array('id'=>'avatar_original_view'));
$this->element('img', array('src' => $original->url,
'class' => 'avatar original',
'width' => $original->width,
'height' => $original->height,
'alt' => $user->nickname));
common_element_end('div');
common_element_end('div');
$this->elementEnd('div');
$this->elementEnd('div');
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
if ($avatar) {
common_element_start('div', array('id'=>'avatar_preview', 'class'=>'avatar_view'));
common_element('h3', null, _("Preview:"));
common_element_start('div', array('id'=>'avatar_preview_view'));
common_element('img', array('src' => $original->url,//$avatar->url,
$this->elementStart('div', array('id'=>'avatar_preview', 'class'=>'avatar_view'));
$this->element('h3', null, _("Preview:"));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
$this->element('img', array('src' => $original->url,//$avatar->url,
'class' => 'avatar profile',
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname));
common_element_end('div');
common_element_end('div');
$this->elementEnd('div');
$this->elementEnd('div');
foreach(array('avatar_crop_x', 'avatar_crop_y', 'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
common_element('input', array('name' => $crop_info,
$this->element('input', array('name' => $crop_info,
'type' => 'hidden',
'id' => $crop_info));
}
common_submit('crop', _('Crop'));
$this->submit('crop', _('Crop'));
}
common_element('input', array('name' => 'MAX_FILE_SIZE',
$this->element('input', array('name' => 'MAX_FILE_SIZE',
'type' => 'hidden',
'id' => 'MAX_FILE_SIZE',
'value' => MAX_AVATAR_SIZE));
common_element_start('p');
$this->elementStart('p');
common_element('input', array('name' => 'avatarfile',
$this->element('input', array('name' => 'avatarfile',
'type' => 'file',
'id' => 'avatarfile'));
common_element_end('p');
$this->elementEnd('p');
common_submit('upload', _('Upload'));
common_element_end('form');
$this->submit('upload', _('Upload'));
$this->elementEnd('form');
}
@ -195,23 +195,23 @@ class ProfilesettingsAction extends SettingsAction
{
$user = common_current_user();
common_element_start('form', array('method' => 'POST',
$this->elementStart('form', array('method' => 'POST',
'id' => 'password',
'action' =>
common_local_url('profilesettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
# Users who logged in with OpenID won't have a pwd
if ($user->password) {
common_password('oldpassword', _('Old password'));
$this->password('oldpassword', _('Old password'));
}
common_password('newpassword', _('New password'),
$this->password('newpassword', _('New password'),
_('6 or more characters'));
common_password('confirm', _('Confirm'),
$this->password('confirm', _('Confirm'),
_('same as password above'));
common_submit('changepass', _('Change'));
common_element_end('form');
$this->submit('changepass', _('Change'));
$this->elementEnd('form');
}
function save_profile()

View File

@ -39,45 +39,45 @@ class PublicxrdsAction extends Action
header('Content-Type: application/xrds+xml');
common_start_xml();
common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
$this->elementStart('XRDS', array('xmlns' => 'xri://$xrds'));
common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
$this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
'version' => '2.0'));
common_element('Type', null, 'xri://$xrds*simple');
$this->element('Type', null, 'xri://$xrds*simple');
foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
$this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
common_local_url($finish));
}
common_element_end('XRD');
$this->elementEnd('XRD');
common_element_end('XRDS');
$this->elementEnd('XRDS');
common_end_xml();
}
function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
{
common_element_start('Service');
$this->elementStart('Service');
if ($uri) {
common_element('URI', null, $uri);
$this->element('URI', null, $uri);
}
common_element('Type', null, $type);
$this->element('Type', null, $type);
if ($params) {
foreach ($params as $param) {
common_element('Type', null, $param);
$this->element('Type', null, $param);
}
}
if ($sigs) {
foreach ($sigs as $sig) {
common_element('Type', null, $sig);
$this->element('Type', null, $sig);
}
}
if ($localId) {
common_element('LocalID', null, $localId);
$this->element('LocalID', null, $localId);
}
common_element_end('Service');
$this->elementEnd('Service');
}
}

View File

@ -141,24 +141,24 @@ class RecoverpasswordAction extends Action
function show_top($msg=null)
{
if ($msg) {
common_element('div', 'error', $msg);
$this->element('div', 'error', $msg);
} else {
common_element_start('div', 'instructions');
common_element('p', null,
$this->elementStart('div', 'instructions');
$this->element('p', null,
_('If you\'ve forgotten or lost your' .
' password, you can get a new one sent to' .
' the email address you have stored ' .
' in your account.'));
common_element_end('div');
$this->elementEnd('div');
}
}
function show_password_top($msg=null)
{
if ($msg) {
common_element('div', 'error', $msg);
$this->element('div', 'error', $msg);
} else {
common_element('div', 'instructions',
$this->element('div', 'instructions',
_('You\'ve been identified. Enter a ' .
' new password below. '));
}
@ -170,15 +170,15 @@ class RecoverpasswordAction extends Action
common_show_header(_('Recover password'), null,
$msg, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'recoverpassword',
'action' => common_local_url('recoverpassword')));
common_input('nicknameoremail', _('Nickname or email'),
$this->input('nicknameoremail', _('Nickname or email'),
$this->trimmed('nicknameoremail'),
_('Your nickname on this server, ' .
'or your registered email address.'));
common_submit('recover', _('Recover'));
common_element_end('form');
$this->submit('recover', _('Recover'));
$this->elementEnd('form');
common_show_footer();
}
@ -188,16 +188,16 @@ class RecoverpasswordAction extends Action
common_show_header(_('Reset password'), null,
$msg, array($this, 'show_password_top'));
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'recoverpassword',
'action' => common_local_url('recoverpassword')));
common_hidden('token', common_session_token());
common_password('newpassword', _('New password'),
$this->hidden('token', common_session_token());
$this->password('newpassword', _('New password'),
_('6 or more characters, and don\'t forget it!'));
common_password('confirm', _('Confirm'),
$this->password('confirm', _('Confirm'),
_('Same as password above'));
common_submit('reset', _('Reset'));
common_element_end('form');
$this->submit('reset', _('Reset'));
$this->elementEnd('form');
common_show_footer();
}
@ -278,7 +278,7 @@ class RecoverpasswordAction extends Action
mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
common_show_header(_('Password recovery requested'));
common_element('p', null,
$this->element('p', null,
_('Instructions for recovering your password ' .
'have been sent to the email address registered to your ' .
'account.'));
@ -336,7 +336,7 @@ class RecoverpasswordAction extends Action
common_real_login(true);
common_show_header(_('Password saved.'));
common_element('p', null, _('New password successfully saved. ' .
$this->element('p', null, _('New password successfully saved. ' .
'You are now logged in.'));
common_show_footer();
}

View File

@ -155,16 +155,16 @@ class RegisterAction extends Action
function show_top($error=null)
{
if ($error) {
common_element('p', 'error', $error);
$this->element('p', 'error', $error);
} else {
$instr = common_markup_to_html(_('With this form you can create a new account. ' .
'You can then post notices and link up to friends and colleagues. '.
'(Have an [OpenID](http://openid.net/)? ' .
'Try our [OpenID registration](%%action.openidlogin%%)!)'));
common_element_start('div', 'instructions');
common_raw($instr);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($instr);
$this->elementEnd('div');
}
}
@ -184,45 +184,45 @@ class RegisterAction extends Action
}
common_show_header(_('Register'), null, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'login',
'action' => common_local_url('register')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
if ($code) {
common_hidden('code', $code);
$this->hidden('code', $code);
}
common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
$this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
_('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
common_password('password', _('Password'),
$this->password('password', _('Password'),
_('6 or more characters. Required.'));
common_password('confirm', _('Confirm'),
$this->password('confirm', _('Confirm'),
_('Same as password above. Required.'));
if ($invite && $invite->address_type == 'email') {
common_input('email', _('Email'), $invite->address,
$this->input('email', _('Email'), $invite->address,
_('Used only for updates, announcements, and password recovery'));
} else {
common_input('email', _('Email'), $this->trimmed('email'),
$this->input('email', _('Email'), $this->trimmed('email'),
_('Used only for updates, announcements, and password recovery'));
}
common_input('fullname', _('Full name'),
$this->input('fullname', _('Full name'),
$this->trimmed('fullname'),
_('Longer name, preferably your "real" name'));
common_input('homepage', _('Homepage'),
$this->input('homepage', _('Homepage'),
$this->trimmed('homepage'),
_('URL of your homepage, blog, or profile on another site'));
common_textarea('bio', _('Bio'),
$this->textarea('bio', _('Bio'),
$this->trimmed('bio'),
_('Describe yourself and your interests in 140 chars'));
common_input('location', _('Location'),
$this->input('location', _('Location'),
$this->trimmed('location'),
_('Where you are, like "City, State (or Region), Country"'));
common_checkbox('rememberme', _('Remember me'),
$this->checkbox('rememberme', _('Remember me'),
$this->boolean('rememberme'),
_('Automatically login in the future; not for shared computers!'));
common_element_start('p');
$this->elementStart('p');
$attrs = array('type' => 'checkbox',
'id' => 'license',
'name' => 'license',
@ -230,14 +230,14 @@ class RegisterAction extends Action
if ($this->boolean('license')) {
$attrs['checked'] = 'checked';
}
common_element('input', $attrs);
common_text(_('My text and files are available under '));
common_element('a', array('href' => $config['license']['url']),
$this->element('input', $attrs);
$this->text(_('My text and files are available under '));
$this->element('a', array('href' => $config['license']['url']),
$config['license']['title']);
common_text(_(' except this private data: password, email address, IM address, phone number.'));
common_element_end('p');
common_submit('submit', _('Register'));
common_element_end('form');
$this->text(_(' except this private data: password, email address, IM address, phone number.'));
$this->elementEnd('p');
$this->submit('submit', _('Register'));
$this->elementEnd('form');
common_show_footer();
}
@ -245,7 +245,7 @@ class RegisterAction extends Action
{
$nickname = $this->arg('nickname');
common_show_header(_('Registration successful'));
common_element_start('div', 'success');
$this->elementStart('div', 'success');
$instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. From here, you may want to...'. "\n\n" .
'* Go to [your profile](%s) and post your first message.' . "\n" .
'* Add a [Jabber/GTalk address](%%%%action.imsettings%%%%) so you can send notices through instant messages.' . "\n" .
@ -254,14 +254,14 @@ class RegisterAction extends Action
'* Read over the [online docs](%%%%doc.help%%%%) for features you may have missed. ' . "\n\n" .
'Thanks for signing up and we hope you enjoy using this service.'),
$nickname, common_local_url('showstream', array('nickname' => $nickname)));
common_raw(common_markup_to_html($instr));
$this->raw(common_markup_to_html($instr));
$have_email = $this->trimmed('email');
if ($have_email) {
$emailinstr = _('(You should receive a message by email momentarily, with ' .
'instructions on how to confirm your email address.)');
common_raw(common_markup_to_html($emailinstr));
$this->raw(common_markup_to_html($emailinstr));
}
common_element_end('div');
$this->elementEnd('div');
common_show_footer();
}

View File

@ -61,13 +61,13 @@ class RemotesubscribeAction extends Action
function show_top($err=null)
{
if ($err) {
common_element('div', 'error', $err);
$this->element('div', 'error', $err);
} else {
$instructions = $this->get_instructions();
$output = common_markup_to_html($instructions);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('p');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('p');
}
}
@ -79,15 +79,15 @@ class RemotesubscribeAction extends Action
array($this, 'show_top'));
# id = remotesubscribe conflicts with the
# button on profile page
common_element_start('form', array('id' => 'remsub', 'method' => 'post',
$this->elementStart('form', array('id' => 'remsub', 'method' => 'post',
'action' => common_local_url('remotesubscribe')));
common_hidden('token', common_session_token());
common_input('nickname', _('User nickname'), $nickname,
$this->hidden('token', common_session_token());
$this->input('nickname', _('User nickname'), $nickname,
_('Nickname of the user you want to follow'));
common_input('profile_url', _('Profile URL'), $profile,
$this->input('profile_url', _('Profile URL'), $profile,
_('URL of your profile on another compatible microblogging service'));
common_submit('submit', _('Subscribe'));
common_element_end('form');
$this->submit('submit', _('Subscribe'));
$this->elementEnd('form');
common_show_footer();
}

View File

@ -62,7 +62,7 @@ class RepliesAction extends StreamAction
function show_header($user)
{
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('repliesrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rss+xml',

View File

@ -57,7 +57,7 @@ class ShowfavoritesAction extends StreamAction
function show_header($user)
{
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('favoritesrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rss+xml',

View File

@ -81,10 +81,10 @@ class ShownoticeAction extends StreamAction
array($this, 'show_header'), null,
array($this, 'show_top'));
common_element_start('ul', array('id' => 'notices'));
$this->elementStart('ul', array('id' => 'notices'));
$nli = new NoticeListItem($this->notice);
$nli->show();
common_element_end('ul');
$this->elementEnd('ul');
common_show_footer();
}
@ -99,12 +99,12 @@ class ShownoticeAction extends StreamAction
}
if ($user->emailmicroid && $user->email && $this->notice->uri) {
common_element('meta', array('name' => 'microid',
$this->element('meta', array('name' => 'microid',
'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
}
if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
common_element('meta', array('name' => 'microid',
$this->element('meta', array('name' => 'microid',
'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($this->notice->uri))));
}
}

View File

@ -106,53 +106,53 @@ class ShowstreamAction extends StreamAction
function show_header($user)
{
# Feeds
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('api',
array('apiaction' => 'statuses',
'method' => 'user_timeline.rss',
'argument' => $user->nickname)),
'type' => 'application/rss+xml',
'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
common_element('link', array('rel' => 'alternate feed',
$this->element('link', array('rel' => 'alternate feed',
'href' => common_local_url('api',
array('apiaction' => 'statuses',
'method' => 'user_timeline.atom',
'argument' => $user->nickname)),
'type' => 'application/atom+xml',
'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('userrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rdf+xml',
'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
# FOAF
common_element('link', array('rel' => 'meta',
$this->element('link', array('rel' => 'meta',
'href' => common_local_url('foaf', array('nickname' =>
$user->nickname)),
'type' => 'application/rdf+xml',
'title' => 'FOAF'));
# for remote subscriptions etc.
common_element('meta', array('http-equiv' => 'X-XRDS-Location',
$this->element('meta', array('http-equiv' => 'X-XRDS-Location',
'content' => common_local_url('xrds', array('nickname' =>
$user->nickname))));
$profile = $user->getProfile();
if ($profile->bio) {
common_element('meta', array('name' => 'description',
$this->element('meta', array('name' => 'description',
'content' => $profile->bio));
}
if ($user->emailmicroid && $user->email && $profile->profileurl) {
common_element('meta', array('name' => 'microid',
$this->element('meta', array('name' => 'microid',
'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
}
if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
common_element('meta', array('name' => 'microid',
$this->element('meta', array('name' => 'microid',
'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
}
# See https://wiki.mozilla.org/Microsummaries
common_element('link', array('rel' => 'microsummary',
$this->element('link', array('rel' => 'microsummary',
'href' => common_local_url('microsummary',
array('nickname' => $profile->nickname))));
}
@ -165,7 +165,7 @@ class ShowstreamAction extends StreamAction
function show_profile($profile)
{
common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
$this->elementStart('div', array('id' => 'profile', 'class' => 'vcard'));
$this->show_personal($profile);
@ -175,23 +175,23 @@ class ShowstreamAction extends StreamAction
$this->show_subscriptions($profile);
common_element_end('div');
$this->elementEnd('div');
}
function show_personal($profile)
{
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
common_element_start('div', array('id' => 'profile_avatar'));
common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
$this->elementStart('div', array('id' => 'profile_avatar'));
$this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
'class' => 'avatar profile photo',
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $profile->nickname));
common_element_start('ul', array('id' => 'profile_actions'));
$this->elementStart('ul', array('id' => 'profile_actions'));
common_element_start('li', array('id' => 'profile_subscribe'));
$this->elementStart('li', array('id' => 'profile_subscribe'));
$cur = common_current_user();
if ($cur) {
if ($cur->id != $profile->id) {
@ -204,14 +204,14 @@ class ShowstreamAction extends StreamAction
} else {
$this->show_remote_subscribe_link($profile);
}
common_element_end('li');
$this->elementEnd('li');
$user = User::staticGet('id', $profile->id);
common_profile_new_message_nudge($cur, $user, $profile);
if ($cur && $cur->id != $profile->id) {
$blocked = $cur->hasBlocked($profile);
common_element_start('li', array('id' => 'profile_block'));
$this->elementStart('li', array('id' => 'profile_block'));
if ($blocked) {
common_unblock_form($profile, array('action' => 'showstream',
'nickname' => $profile->nickname));
@ -219,62 +219,62 @@ class ShowstreamAction extends StreamAction
common_block_form($profile, array('action' => 'showstream',
'nickname' => $profile->nickname));
}
common_element_end('li');
$this->elementEnd('li');
}
common_element_end('ul');
$this->elementEnd('ul');
common_element_end('div');
$this->elementEnd('div');
common_element_start('div', array('id' => 'profile_information'));
$this->elementStart('div', array('id' => 'profile_information'));
if ($profile->fullname) {
common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
$this->element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
} else {
common_element('h1', array('class' => 'fn nickname'), $profile->nickname);
$this->element('h1', array('class' => 'fn nickname'), $profile->nickname);
}
if ($profile->location) {
common_element('p', 'location', $profile->location);
$this->element('p', 'location', $profile->location);
}
if ($profile->bio) {
common_element('p', 'description note', $profile->bio);
$this->element('p', 'description note', $profile->bio);
}
if ($profile->homepage) {
common_element_start('p', 'website');
common_element('a', array('href' => $profile->homepage,
$this->elementStart('p', 'website');
$this->element('a', array('href' => $profile->homepage,
'rel' => 'me', 'class' => 'url'),
$profile->homepage);
common_element_end('p');
$this->elementEnd('p');
}
$this->show_statistics($profile);
common_element_end('div');
$this->elementEnd('div');
}
function show_remote_subscribe_link($profile)
{
$url = common_local_url('remotesubscribe',
array('nickname' => $profile->nickname));
common_element('a', array('href' => $url,
$this->element('a', array('href' => $url,
'id' => 'remotesubscribe'),
_('Subscribe'));
}
function show_unsubscribe_form($profile)
{
common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
$this->elementStart('form', array('id' => 'unsubscribe', 'method' => 'post',
'action' => common_local_url('unsubscribe')));
common_hidden('token', common_session_token());
common_element('input', array('id' => 'unsubscribeto',
$this->hidden('token', common_session_token());
$this->element('input', array('id' => 'unsubscribeto',
'name' => 'unsubscribeto',
'type' => 'hidden',
'value' => $profile->nickname));
common_element('input', array('type' => 'submit',
$this->element('input', array('type' => 'submit',
'class' => 'submit',
'value' => _('Unsubscribe')));
common_element_end('form');
$this->elementEnd('form');
}
function show_subscriptions($profile)
@ -293,13 +293,13 @@ class ShowstreamAction extends StreamAction
$subs_count = $subs->find();
common_element_start('div', array('id' => 'subscriptions'));
$this->elementStart('div', array('id' => 'subscriptions'));
common_element('h2', null, _('Subscriptions'));
$this->element('h2', null, _('Subscriptions'));
if ($subs_count > 0) {
common_element_start('ul', array('id' => 'subscriptions_avatars'));
$this->elementStart('ul', array('id' => 'subscriptions_avatars'));
for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
@ -315,39 +315,39 @@ class ShowstreamAction extends StreamAction
continue;
}
common_element_start('li', 'vcard');
common_element_start('a', array('title' => ($other->fullname) ?
$this->elementStart('li', 'vcard');
$this->elementStart('a', array('title' => ($other->fullname) ?
$other->fullname :
$other->nickname,
'href' => $other->profileurl,
'rel' => 'contact',
'class' => 'subscription fn url'));
$avatar = $other->getAvatar(AVATAR_MINI_SIZE);
common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
$this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE,
'class' => 'avatar mini photo',
'alt' => ($other->fullname) ?
$other->fullname :
$other->nickname));
common_element_end('a');
common_element_end('li');
$this->elementEnd('a');
$this->elementEnd('li');
}
common_element_end('ul');
$this->elementEnd('ul');
}
if ($subs_count > SUBSCRIPTIONS) {
common_element_start('p', array('id' => 'subscriptions_viewall'));
$this->elementStart('p', array('id' => 'subscriptions_viewall'));
common_element('a', array('href' => common_local_url('subscriptions',
$this->element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $profile->nickname)),
'class' => 'moresubscriptions'),
_('All subscriptions'));
common_element_end('p');
$this->elementEnd('p');
}
common_element_end('div');
$this->elementEnd('div');
}
function show_statistics($profile)
@ -366,49 +366,49 @@ class ShowstreamAction extends StreamAction
$notices->profile_id = $profile->id;
$notice_count = (int) $notices->count();
common_element_start('div', 'statistics');
common_element('h2', 'statistics', _('Statistics'));
$this->elementStart('div', 'statistics');
$this->element('h2', 'statistics', _('Statistics'));
# Other stats...?
common_element_start('dl', 'statistics');
common_element('dt', 'membersince', _('Member since'));
common_element('dd', 'membersince', date('j M Y',
$this->elementStart('dl', 'statistics');
$this->element('dt', 'membersince', _('Member since'));
$this->element('dd', 'membersince', date('j M Y',
strtotime($profile->created)));
common_element_start('dt', 'subscriptions');
common_element('a', array('href' => common_local_url('subscriptions',
$this->elementStart('dt', 'subscriptions');
$this->element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $profile->nickname))),
_('Subscriptions'));
common_element_end('dt');
common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
common_element_start('dt', 'subscribers');
common_element('a', array('href' => common_local_url('subscribers',
$this->elementEnd('dt');
$this->element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
$this->elementStart('dt', 'subscribers');
$this->element('a', array('href' => common_local_url('subscribers',
array('nickname' => $profile->nickname))),
_('Subscribers'));
common_element_end('dt');
common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
common_element('dt', 'notices', _('Notices'));
common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
$this->elementEnd('dt');
$this->element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
$this->element('dt', 'notices', _('Notices'));
$this->element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
# XXX: link these to something
common_element('dt', 'tags', _('Tags'));
common_element_start('dd', 'tags');
$this->element('dt', 'tags', _('Tags'));
$this->elementStart('dd', 'tags');
$tags = Profile_tag::getTags($profile->id, $profile->id);
common_element_start('ul', 'tags xoxo');
$this->elementStart('ul', 'tags xoxo');
foreach ($tags as $tag) {
common_element_start('li');
common_element('a', array('rel' => 'bookmark tag',
$this->elementStart('li');
$this->element('a', array('rel' => 'bookmark tag',
'href' => common_local_url('peopletag',
array('tag' => $tag))),
$tag);
common_element_end('li');
$this->elementEnd('li');
}
common_element_end('ul');
common_element_end('dd');
$this->elementEnd('ul');
$this->elementEnd('dd');
common_element_end('dl');
$this->elementEnd('dl');
common_element_end('div');
$this->elementEnd('div');
}
function show_notices($user)
@ -428,22 +428,22 @@ class ShowstreamAction extends StreamAction
function show_last_notice($profile)
{
common_element('h2', null, _('Currently'));
$this->element('h2', null, _('Currently'));
$notice = $profile->getCurrentNotice();
if ($notice) {
# FIXME: URL, image, video, audio
common_element_start('p', array('class' => 'notice_current'));
$this->elementStart('p', array('class' => 'notice_current'));
if ($notice->rendered) {
common_raw($notice->rendered);
$this->raw($notice->rendered);
} else {
# XXX: may be some uncooked notices in the DB,
# we cook them right now. This can probably disappear in future
# versions (>> 0.4.x)
common_raw(common_render_content($notice->content, $notice));
$this->raw(common_render_content($notice->content, $notice));
}
common_element_end('p');
$this->elementEnd('p');
}
}
}

View File

@ -34,75 +34,75 @@ class SmssettingsAction extends EmailsettingsAction
{
$user = common_current_user();
$this->form_header(_('SMS Settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'smssettings',
'action' =>
common_local_url('smssettings')));
common_hidden('token', common_session_token());
common_element('h2', null, _('Address'));
$this->hidden('token', common_session_token());
$this->element('h2', null, _('Address'));
if ($user->sms) {
common_element_start('p');
$this->elementStart('p');
$carrier = $user->getCarrier();
common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
common_element('span', 'input_instructions',
$this->element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
$this->element('span', 'input_instructions',
_('Current confirmed SMS-enabled phone number.'));
common_hidden('sms', $user->sms);
common_hidden('carrier', $user->carrier);
common_element_end('p');
common_submit('remove', _('Remove'));
$this->hidden('sms', $user->sms);
$this->hidden('carrier', $user->carrier);
$this->elementEnd('p');
$this->submit('remove', _('Remove'));
} else {
$confirm = $this->get_confirmation();
if ($confirm) {
$carrier = Sms_carrier::staticGet($confirm->address_extra);
common_element_start('p');
common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
$this->element('span', 'input_instructions',
_('Awaiting confirmation on this phone number.'));
common_hidden('sms', $confirm->address);
common_hidden('carrier', $confirm->address_extra);
common_element_end('p');
common_submit('cancel', _('Cancel'));
common_input('code', _('Confirmation code'), null,
$this->hidden('sms', $confirm->address);
$this->hidden('carrier', $confirm->address_extra);
$this->elementEnd('p');
$this->submit('cancel', _('Cancel'));
$this->input('code', _('Confirmation code'), null,
_('Enter the code you received on your phone.'));
common_submit('confirm', _('Confirm'));
$this->submit('confirm', _('Confirm'));
} else {
common_input('sms', _('SMS Phone number'),
$this->input('sms', _('SMS Phone number'),
($this->arg('sms')) ? $this->arg('sms') : null,
_('Phone number, no punctuation or spaces, with area code'));
$this->carrier_select();
common_submit('add', _('Add'));
$this->submit('add', _('Add'));
}
}
if ($user->sms) {
common_element('h2', null, _('Incoming email'));
$this->element('h2', null, _('Incoming email'));
if ($user->incomingemail) {
common_element_start('p');
common_element('span', 'address', $user->incomingemail);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address', $user->incomingemail);
$this->element('span', 'input_instructions',
_('Send email to this address to post new notices.'));
common_element_end('p');
common_submit('removeincoming', _('Remove'));
$this->elementEnd('p');
$this->submit('removeincoming', _('Remove'));
}
common_element_start('p');
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'input_instructions',
_('Make a new email address for posting to; cancels the old one.'));
common_element_end('p');
common_submit('newincoming', _('New'));
$this->elementEnd('p');
$this->submit('newincoming', _('New'));
}
common_element('h2', null, _('Preferences'));
$this->element('h2', null, _('Preferences'));
common_checkbox('smsnotify',
$this->checkbox('smsnotify',
_('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
$user->smsnotify);
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}
@ -307,19 +307,19 @@ class SmssettingsAction extends EmailsettingsAction
$carrier = new Sms_carrier();
$cnt = $carrier->find();
common_element_start('p');
common_element('label', array('for' => 'carrier'));
common_element_start('select', array('name' => 'carrier',
$this->elementStart('p');
$this->element('label', array('for' => 'carrier'));
$this->elementStart('select', array('name' => 'carrier',
'id' => 'carrier'));
common_element('option', array('value' => 0),
$this->element('option', array('value' => 0),
_('Select a carrier'));
while ($carrier->fetch()) {
common_element('option', array('value' => $carrier->id),
$this->element('option', array('value' => $carrier->id),
$carrier->name);
}
common_element_end('select');
common_element_end('p');
common_element('span', 'input_instructions',
$this->elementEnd('select');
$this->elementEnd('p');
$this->element('span', 'input_instructions',
sprintf(_('Mobile carrier for your phone. '.
'If you know a carrier that accepts ' .
'SMS over email but isn\'t listed here, ' .

View File

@ -65,13 +65,13 @@ class SubscribeAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Subscribed'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Subscribed'));
$this->elementEnd('head');
$this->elementStart('body');
common_unsubscribe_form($other->getProfile());
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('subscriptions', array('nickname' =>
$user->nickname)));

View File

@ -72,16 +72,16 @@ class SubscriptionsList extends ProfileList
return;
}
common_element_start('form', array('id' => 'subedit-' . $profile->id,
$this->elementStart('form', array('id' => 'subedit-' . $profile->id,
'method' => 'post',
'class' => 'subedit',
'action' => common_local_url('subedit')));
common_hidden('token', common_session_token());
common_hidden('profile', $profile->id);
common_checkbox('jabber', _('Jabber'), $sub->jabber);
common_checkbox('sms', _('SMS'), $sub->sms);
common_submit('save', _('Save'));
common_element_end('form');
$this->hidden('token', common_session_token());
$this->hidden('profile', $profile->id);
$this->checkbox('jabber', _('Jabber'), $sub->jabber);
$this->checkbox('sms', _('SMS'), $sub->sms);
$this->submit('save', _('Save'));
$this->elementEnd('form');
return;
}
}

View File

@ -51,7 +51,7 @@ class TagAction extends StreamAction
function show_header($tag = false)
{
if ($tag) {
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('tagrss', array('tag' => $tag)),
'type' => 'application/rss+xml',
'title' => sprintf(_('Feed for tag %s'), $tag)));
@ -68,9 +68,9 @@ class TagAction extends StreamAction
if (!$tag) {
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
$this->public_views_menu();
}
else {
@ -110,7 +110,7 @@ class TagAction extends StreamAction
$cnt = $tags->find();
if ($cnt > 0) {
common_element_start('p', 'tagcloud');
$this->elementStart('p', 'tagcloud');
$tw = array();
$sum = 0;
@ -125,7 +125,7 @@ class TagAction extends StreamAction
$this->show_tag($tag, $weight, $weight/$sum);
}
common_element_end('p');
$this->elementEnd('p');
}
}
@ -149,10 +149,10 @@ class TagAction extends StreamAction
$cls = 'smallest';
}
common_element('a', array('class' => "$cls weight-$weight relative-$relative",
$this->element('a', array('class' => "$cls weight-$weight relative-$relative",
'href' => common_local_url('tag', array('tag' => $tag))),
$tag);
common_text(' ');
$this->text(' ');
}
function show_notices($tag)

View File

@ -61,7 +61,7 @@ class TagotherAction extends Action
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
$this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
'class' => 'avatar stream',
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
@ -69,39 +69,39 @@ class TagotherAction extends Action
($profile->fullname) ? $profile->fullname :
$profile->nickname));
common_element('a', array('href' => $profile->profileurl,
$this->element('a', array('href' => $profile->profileurl,
'class' => 'external profile nickname'),
$profile->nickname);
if ($profile->fullname) {
common_element_start('div', 'fullname');
$this->elementStart('div', 'fullname');
if ($profile->homepage) {
common_element('a', array('href' => $profile->homepage),
$this->element('a', array('href' => $profile->homepage),
$profile->fullname);
} else {
common_text($profile->fullname);
$this->text($profile->fullname);
}
common_element_end('div');
$this->elementEnd('div');
}
if ($profile->location) {
common_element('div', 'location', $profile->location);
$this->element('div', 'location', $profile->location);
}
if ($profile->bio) {
common_element('div', 'bio', $profile->bio);
$this->element('div', 'bio', $profile->bio);
}
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'tag_user',
'name' => 'tagother',
'action' => $this->self_url()));
common_hidden('token', common_session_token());
common_hidden('id', $profile->id);
common_input('tags', _('Tags'),
$this->hidden('token', common_session_token());
$this->hidden('id', $profile->id);
$this->input('tags', _('Tags'),
($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)),
_('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
common_submit('save', _('Save'));
common_element_end('form');
$this->submit('save', _('Save'));
$this->elementEnd('form');
common_show_footer();
}
@ -162,20 +162,20 @@ class TagotherAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml');
common_element_start('head');
common_element('title', null, _('Tags'));
common_element_end('head');
common_element_start('body');
common_element_start('p', 'subtags');
$this->elementStart('head');
$this->element('title', null, _('Tags'));
$this->elementEnd('head');
$this->elementStart('body');
$this->elementStart('p', 'subtags');
foreach ($tags as $tag) {
common_element('a', array('href' => common_local_url($action,
$this->element('a', array('href' => common_local_url($action,
array('nickname' => $user->nickname,
'tag' => $tag))),
$tag);
}
common_element_end('p');
common_element_end('body');
common_element_end('html');
$this->elementEnd('p');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url($action, array('nickname' =>
$user->nickname)));
@ -186,12 +186,12 @@ class TagotherAction extends Action
{
list($profile, $error) = $arr;
if ($error) {
common_element('p', 'error', $error);
$this->element('p', 'error', $error);
} else {
common_element_start('div', 'instructions');
common_element('p', null,
$this->elementStart('div', 'instructions');
$this->element('p', null,
_('Use this form to add tags to your subscribers or subscriptions.'));
common_element_end('div');
$this->elementEnd('div');
}
}
}

View File

@ -188,7 +188,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
{
$this->init_document('xml');
common_element_start('direct-messages', array('type' => 'array'));
$this->elementStart('direct-messages', array('type' => 'array'));
if (is_array($messages)) {
foreach ($message as $m) {
@ -202,7 +202,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
}
}
common_element_end('direct-messages');
$this->elementEnd('direct-messages');
$this->end_document('xml');
}
@ -236,13 +236,13 @@ class Twitapidirect_messagesAction extends TwitterapiAction
$this->init_document('rss');
common_element_start('channel');
common_element('title', null, $title);
$this->elementStart('channel');
$this->element('title', null, $title);
common_element('link', null, $link);
common_element('description', null, $subtitle);
common_element('language', null, 'en-us');
common_element('ttl', null, '40');
$this->element('link', null, $link);
$this->element('description', null, $subtitle);
$this->element('language', null, 'en-us');
$this->element('ttl', null, '40');
if (is_array($message)) {
foreach ($message as $m) {
@ -256,7 +256,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
}
}
common_element_end('channel');
$this->elementEnd('channel');
$this->end_twitter_rss();
}
@ -266,12 +266,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction
$this->init_document('atom');
common_element('title', null, $title);
$this->element('title', null, $title);
$siteserver = common_config('site', 'server');
common_element('id', null, "tag:$siteserver,2008:DirectMessage");
common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
common_element('updated', null, common_date_iso8601(strftime('%c')));
common_element('subtitle', null, $subtitle);
$this->element('id', null, "tag:$siteserver,2008:DirectMessage");
$this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
$this->element('updated', null, common_date_iso8601(strftime('%c')));
$this->element('subtitle', null, $subtitle);
if (is_array($message)) {
foreach ($message as $m) {

View File

@ -142,7 +142,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
switch ($apidata['content-type']) {
case 'xml':
$this->init_document('xml');
common_element('friends', null, $result);
$this->element('friends', null, $result);
$this->end_document('xml');
break;
case 'json':

View File

@ -34,7 +34,7 @@ class TwitapihelpAction extends TwitterapiAction
if ($apidata['content-type'] == 'xml') {
$this->init_document('xml');
common_element('ok', null, 'true');
$this->element('ok', null, 'true');
$this->end_document('xml');
} elseif ($apidata['content-type'] == 'json') {
$this->init_document('json');

View File

@ -70,7 +70,7 @@ class TwitapilaconicaAction extends TwitterapiAction
switch ($apidata['content-type']) {
case 'xml':
$this->init_document('xml');
common_element('version', null, LACONICA_VERSION);
$this->element('version', null, LACONICA_VERSION);
$this->end_document('xml');
break;
case 'json':
@ -115,10 +115,10 @@ class TwitapilaconicaAction extends TwitterapiAction
switch ($apidata['content-type']) {
case 'xml':
$this->init_document('xml');
common_element_start('config');
$this->elementStart('config');
// XXX: check that all sections and settings are legal XML elements
foreach ($keys as $section => $settings) {
common_element_start($section);
$this->elementStart($section);
foreach ($settings as $setting) {
$value = common_config($section, $setting);
if (is_array($value)) {
@ -128,11 +128,11 @@ class TwitapilaconicaAction extends TwitterapiAction
} else if ($value === true) {
$value = 'true';
}
common_element($setting, null, $value);
$this->element($setting, null, $value);
}
common_element_end($section);
$this->elementEnd($section);
}
common_element_end('config');
$this->elementEnd('config');
$this->end_document('xml');
break;
case 'json':

View File

@ -538,11 +538,11 @@ class TwitapistatusesAction extends TwitterapiAction
{
switch ($type) {
case 'xml':
common_element_start('users', array('type' => 'array'));
$this->elementStart('users', array('type' => 'array'));
foreach ($profiles as $profile) {
$this->show_profile($profile);
}
common_element_end('users');
$this->elementEnd('users');
break;
case 'json':
$arrays = array();

View File

@ -44,52 +44,52 @@ class TwittersettingsAction extends SettingsAction
}
$this->form_header(_('Twitter settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'twittersettings',
'action' =>
common_local_url('twittersettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
common_element('h2', null, _('Twitter Account'));
$this->element('h2', null, _('Twitter Account'));
if ($fuser) {
common_element_start('p');
$this->elementStart('p');
common_element('span', 'twitter_user', $fuser->nickname);
common_element('a', array('href' => $fuser->uri), $fuser->uri);
common_element('span', 'input_instructions',
$this->element('span', 'twitter_user', $fuser->nickname);
$this->element('a', array('href' => $fuser->uri), $fuser->uri);
$this->element('span', 'input_instructions',
_('Current verified Twitter account.'));
common_hidden('flink_foreign_id', $flink->foreign_id);
common_element_end('p');
common_submit('remove', _('Remove'));
$this->hidden('flink_foreign_id', $flink->foreign_id);
$this->elementEnd('p');
$this->submit('remove', _('Remove'));
} else {
common_input('twitter_username', _('Twitter user name'),
$this->input('twitter_username', _('Twitter user name'),
($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
_('No spaces, please.')); // hey, it's what Twitter says
common_password('twitter_password', _('Twitter password'));
$this->password('twitter_password', _('Twitter password'));
}
common_element('h2', null, _('Preferences'));
$this->element('h2', null, _('Preferences'));
common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
$this->checkbox('noticesync', _('Automatically send my notices to Twitter.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
$this->checkbox('replysync', _('Send local "@" replies to Twitter.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
$this->checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
if ($flink) {
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
} else {
common_submit('add', _('Add'));
$this->submit('add', _('Add'));
}
$this->show_twitter_subscriptions();
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}
@ -131,9 +131,9 @@ class TwittersettingsAction extends SettingsAction
if ($friends_count > 0) {
common_element('h3', null, _('Twitter Friends'));
common_element_start('div', array('id' => 'subscriptions'));
common_element_start('ul', array('id' => 'subscriptions_avatars'));
$this->element('h3', null, _('Twitter Friends'));
$this->elementStart('div', array('id' => 'subscriptions'));
$this->elementStart('ul', array('id' => 'subscriptions_avatars'));
for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
@ -144,28 +144,28 @@ class TwittersettingsAction extends SettingsAction
continue;
}
common_element_start('li');
common_element_start('a', array('title' => ($other->fullname) ?
$this->elementStart('li');
$this->elementStart('a', array('title' => ($other->fullname) ?
$other->fullname :
$other->nickname,
'href' => $other->profileurl,
'rel' => 'contact',
'class' => 'subscription'));
$avatar = $other->getAvatar(AVATAR_MINI_SIZE);
common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
$this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE,
'class' => 'avatar mini',
'alt' => ($other->fullname) ?
$other->fullname :
$other->nickname));
common_element_end('a');
common_element_end('li');
$this->elementEnd('a');
$this->elementEnd('li');
}
common_element_end('ul');
common_element_end('div');
$this->elementEnd('ul');
$this->elementEnd('div');
}
@ -173,13 +173,13 @@ class TwittersettingsAction extends SettingsAction
/*
if ($subs_count > SUBSCRIPTIONS) {
common_element_start('p', array('id' => 'subscriptions_viewall'));
$this->elementStart('p', array('id' => 'subscriptions_viewall'));
common_element('a', array('href' => common_local_url('subscriptions',
$this->element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $profile->nickname)),
'class' => 'moresubscriptions'),
_('All subscriptions'));
common_element_end('p');
$this->elementEnd('p');
}
*/

View File

@ -67,13 +67,13 @@ class UnsubscribeAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Unsubscribed'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Unsubscribed'));
$this->elementEnd('head');
$this->elementStart('body');
common_subscribe_form($other);
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('subscriptions', array('nickname' =>
$user->nickname)));

View File

@ -84,51 +84,51 @@ class UserauthorizationAction extends Action
$avatar = $req->get_parameter('omb_listenee_avatar');
common_show_header(_('Authorize subscription'));
common_element('p', null, _('Please check these details to make sure '.
$this->element('p', null, _('Please check these details to make sure '.
'that you want to subscribe to this user\'s notices. '.
'If you didn\'t just ask to subscribe to someone\'s notices, '.
'click "Cancel".'));
common_element_start('div', 'profile');
$this->elementStart('div', 'profile');
if ($avatar) {
common_element('img', array('src' => $avatar,
$this->element('img', array('src' => $avatar,
'class' => 'avatar profile',
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $nickname));
}
common_element('a', array('href' => $profile,
$this->element('a', array('href' => $profile,
'class' => 'external profile nickname'),
$nickname);
if ($fullname) {
common_element_start('div', 'fullname');
$this->elementStart('div', 'fullname');
if ($homepage) {
common_element('a', array('href' => $homepage),
$this->element('a', array('href' => $homepage),
$fullname);
} else {
common_text($fullname);
$this->text($fullname);
}
common_element_end('div');
$this->elementEnd('div');
}
if ($location) {
common_element('div', 'location', $location);
$this->element('div', 'location', $location);
}
if ($bio) {
common_element('div', 'bio', $bio);
$this->element('div', 'bio', $bio);
}
common_element_start('div', 'license');
common_element('a', array('href' => $license,
$this->elementStart('div', 'license');
$this->element('a', array('href' => $license,
'class' => 'license'),
$license);
common_element_end('div');
common_element_end('div');
common_element_start('form', array('method' => 'post',
$this->elementEnd('div');
$this->elementEnd('div');
$this->elementStart('form', array('method' => 'post',
'id' => 'userauthorization',
'name' => 'userauthorization',
'action' => common_local_url('userauthorization')));
common_hidden('token', common_session_token());
common_submit('accept', _('Accept'));
common_submit('reject', _('Reject'));
common_element_end('form');
$this->hidden('token', common_session_token());
$this->submit('accept', _('Accept'));
$this->submit('reject', _('Reject'));
$this->elementEnd('form');
common_show_footer();
}
@ -328,18 +328,18 @@ class UserauthorizationAction extends Action
function show_accept_message($tok)
{
common_show_header(_('Subscription authorized'));
common_element('p', null,
$this->element('p', null,
_('The subscription has been authorized, but no '.
'callback URL was passed. Check with the site\'s instructions for '.
'details on how to authorize the subscription. Your subscription token is:'));
common_element('blockquote', 'token', $tok);
$this->element('blockquote', 'token', $tok);
common_show_footer();
}
function show_reject_message($tok)
{
common_show_header(_('Subscription rejected'));
common_element('p', null,
$this->element('p', null,
_('The subscription has been rejected, but no '.
'callback URL was passed. Check with the site\'s instructions for '.
'details on how to fully reject the subscription.'));

View File

@ -47,14 +47,14 @@ class XrdsAction extends Action
header('Content-Type: application/xrds+xml');
common_start_xml();
common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
$this->elementStart('XRDS', array('xmlns' => 'xri://$xrds'));
common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
$this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'xml:id' => 'oauth',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
'version' => '2.0'));
common_element('Type', null, 'xri://$xrds*simple');
$this->element('Type', null, 'xri://$xrds*simple');
$this->show_service(OAUTH_ENDPOINT_REQUEST,
common_local_url('requesttoken'),
@ -77,16 +77,16 @@ class XrdsAction extends Action
array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
array(OAUTH_HMAC_SHA1));
common_element_end('XRD');
$this->elementEnd('XRD');
# XXX: decide whether to include user's ID/nickname in postNotice URL
common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
$this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'xml:id' => 'omb',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
'version' => '2.0'));
common_element('Type', null, 'xri://$xrds*simple');
$this->element('Type', null, 'xri://$xrds*simple');
$this->show_service(OMB_ENDPOINT_POSTNOTICE,
common_local_url('postnotice'));
@ -94,44 +94,44 @@ class XrdsAction extends Action
$this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
common_local_url('updateprofile'));
common_element_end('XRD');
$this->elementEnd('XRD');
common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
$this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'version' => '2.0'));
common_element('Type', null, 'xri://$xrds*simple');
$this->element('Type', null, 'xri://$xrds*simple');
$this->show_service(OAUTH_DISCOVERY,
'#oauth');
$this->show_service(OMB_NAMESPACE,
'#omb');
common_element_end('XRD');
$this->elementEnd('XRD');
common_element_end('XRDS');
$this->elementEnd('XRDS');
common_end_xml();
}
function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
{
common_element_start('Service');
$this->elementStart('Service');
if ($uri) {
common_element('URI', null, $uri);
$this->element('URI', null, $uri);
}
common_element('Type', null, $type);
$this->element('Type', null, $type);
if ($params) {
foreach ($params as $param) {
common_element('Type', null, $param);
$this->element('Type', null, $param);
}
}
if ($sigs) {
foreach ($sigs as $sig) {
common_element('Type', null, $sig);
$this->element('Type', null, $sig);
}
}
if ($localId) {
common_element('LocalID', null, $localId);
$this->element('LocalID', null, $localId);
}
common_element_end('Service');
$this->elementEnd('Service');
}
}

View File

@ -314,7 +314,7 @@ class Action extends HTMLOutputter // lawsuit
{
$this->elementStart('div', array('id' => 'content'));
$this->showPageTitle();
$this->showPageNotice();
$this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner'));
// show the actual content (forms, lists, whatever)
$this->showContent();
@ -326,19 +326,24 @@ class Action extends HTMLOutputter // lawsuit
$this->element('h1', NULL, $this->title());
}
function showPageNoticeBlock()
{
$this->elementStart('dl', array('id' => 'page_notice',
'class' => 'system_notice'));
$this->element('dt', null, _('Page notice'));
$this->elementStart('dd', null);
$this->showPageNotice();
$this->elementEnd('dd');
$this->elementEnd('dl');
}
}
// SHOULD overload (unless there's not a notice)
function showPageNotice()
{
$this->elementStart('dl', array('id' => 'page_notice',
'class' => 'system_notice'));
$this->element('dt', null, _('Page notice'));
$this->elementStart('dd', null);
// Output a bunch of paragraphs here
$this->elementEnd('dd');
$this->elementEnd('dl');
}
// MUST overload
function showContent()