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) function show_header($user)
{ {
common_element('link', array('rel' => 'alternate', $this->element('link', array('rel' => 'alternate',
'href' => common_local_url('allrss', array('nickname' => 'href' => common_local_url('allrss', array('nickname' =>
$user->nickname)), $user->nickname)),
'type' => 'application/rss+xml', 'type' => 'application/rss+xml',

View File

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

View File

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

View File

@ -90,7 +90,7 @@ class ConfirmaddressAction extends Action
$cur->query('COMMIT'); $cur->query('COMMIT');
common_show_header(_('Confirm Address')); 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)); sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
common_show_footer(); common_show_footer();
} }

View File

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

View File

@ -49,15 +49,15 @@ class DeleteprofileAction extends Action
function show_feeds_list($feeds) function show_feeds_list($feeds)
{ {
common_element_start('div', array('class' => 'feedsdel')); $this->elementStart('div', array('class' => 'feedsdel'));
common_element('p', null, 'Feeds:'); $this->element('p', null, 'Feeds:');
common_element_start('ul', array('class' => 'xoxo')); $this->elementStart('ul', array('class' => 'xoxo'));
foreach ($feeds as $key => $value) { foreach ($feeds as $key => $value) {
$this->common_feed_item($feeds[$key]); $this->common_feed_item($feeds[$key]);
} }
common_element_end('ul'); $this->elementEnd('ul');
common_element_end('div'); $this->elementEnd('div');
} }
//TODO move to common.php (and retrace its origin) //TODO move to common.php (and retrace its origin)
@ -81,19 +81,19 @@ class DeleteprofileAction extends Action
$feed['textContent'] = "FOAF"; $feed['textContent'] = "FOAF";
break; break;
} }
common_element_start('li'); $this->elementStart('li');
common_element('a', array('href' => $feed['href'], $this->element('a', array('href' => $feed['href'],
'class' => $feed_classname, 'class' => $feed_classname,
'type' => $feed_mimetype, 'type' => $feed_mimetype,
'title' => $feed_title), 'title' => $feed_title),
$feed['textContent']); $feed['textContent']);
common_element_end('li'); $this->elementEnd('li');
} }
function show_form($msg=null, $success=false) function show_form($msg=null, $success=false)
{ {
$this->form_header(_('Delete my account'), $msg, $success); $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(); $this->show_confirm_delete_form();
common_show_footer(); common_show_footer();
} }
@ -105,13 +105,13 @@ class DeleteprofileAction extends Action
$notices->profile_id = $user->id; $notices->profile_id = $user->id;
$notice_count = (int) $notices->count(); $notice_count = (int) $notices->count();
common_element_start('form', array('method' => 'POST', $this->elementStart('form', array('method' => 'POST',
'id' => 'delete', 'id' => 'delete',
'action' => 'action' =>
common_local_url('deleteprofile'))); common_local_url('deleteprofile')));
common_hidden('token', common_session_token()); $this->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->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)), $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
'type' => 'rss', 'type' => 'rss',
@ -122,10 +122,10 @@ class DeleteprofileAction extends Action
'version' => 'FOAF', 'version' => 'FOAF',
'item' => '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')); $this->submit('deleteaccount', _('Delete my account'));
common_element_end('form'); $this->elementEnd('form');
} }
function handle_post() function handle_post()
@ -238,9 +238,9 @@ class DeleteprofileAction extends Action
} else { } else {
$inst = $this->get_instructions(); $inst = $this->get_instructions();
$output = common_markup_to_html($inst); $output = common_markup_to_html($inst);
common_element_start('div', 'instructions'); $this->elementStart('div', 'instructions');
common_raw($output); $this->raw($output);
common_element_end('div'); $this->elementEnd('div');
} }
$this->settings_menu(); $this->settings_menu();
} }
@ -272,7 +272,7 @@ class DeleteprofileAction extends Action
_('Other options'))); _('Other options')));
$action = $this->trimmed('action'); $action = $this->trimmed('action');
common_element_start('ul', array('id' => 'nav_views')); $this->elementStart('ul', array('id' => 'nav_views'));
foreach ($menu as $menuaction => $menudesc) { foreach ($menu as $menuaction => $menudesc) {
if ($menuaction == 'imsettings' && if ($menuaction == 'imsettings' &&
!common_config('xmpp', 'enabled')) { !common_config('xmpp', 'enabled')) {
@ -283,7 +283,7 @@ class DeleteprofileAction extends Action
$menudesc[1], $menudesc[1],
$action == $menuaction); $action == $menuaction);
} }
common_element_end('ul'); $this->elementEnd('ul');
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,43 +68,43 @@ class FacebooksettingsAction extends FacebookAction
$this->show_header('Settings', $msg, $success); $this->show_header('Settings', $msg, $success);
common_element_start('fb:if-section-not-added', array('section' => 'profile')); $this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
common_element('h2', null, _('Add an Identi.ca box to my profile')); $this->element('h2', null, _('Add an Identi.ca box to my profile'));
common_element_start('p'); $this->elementStart('p');
common_element('fb:add-section-button', array('section' => 'profile')); $this->element('fb:add-section-button', array('section' => 'profile'));
common_element_end('p'); $this->elementEnd('p');
common_element_end('fb:if-section-not-added'); $this->elementEnd('fb:if-section-not-added');
common_element_start('p'); $this->elementStart('p');
common_element_start('fb:prompt-permission', array('perms' => 'status_update')); $this->elementStart('fb:prompt-permission', array('perms' => 'status_update'));
common_element('h2', null, _('Allow Identi.ca to update my Facebook status')); $this->element('h2', null, _('Allow Identi.ca to update my Facebook status'));
common_element_end('fb:prompt-permission'); $this->elementEnd('fb:prompt-permission');
common_element_end('p'); $this->elementEnd('p');
if ($facebook->api_client->users_hasAppPermission('status_update')) { if ($facebook->api_client->users_hasAppPermission('status_update')) {
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'facebook_settings')); '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); ($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); ($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); $prefix = $facebook->api_client->data_getUserPreference(1);
common_input('prefix', _('Prefix'), $this->input('prefix', _('Prefix'),
($prefix) ? $prefix : null, ($prefix) ? $prefix : null,
_('A string to prefix notices with.')); _('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')) { if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true); common_start_html('text/xml;charset=utf-8', true);
common_element_start('head'); $this->elementStart('head');
common_element('title', null, _('Disfavor favorite')); $this->element('title', null, _('Disfavor favorite'));
common_element_end('head'); $this->elementEnd('head');
common_element_start('body'); $this->elementStart('body');
common_disfavor_form($notice); common_disfavor_form($notice);
common_element_end('body'); $this->elementEnd('body');
common_element_end('html'); $this->elementEnd('html');
} else { } else {
common_redirect(common_local_url('showfavorites', common_redirect(common_local_url('showfavorites',
array('nickname' => $user->nickname))); array('nickname' => $user->nickname)));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,57 +34,57 @@ class ImsettingsAction extends SettingsAction
{ {
$user = common_current_user(); $user = common_current_user();
$this->form_header(_('IM Settings'), $msg, $success); $this->form_header(_('IM Settings'), $msg, $success);
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'imsettings', 'id' => 'imsettings',
'action' => 'action' =>
common_local_url('imsettings'))); 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) { if ($user->jabber) {
common_element_start('p'); $this->elementStart('p');
common_element('span', 'address confirmed', $user->jabber); $this->element('span', 'address confirmed', $user->jabber);
common_element('span', 'input_instructions', $this->element('span', 'input_instructions',
_('Current confirmed Jabber/GTalk address.')); _('Current confirmed Jabber/GTalk address.'));
common_hidden('jabber', $user->jabber); $this->hidden('jabber', $user->jabber);
common_element_end('p'); $this->elementEnd('p');
common_submit('remove', _('Remove')); $this->submit('remove', _('Remove'));
} else { } else {
$confirm = $this->get_confirmation(); $confirm = $this->get_confirmation();
if ($confirm) { if ($confirm) {
common_element_start('p'); $this->elementStart('p');
common_element('span', 'address unconfirmed', $confirm->address); $this->element('span', 'address unconfirmed', $confirm->address);
common_element('span', 'input_instructions', $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())); 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); $this->hidden('jabber', $confirm->address);
common_element_end('p'); $this->elementEnd('p');
common_submit('cancel', _('Cancel')); $this->submit('cancel', _('Cancel'));
} else { } else {
common_input('jabber', _('IM Address'), $this->input('jabber', _('IM Address'),
($this->arg('jabber')) ? $this->arg('jabber') : null, ($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())); 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.'), _('Send me notices through Jabber/GTalk.'),
$user->jabbernotify); $user->jabbernotify);
common_checkbox('updatefrompresence', $this->checkbox('updatefrompresence',
_('Post a notice when my Jabber/GTalk status changes.'), _('Post a notice when my Jabber/GTalk status changes.'),
$user->updatefrompresence); $user->updatefrompresence);
common_checkbox('jabberreplies', $this->checkbox('jabberreplies',
_('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'), _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
$user->jabberreplies); $user->jabberreplies);
common_checkbox('jabbermicroid', $this->checkbox('jabbermicroid',
_('Publish a MicroID for my Jabber/GTalk address.'), _('Publish a MicroID for my Jabber/GTalk address.'),
$user->jabbermicroid); $user->jabbermicroid);
common_submit('save', _('Save')); $this->submit('save', _('Save'));
common_element_end('form'); $this->elementEnd('form');
common_show_footer(); common_show_footer();
} }

View File

@ -89,29 +89,29 @@ class InviteAction extends Action
common_show_header(_('Invitation(s) sent')); common_show_header(_('Invitation(s) sent'));
if ($already) { if ($already) {
common_element('p', null, _('You are already subscribed to these users:')); $this->element('p', null, _('You are already subscribed to these users:'));
common_element_start('ul'); $this->elementStart('ul');
foreach ($already as $other) { 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) { if ($subbed) {
common_element('p', null, _('These people are already users and you were automatically subscribed to them:')); $this->element('p', null, _('These people are already users and you were automatically subscribed to them:'));
common_element_start('ul'); $this->elementStart('ul');
foreach ($subbed as $other) { 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) { if ($sent) {
common_element('p', null, _('Invitation(s) sent to the following people:')); $this->element('p', null, _('Invitation(s) sent to the following people:'));
common_element_start('ul'); $this->elementStart('ul');
foreach ($sent as $other) { foreach ($sent as $other) {
common_element('li', null, $other); $this->element('li', null, $other);
} }
common_element_end('ul'); $this->elementEnd('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->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(); common_show_footer();
} }
@ -119,12 +119,12 @@ class InviteAction extends Action
function show_top($error=null) function show_top($error=null)
{ {
if ($error) { if ($error) {
common_element('p', 'error', $error); $this->element('p', 'error', $error);
} else { } else {
common_element_start('div', 'instructions'); $this->elementStart('div', 'instructions');
common_element('p', null, $this->element('p', null,
_('Use this form to invite your friends and colleagues to use this service.')); _('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_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', 'id' => 'invite',
'action' => common_local_url('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'), $this->trimmed('addresses'),
_('Addresses of friends to invite (one per line)')); _('Addresses of friends to invite (one per line)'));
common_textarea('personal', _('Personal message'), $this->textarea('personal', _('Personal message'),
$this->trimmed('personal'), $this->trimmed('personal'),
_('Optionally add a personal message to the invitation.')); _('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(); common_show_footer();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,21 +41,21 @@ class OpensearchAction extends Action
header('Content-Type: text/html'); header('Content-Type: text/html');
common_start_xml(); 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; $short_name = common_config('site', 'name').' '.$short_name;
common_element('ShortName', null, $short_name); $this->element('ShortName', null, $short_name);
common_element('Contact', null, common_config('site', 'email')); $this->element('Contact', null, common_config('site', 'email'));
common_element('Url', array('type' => 'text/html', 'method' => 'get', $this->element('Url', array('type' => 'text/html', 'method' => 'get',
'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---'))))); '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')); $this->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')); $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
common_element('AdultContent', null, 'false'); $this->element('AdultContent', null, 'false');
common_element('Language', null, common_language()); $this->element('Language', null, common_language());
common_element('OutputEncoding', null, 'UTF-8'); $this->element('OutputEncoding', null, 'UTF-8');
common_element('InputEncoding', null, 'UTF-8'); $this->element('InputEncoding', null, 'UTF-8');
common_element_end('OpenSearchDescription'); $this->elementEnd('OpenSearchDescription');
common_end_xml(); common_end_xml();
} }
} }

View File

@ -35,12 +35,12 @@ class OthersettingsAction extends SettingsAction
$this->form_header(_('Other Settings'), $msg, $success); $this->form_header(_('Other Settings'), $msg, $success);
common_element('h2', null, _('URL Auto-shortening')); $this->element('h2', null, _('URL Auto-shortening'));
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'othersettings', 'id' => 'othersettings',
'action' => 'action' =>
common_local_url('othersettings'))); common_local_url('othersettings')));
common_hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$services = array( $services = array(
'' => 'None', '' => 'None',
@ -54,13 +54,13 @@ class OthersettingsAction extends SettingsAction
'metamark.net' => 'metamark.net' '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(); // $this->show_delete_form();
common_show_footer(); common_show_footer();
@ -68,15 +68,15 @@ class OthersettingsAction extends SettingsAction
function show_feeds_list($feeds) function show_feeds_list($feeds)
{ {
common_element_start('div', array('class' => 'feedsdel')); $this->elementStart('div', array('class' => 'feedsdel'));
common_element('p', null, 'Feeds:'); $this->element('p', null, 'Feeds:');
common_element_start('ul', array('class' => 'xoxo')); $this->elementStart('ul', array('class' => 'xoxo'));
foreach ($feeds as $key => $value) { foreach ($feeds as $key => $value) {
$this->common_feed_item($feeds[$key]); $this->common_feed_item($feeds[$key]);
} }
common_element_end('ul'); $this->elementEnd('ul');
common_element_end('div'); $this->elementEnd('div');
} }
//TODO move to common.php (and retrace its origin) //TODO move to common.php (and retrace its origin)
@ -100,13 +100,13 @@ class OthersettingsAction extends SettingsAction
$feed['textContent'] = "FOAF"; $feed['textContent'] = "FOAF";
break; break;
} }
common_element_start('li'); $this->elementStart('li');
common_element('a', array('href' => $feed['href'], $this->element('a', array('href' => $feed['href'],
'class' => $feed_classname, 'class' => $feed_classname,
'type' => $feed_mimetype, 'type' => $feed_mimetype,
'title' => $feed_title), 'title' => $feed_title),
$feed['textContent']); $feed['textContent']);
common_element_end('li'); $this->elementEnd('li');
} }
// function show_delete_form() { // function show_delete_form() {
@ -115,13 +115,13 @@ class OthersettingsAction extends SettingsAction
// $notices->profile_id = $user->id; // $notices->profile_id = $user->id;
// $notice_count = (int) $notices->count(); // $notice_count = (int) $notices->count();
// //
// common_element_start('form', array('method' => 'POST', // $this->elementStart('form', array('method' => 'POST',
// 'id' => 'delete', // 'id' => 'delete',
// 'action' => // 'action' =>
// common_local_url('deleteprofile'))); // common_local_url('deleteprofile')));
// //
// common_hidden('token', common_session_token()); // $this->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->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)), // $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
// 'type' => 'rss', // 'type' => 'rss',
@ -132,8 +132,8 @@ class OthersettingsAction extends SettingsAction
// 'version' => 'FOAF', // 'version' => 'FOAF',
// 'item' => 'foaf'))); // 'item' => 'foaf')));
// //
// common_submit('deleteaccount', _('Delete my account')); // $this->submit('deleteaccount', _('Delete my account'));
// common_element_end('form'); // $this->elementEnd('form');
// } // }
function handle_post() function handle_post()

View File

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

View File

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

View File

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

View File

@ -39,45 +39,45 @@ class PublicxrdsAction extends Action
header('Content-Type: application/xrds+xml'); header('Content-Type: application/xrds+xml');
common_start_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', 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
'version' => '2.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) { foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
$this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE, $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
common_local_url($finish)); common_local_url($finish));
} }
common_element_end('XRD'); $this->elementEnd('XRD');
common_element_end('XRDS'); $this->elementEnd('XRDS');
common_end_xml(); common_end_xml();
} }
function show_service($type, $uri, $params=null, $sigs=null, $localId=null) function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
{ {
common_element_start('Service'); $this->elementStart('Service');
if ($uri) { if ($uri) {
common_element('URI', null, $uri); $this->element('URI', null, $uri);
} }
common_element('Type', null, $type); $this->element('Type', null, $type);
if ($params) { if ($params) {
foreach ($params as $param) { foreach ($params as $param) {
common_element('Type', null, $param); $this->element('Type', null, $param);
} }
} }
if ($sigs) { if ($sigs) {
foreach ($sigs as $sig) { foreach ($sigs as $sig) {
common_element('Type', null, $sig); $this->element('Type', null, $sig);
} }
} }
if ($localId) { 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) function show_top($msg=null)
{ {
if ($msg) { if ($msg) {
common_element('div', 'error', $msg); $this->element('div', 'error', $msg);
} else { } else {
common_element_start('div', 'instructions'); $this->elementStart('div', 'instructions');
common_element('p', null, $this->element('p', null,
_('If you\'ve forgotten or lost your' . _('If you\'ve forgotten or lost your' .
' password, you can get a new one sent to' . ' password, you can get a new one sent to' .
' the email address you have stored ' . ' the email address you have stored ' .
' in your account.')); ' in your account.'));
common_element_end('div'); $this->elementEnd('div');
} }
} }
function show_password_top($msg=null) function show_password_top($msg=null)
{ {
if ($msg) { if ($msg) {
common_element('div', 'error', $msg); $this->element('div', 'error', $msg);
} else { } else {
common_element('div', 'instructions', $this->element('div', 'instructions',
_('You\'ve been identified. Enter a ' . _('You\'ve been identified. Enter a ' .
' new password below. ')); ' new password below. '));
} }
@ -170,15 +170,15 @@ class RecoverpasswordAction extends Action
common_show_header(_('Recover password'), null, common_show_header(_('Recover password'), null,
$msg, array($this, 'show_top')); $msg, array($this, 'show_top'));
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'recoverpassword', 'id' => 'recoverpassword',
'action' => common_local_url('recoverpassword'))); 'action' => common_local_url('recoverpassword')));
common_input('nicknameoremail', _('Nickname or email'), $this->input('nicknameoremail', _('Nickname or email'),
$this->trimmed('nicknameoremail'), $this->trimmed('nicknameoremail'),
_('Your nickname on this server, ' . _('Your nickname on this server, ' .
'or your registered email address.')); 'or your registered email address.'));
common_submit('recover', _('Recover')); $this->submit('recover', _('Recover'));
common_element_end('form'); $this->elementEnd('form');
common_show_footer(); common_show_footer();
} }
@ -188,16 +188,16 @@ class RecoverpasswordAction extends Action
common_show_header(_('Reset password'), null, common_show_header(_('Reset password'), null,
$msg, array($this, 'show_password_top')); $msg, array($this, 'show_password_top'));
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'recoverpassword', 'id' => 'recoverpassword',
'action' => common_local_url('recoverpassword'))); 'action' => common_local_url('recoverpassword')));
common_hidden('token', common_session_token()); $this->hidden('token', common_session_token());
common_password('newpassword', _('New password'), $this->password('newpassword', _('New password'),
_('6 or more characters, and don\'t forget it!')); _('6 or more characters, and don\'t forget it!'));
common_password('confirm', _('Confirm'), $this->password('confirm', _('Confirm'),
_('Same as password above')); _('Same as password above'));
common_submit('reset', _('Reset')); $this->submit('reset', _('Reset'));
common_element_end('form'); $this->elementEnd('form');
common_show_footer(); common_show_footer();
} }
@ -278,7 +278,7 @@ class RecoverpasswordAction extends Action
mail_to_user($user, _('Password recovery requested'), $body, $confirm->address); mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
common_show_header(_('Password recovery requested')); common_show_header(_('Password recovery requested'));
common_element('p', null, $this->element('p', null,
_('Instructions for recovering your password ' . _('Instructions for recovering your password ' .
'have been sent to the email address registered to your ' . 'have been sent to the email address registered to your ' .
'account.')); 'account.'));
@ -336,7 +336,7 @@ class RecoverpasswordAction extends Action
common_real_login(true); common_real_login(true);
common_show_header(_('Password saved.')); 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.')); 'You are now logged in.'));
common_show_footer(); common_show_footer();
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -81,10 +81,10 @@ class ShownoticeAction extends StreamAction
array($this, 'show_header'), null, array($this, 'show_header'), null,
array($this, 'show_top')); array($this, 'show_top'));
common_element_start('ul', array('id' => 'notices')); $this->elementStart('ul', array('id' => 'notices'));
$nli = new NoticeListItem($this->notice); $nli = new NoticeListItem($this->notice);
$nli->show(); $nli->show();
common_element_end('ul'); $this->elementEnd('ul');
common_show_footer(); common_show_footer();
} }
@ -99,12 +99,12 @@ class ShownoticeAction extends StreamAction
} }
if ($user->emailmicroid && $user->email && $this->notice->uri) { 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)))); 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
} }
if ($user->jabbermicroid && $user->jabber && $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)))); '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) function show_header($user)
{ {
# Feeds # Feeds
common_element('link', array('rel' => 'alternate', $this->element('link', array('rel' => 'alternate',
'href' => common_local_url('api', 'href' => common_local_url('api',
array('apiaction' => 'statuses', array('apiaction' => 'statuses',
'method' => 'user_timeline.rss', 'method' => 'user_timeline.rss',
'argument' => $user->nickname)), 'argument' => $user->nickname)),
'type' => 'application/rss+xml', 'type' => 'application/rss+xml',
'title' => sprintf(_('Notice feed for %s'), $user->nickname))); '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', 'href' => common_local_url('api',
array('apiaction' => 'statuses', array('apiaction' => 'statuses',
'method' => 'user_timeline.atom', 'method' => 'user_timeline.atom',
'argument' => $user->nickname)), 'argument' => $user->nickname)),
'type' => 'application/atom+xml', 'type' => 'application/atom+xml',
'title' => sprintf(_('Notice feed for %s'), $user->nickname))); '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' => 'href' => common_local_url('userrss', array('nickname' =>
$user->nickname)), $user->nickname)),
'type' => 'application/rdf+xml', 'type' => 'application/rdf+xml',
'title' => sprintf(_('Notice feed for %s'), $user->nickname))); 'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
# FOAF # FOAF
common_element('link', array('rel' => 'meta', $this->element('link', array('rel' => 'meta',
'href' => common_local_url('foaf', array('nickname' => 'href' => common_local_url('foaf', array('nickname' =>
$user->nickname)), $user->nickname)),
'type' => 'application/rdf+xml', 'type' => 'application/rdf+xml',
'title' => 'FOAF')); 'title' => 'FOAF'));
# for remote subscriptions etc. # 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' => 'content' => common_local_url('xrds', array('nickname' =>
$user->nickname)))); $user->nickname))));
$profile = $user->getProfile(); $profile = $user->getProfile();
if ($profile->bio) { if ($profile->bio) {
common_element('meta', array('name' => 'description', $this->element('meta', array('name' => 'description',
'content' => $profile->bio)); 'content' => $profile->bio));
} }
if ($user->emailmicroid && $user->email && $profile->profileurl) { 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)))); 'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
} }
if ($user->jabbermicroid && $user->jabber && $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)))); 'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
} }
# See https://wiki.mozilla.org/Microsummaries # See https://wiki.mozilla.org/Microsummaries
common_element('link', array('rel' => 'microsummary', $this->element('link', array('rel' => 'microsummary',
'href' => common_local_url('microsummary', 'href' => common_local_url('microsummary',
array('nickname' => $profile->nickname)))); array('nickname' => $profile->nickname))));
} }
@ -165,7 +165,7 @@ class ShowstreamAction extends StreamAction
function show_profile($profile) 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); $this->show_personal($profile);
@ -175,23 +175,23 @@ class ShowstreamAction extends StreamAction
$this->show_subscriptions($profile); $this->show_subscriptions($profile);
common_element_end('div'); $this->elementEnd('div');
} }
function show_personal($profile) function show_personal($profile)
{ {
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
common_element_start('div', array('id' => 'profile_avatar')); $this->elementStart('div', array('id' => 'profile_avatar'));
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 profile photo', 'class' => 'avatar profile photo',
'width' => AVATAR_PROFILE_SIZE, 'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE,
'alt' => $profile->nickname)); '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(); $cur = common_current_user();
if ($cur) { if ($cur) {
if ($cur->id != $profile->id) { if ($cur->id != $profile->id) {
@ -204,14 +204,14 @@ class ShowstreamAction extends StreamAction
} else { } else {
$this->show_remote_subscribe_link($profile); $this->show_remote_subscribe_link($profile);
} }
common_element_end('li'); $this->elementEnd('li');
$user = User::staticGet('id', $profile->id); $user = User::staticGet('id', $profile->id);
common_profile_new_message_nudge($cur, $user, $profile); common_profile_new_message_nudge($cur, $user, $profile);
if ($cur && $cur->id != $profile->id) { if ($cur && $cur->id != $profile->id) {
$blocked = $cur->hasBlocked($profile); $blocked = $cur->hasBlocked($profile);
common_element_start('li', array('id' => 'profile_block')); $this->elementStart('li', array('id' => 'profile_block'));
if ($blocked) { if ($blocked) {
common_unblock_form($profile, array('action' => 'showstream', common_unblock_form($profile, array('action' => 'showstream',
'nickname' => $profile->nickname)); 'nickname' => $profile->nickname));
@ -219,62 +219,62 @@ class ShowstreamAction extends StreamAction
common_block_form($profile, array('action' => 'showstream', common_block_form($profile, array('action' => 'showstream',
'nickname' => $profile->nickname)); '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) { if ($profile->fullname) {
common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')'); $this->element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
} else { } else {
common_element('h1', array('class' => 'fn nickname'), $profile->nickname); $this->element('h1', array('class' => 'fn nickname'), $profile->nickname);
} }
if ($profile->location) { if ($profile->location) {
common_element('p', 'location', $profile->location); $this->element('p', 'location', $profile->location);
} }
if ($profile->bio) { if ($profile->bio) {
common_element('p', 'description note', $profile->bio); $this->element('p', 'description note', $profile->bio);
} }
if ($profile->homepage) { if ($profile->homepage) {
common_element_start('p', 'website'); $this->elementStart('p', 'website');
common_element('a', array('href' => $profile->homepage, $this->element('a', array('href' => $profile->homepage,
'rel' => 'me', 'class' => 'url'), 'rel' => 'me', 'class' => 'url'),
$profile->homepage); $profile->homepage);
common_element_end('p'); $this->elementEnd('p');
} }
$this->show_statistics($profile); $this->show_statistics($profile);
common_element_end('div'); $this->elementEnd('div');
} }
function show_remote_subscribe_link($profile) function show_remote_subscribe_link($profile)
{ {
$url = common_local_url('remotesubscribe', $url = common_local_url('remotesubscribe',
array('nickname' => $profile->nickname)); array('nickname' => $profile->nickname));
common_element('a', array('href' => $url, $this->element('a', array('href' => $url,
'id' => 'remotesubscribe'), 'id' => 'remotesubscribe'),
_('Subscribe')); _('Subscribe'));
} }
function show_unsubscribe_form($profile) 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'))); 'action' => common_local_url('unsubscribe')));
common_hidden('token', common_session_token()); $this->hidden('token', common_session_token());
common_element('input', array('id' => 'unsubscribeto', $this->element('input', array('id' => 'unsubscribeto',
'name' => 'unsubscribeto', 'name' => 'unsubscribeto',
'type' => 'hidden', 'type' => 'hidden',
'value' => $profile->nickname)); 'value' => $profile->nickname));
common_element('input', array('type' => 'submit', $this->element('input', array('type' => 'submit',
'class' => 'submit', 'class' => 'submit',
'value' => _('Unsubscribe'))); 'value' => _('Unsubscribe')));
common_element_end('form'); $this->elementEnd('form');
} }
function show_subscriptions($profile) function show_subscriptions($profile)
@ -293,13 +293,13 @@ class ShowstreamAction extends StreamAction
$subs_count = $subs->find(); $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) { 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++) { for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
@ -315,39 +315,39 @@ class ShowstreamAction extends StreamAction
continue; continue;
} }
common_element_start('li', 'vcard'); $this->elementStart('li', 'vcard');
common_element_start('a', array('title' => ($other->fullname) ? $this->elementStart('a', array('title' => ($other->fullname) ?
$other->fullname : $other->fullname :
$other->nickname, $other->nickname,
'href' => $other->profileurl, 'href' => $other->profileurl,
'rel' => 'contact', 'rel' => 'contact',
'class' => 'subscription fn url')); 'class' => 'subscription fn url'));
$avatar = $other->getAvatar(AVATAR_MINI_SIZE); $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, 'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE,
'class' => 'avatar mini photo', 'class' => 'avatar mini photo',
'alt' => ($other->fullname) ? 'alt' => ($other->fullname) ?
$other->fullname : $other->fullname :
$other->nickname)); $other->nickname));
common_element_end('a'); $this->elementEnd('a');
common_element_end('li'); $this->elementEnd('li');
} }
common_element_end('ul'); $this->elementEnd('ul');
} }
if ($subs_count > SUBSCRIPTIONS) { 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)), array('nickname' => $profile->nickname)),
'class' => 'moresubscriptions'), 'class' => 'moresubscriptions'),
_('All subscriptions')); _('All subscriptions'));
common_element_end('p'); $this->elementEnd('p');
} }
common_element_end('div'); $this->elementEnd('div');
} }
function show_statistics($profile) function show_statistics($profile)
@ -366,49 +366,49 @@ class ShowstreamAction extends StreamAction
$notices->profile_id = $profile->id; $notices->profile_id = $profile->id;
$notice_count = (int) $notices->count(); $notice_count = (int) $notices->count();
common_element_start('div', 'statistics'); $this->elementStart('div', 'statistics');
common_element('h2', 'statistics', _('Statistics')); $this->element('h2', 'statistics', _('Statistics'));
# Other stats...? # Other stats...?
common_element_start('dl', 'statistics'); $this->elementStart('dl', 'statistics');
common_element('dt', 'membersince', _('Member since')); $this->element('dt', 'membersince', _('Member since'));
common_element('dd', 'membersince', date('j M Y', $this->element('dd', 'membersince', date('j M Y',
strtotime($profile->created))); strtotime($profile->created)));
common_element_start('dt', 'subscriptions'); $this->elementStart('dt', 'subscriptions');
common_element('a', array('href' => common_local_url('subscriptions', $this->element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $profile->nickname))), array('nickname' => $profile->nickname))),
_('Subscriptions')); _('Subscriptions'));
common_element_end('dt'); $this->elementEnd('dt');
common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0'); $this->element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
common_element_start('dt', 'subscribers'); $this->elementStart('dt', 'subscribers');
common_element('a', array('href' => common_local_url('subscribers', $this->element('a', array('href' => common_local_url('subscribers',
array('nickname' => $profile->nickname))), array('nickname' => $profile->nickname))),
_('Subscribers')); _('Subscribers'));
common_element_end('dt'); $this->elementEnd('dt');
common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0'); $this->element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
common_element('dt', 'notices', _('Notices')); $this->element('dt', 'notices', _('Notices'));
common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0'); $this->element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
# XXX: link these to something # XXX: link these to something
common_element('dt', 'tags', _('Tags')); $this->element('dt', 'tags', _('Tags'));
common_element_start('dd', 'tags'); $this->elementStart('dd', 'tags');
$tags = Profile_tag::getTags($profile->id, $profile->id); $tags = Profile_tag::getTags($profile->id, $profile->id);
common_element_start('ul', 'tags xoxo'); $this->elementStart('ul', 'tags xoxo');
foreach ($tags as $tag) { foreach ($tags as $tag) {
common_element_start('li'); $this->elementStart('li');
common_element('a', array('rel' => 'bookmark tag', $this->element('a', array('rel' => 'bookmark tag',
'href' => common_local_url('peopletag', 'href' => common_local_url('peopletag',
array('tag' => $tag))), array('tag' => $tag))),
$tag); $tag);
common_element_end('li'); $this->elementEnd('li');
} }
common_element_end('ul'); $this->elementEnd('ul');
common_element_end('dd'); $this->elementEnd('dd');
common_element_end('dl'); $this->elementEnd('dl');
common_element_end('div'); $this->elementEnd('div');
} }
function show_notices($user) function show_notices($user)
@ -428,22 +428,22 @@ class ShowstreamAction extends StreamAction
function show_last_notice($profile) function show_last_notice($profile)
{ {
common_element('h2', null, _('Currently')); $this->element('h2', null, _('Currently'));
$notice = $profile->getCurrentNotice(); $notice = $profile->getCurrentNotice();
if ($notice) { if ($notice) {
# FIXME: URL, image, video, audio # FIXME: URL, image, video, audio
common_element_start('p', array('class' => 'notice_current')); $this->elementStart('p', array('class' => 'notice_current'));
if ($notice->rendered) { if ($notice->rendered) {
common_raw($notice->rendered); $this->raw($notice->rendered);
} else { } else {
# XXX: may be some uncooked notices in the DB, # XXX: may be some uncooked notices in the DB,
# we cook them right now. This can probably disappear in future # we cook them right now. This can probably disappear in future
# versions (>> 0.4.x) # 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(); $user = common_current_user();
$this->form_header(_('SMS Settings'), $msg, $success); $this->form_header(_('SMS Settings'), $msg, $success);
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'smssettings', 'id' => 'smssettings',
'action' => 'action' =>
common_local_url('smssettings'))); common_local_url('smssettings')));
common_hidden('token', common_session_token()); $this->hidden('token', common_session_token());
common_element('h2', null, _('Address')); $this->element('h2', null, _('Address'));
if ($user->sms) { if ($user->sms) {
common_element_start('p'); $this->elementStart('p');
$carrier = $user->getCarrier(); $carrier = $user->getCarrier();
common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')'); $this->element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
common_element('span', 'input_instructions', $this->element('span', 'input_instructions',
_('Current confirmed SMS-enabled phone number.')); _('Current confirmed SMS-enabled phone number.'));
common_hidden('sms', $user->sms); $this->hidden('sms', $user->sms);
common_hidden('carrier', $user->carrier); $this->hidden('carrier', $user->carrier);
common_element_end('p'); $this->elementEnd('p');
common_submit('remove', _('Remove')); $this->submit('remove', _('Remove'));
} else { } else {
$confirm = $this->get_confirmation(); $confirm = $this->get_confirmation();
if ($confirm) { if ($confirm) {
$carrier = Sms_carrier::staticGet($confirm->address_extra); $carrier = Sms_carrier::staticGet($confirm->address_extra);
common_element_start('p'); $this->elementStart('p');
common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')'); $this->element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
common_element('span', 'input_instructions', $this->element('span', 'input_instructions',
_('Awaiting confirmation on this phone number.')); _('Awaiting confirmation on this phone number.'));
common_hidden('sms', $confirm->address); $this->hidden('sms', $confirm->address);
common_hidden('carrier', $confirm->address_extra); $this->hidden('carrier', $confirm->address_extra);
common_element_end('p'); $this->elementEnd('p');
common_submit('cancel', _('Cancel')); $this->submit('cancel', _('Cancel'));
common_input('code', _('Confirmation code'), null, $this->input('code', _('Confirmation code'), null,
_('Enter the code you received on your phone.')); _('Enter the code you received on your phone.'));
common_submit('confirm', _('Confirm')); $this->submit('confirm', _('Confirm'));
} else { } else {
common_input('sms', _('SMS Phone number'), $this->input('sms', _('SMS Phone number'),
($this->arg('sms')) ? $this->arg('sms') : null, ($this->arg('sms')) ? $this->arg('sms') : null,
_('Phone number, no punctuation or spaces, with area code')); _('Phone number, no punctuation or spaces, with area code'));
$this->carrier_select(); $this->carrier_select();
common_submit('add', _('Add')); $this->submit('add', _('Add'));
} }
} }
if ($user->sms) { if ($user->sms) {
common_element('h2', null, _('Incoming email')); $this->element('h2', null, _('Incoming email'));
if ($user->incomingemail) { if ($user->incomingemail) {
common_element_start('p'); $this->elementStart('p');
common_element('span', 'address', $user->incomingemail); $this->element('span', 'address', $user->incomingemail);
common_element('span', 'input_instructions', $this->element('span', 'input_instructions',
_('Send email to this address to post new notices.')); _('Send email to this address to post new notices.'));
common_element_end('p'); $this->elementEnd('p');
common_submit('removeincoming', _('Remove')); $this->submit('removeincoming', _('Remove'));
} }
common_element_start('p'); $this->elementStart('p');
common_element('span', 'input_instructions', $this->element('span', 'input_instructions',
_('Make a new email address for posting to; cancels the old one.')); _('Make a new email address for posting to; cancels the old one.'));
common_element_end('p'); $this->elementEnd('p');
common_submit('newincoming', _('New')); $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.'), _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
$user->smsnotify); $user->smsnotify);
common_submit('save', _('Save')); $this->submit('save', _('Save'));
common_element_end('form'); $this->elementEnd('form');
common_show_footer(); common_show_footer();
} }
@ -307,19 +307,19 @@ class SmssettingsAction extends EmailsettingsAction
$carrier = new Sms_carrier(); $carrier = new Sms_carrier();
$cnt = $carrier->find(); $cnt = $carrier->find();
common_element_start('p'); $this->elementStart('p');
common_element('label', array('for' => 'carrier')); $this->element('label', array('for' => 'carrier'));
common_element_start('select', array('name' => 'carrier', $this->elementStart('select', array('name' => 'carrier',
'id' => 'carrier')); 'id' => 'carrier'));
common_element('option', array('value' => 0), $this->element('option', array('value' => 0),
_('Select a carrier')); _('Select a carrier'));
while ($carrier->fetch()) { while ($carrier->fetch()) {
common_element('option', array('value' => $carrier->id), $this->element('option', array('value' => $carrier->id),
$carrier->name); $carrier->name);
} }
common_element_end('select'); $this->elementEnd('select');
common_element_end('p'); $this->elementEnd('p');
common_element('span', 'input_instructions', $this->element('span', 'input_instructions',
sprintf(_('Mobile carrier for your phone. '. sprintf(_('Mobile carrier for your phone. '.
'If you know a carrier that accepts ' . 'If you know a carrier that accepts ' .
'SMS over email but isn\'t listed here, ' . 'SMS over email but isn\'t listed here, ' .

View File

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

View File

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

View File

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

View File

@ -61,7 +61,7 @@ class TagotherAction extends Action
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); $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', 'class' => 'avatar stream',
'width' => AVATAR_PROFILE_SIZE, 'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE,
@ -69,39 +69,39 @@ class TagotherAction extends Action
($profile->fullname) ? $profile->fullname : ($profile->fullname) ? $profile->fullname :
$profile->nickname)); $profile->nickname));
common_element('a', array('href' => $profile->profileurl, $this->element('a', array('href' => $profile->profileurl,
'class' => 'external profile nickname'), 'class' => 'external profile nickname'),
$profile->nickname); $profile->nickname);
if ($profile->fullname) { if ($profile->fullname) {
common_element_start('div', 'fullname'); $this->elementStart('div', 'fullname');
if ($profile->homepage) { if ($profile->homepage) {
common_element('a', array('href' => $profile->homepage), $this->element('a', array('href' => $profile->homepage),
$profile->fullname); $profile->fullname);
} else { } else {
common_text($profile->fullname); $this->text($profile->fullname);
} }
common_element_end('div'); $this->elementEnd('div');
} }
if ($profile->location) { if ($profile->location) {
common_element('div', 'location', $profile->location); $this->element('div', 'location', $profile->location);
} }
if ($profile->bio) { 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', 'id' => 'tag_user',
'name' => 'tagother', 'name' => 'tagother',
'action' => $this->self_url())); 'action' => $this->self_url()));
common_hidden('token', common_session_token()); $this->hidden('token', common_session_token());
common_hidden('id', $profile->id); $this->hidden('id', $profile->id);
common_input('tags', _('Tags'), $this->input('tags', _('Tags'),
($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)), ($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')); _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
common_submit('save', _('Save')); $this->submit('save', _('Save'));
common_element_end('form'); $this->elementEnd('form');
common_show_footer(); common_show_footer();
} }
@ -162,20 +162,20 @@ class TagotherAction extends Action
if ($this->boolean('ajax')) { if ($this->boolean('ajax')) {
common_start_html('text/xml'); common_start_html('text/xml');
common_element_start('head'); $this->elementStart('head');
common_element('title', null, _('Tags')); $this->element('title', null, _('Tags'));
common_element_end('head'); $this->elementEnd('head');
common_element_start('body'); $this->elementStart('body');
common_element_start('p', 'subtags'); $this->elementStart('p', 'subtags');
foreach ($tags as $tag) { 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, array('nickname' => $user->nickname,
'tag' => $tag))), 'tag' => $tag))),
$tag); $tag);
} }
common_element_end('p'); $this->elementEnd('p');
common_element_end('body'); $this->elementEnd('body');
common_element_end('html'); $this->elementEnd('html');
} else { } else {
common_redirect(common_local_url($action, array('nickname' => common_redirect(common_local_url($action, array('nickname' =>
$user->nickname))); $user->nickname)));
@ -186,12 +186,12 @@ class TagotherAction extends Action
{ {
list($profile, $error) = $arr; list($profile, $error) = $arr;
if ($error) { if ($error) {
common_element('p', 'error', $error); $this->element('p', 'error', $error);
} else { } else {
common_element_start('div', 'instructions'); $this->elementStart('div', 'instructions');
common_element('p', null, $this->element('p', null,
_('Use this form to add tags to your subscribers or subscriptions.')); _('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'); $this->init_document('xml');
common_element_start('direct-messages', array('type' => 'array')); $this->elementStart('direct-messages', array('type' => 'array'));
if (is_array($messages)) { if (is_array($messages)) {
foreach ($message as $m) { 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'); $this->end_document('xml');
} }
@ -236,13 +236,13 @@ class Twitapidirect_messagesAction extends TwitterapiAction
$this->init_document('rss'); $this->init_document('rss');
common_element_start('channel'); $this->elementStart('channel');
common_element('title', null, $title); $this->element('title', null, $title);
common_element('link', null, $link); $this->element('link', null, $link);
common_element('description', null, $subtitle); $this->element('description', null, $subtitle);
common_element('language', null, 'en-us'); $this->element('language', null, 'en-us');
common_element('ttl', null, '40'); $this->element('ttl', null, '40');
if (is_array($message)) { if (is_array($message)) {
foreach ($message as $m) { foreach ($message as $m) {
@ -256,7 +256,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
} }
} }
common_element_end('channel'); $this->elementEnd('channel');
$this->end_twitter_rss(); $this->end_twitter_rss();
} }
@ -266,12 +266,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction
$this->init_document('atom'); $this->init_document('atom');
common_element('title', null, $title); $this->element('title', null, $title);
$siteserver = common_config('site', 'server'); $siteserver = common_config('site', 'server');
common_element('id', null, "tag:$siteserver,2008:DirectMessage"); $this->element('id', null, "tag:$siteserver,2008:DirectMessage");
common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null); $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
common_element('updated', null, common_date_iso8601(strftime('%c'))); $this->element('updated', null, common_date_iso8601(strftime('%c')));
common_element('subtitle', null, $subtitle); $this->element('subtitle', null, $subtitle);
if (is_array($message)) { if (is_array($message)) {
foreach ($message as $m) { foreach ($message as $m) {

View File

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

View File

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

View File

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

View File

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

View File

@ -44,52 +44,52 @@ class TwittersettingsAction extends SettingsAction
} }
$this->form_header(_('Twitter settings'), $msg, $success); $this->form_header(_('Twitter settings'), $msg, $success);
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'twittersettings', 'id' => 'twittersettings',
'action' => 'action' =>
common_local_url('twittersettings'))); 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) { if ($fuser) {
common_element_start('p'); $this->elementStart('p');
common_element('span', 'twitter_user', $fuser->nickname); $this->element('span', 'twitter_user', $fuser->nickname);
common_element('a', array('href' => $fuser->uri), $fuser->uri); $this->element('a', array('href' => $fuser->uri), $fuser->uri);
common_element('span', 'input_instructions', $this->element('span', 'input_instructions',
_('Current verified Twitter account.')); _('Current verified Twitter account.'));
common_hidden('flink_foreign_id', $flink->foreign_id); $this->hidden('flink_foreign_id', $flink->foreign_id);
common_element_end('p'); $this->elementEnd('p');
common_submit('remove', _('Remove')); $this->submit('remove', _('Remove'));
} else { } 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, ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
_('No spaces, please.')); // hey, it's what Twitter says _('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); ($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); ($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); ($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
if ($flink) { if ($flink) {
common_submit('save', _('Save')); $this->submit('save', _('Save'));
} else { } else {
common_submit('add', _('Add')); $this->submit('add', _('Add'));
} }
$this->show_twitter_subscriptions(); $this->show_twitter_subscriptions();
common_element_end('form'); $this->elementEnd('form');
common_show_footer(); common_show_footer();
} }
@ -131,9 +131,9 @@ class TwittersettingsAction extends SettingsAction
if ($friends_count > 0) { if ($friends_count > 0) {
common_element('h3', null, _('Twitter Friends')); $this->element('h3', null, _('Twitter Friends'));
common_element_start('div', array('id' => 'subscriptions')); $this->elementStart('div', array('id' => 'subscriptions'));
common_element_start('ul', array('id' => 'subscriptions_avatars')); $this->elementStart('ul', array('id' => 'subscriptions_avatars'));
for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) { for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
@ -144,28 +144,28 @@ class TwittersettingsAction extends SettingsAction
continue; continue;
} }
common_element_start('li'); $this->elementStart('li');
common_element_start('a', array('title' => ($other->fullname) ? $this->elementStart('a', array('title' => ($other->fullname) ?
$other->fullname : $other->fullname :
$other->nickname, $other->nickname,
'href' => $other->profileurl, 'href' => $other->profileurl,
'rel' => 'contact', 'rel' => 'contact',
'class' => 'subscription')); 'class' => 'subscription'));
$avatar = $other->getAvatar(AVATAR_MINI_SIZE); $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, 'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE,
'class' => 'avatar mini', 'class' => 'avatar mini',
'alt' => ($other->fullname) ? 'alt' => ($other->fullname) ?
$other->fullname : $other->fullname :
$other->nickname)); $other->nickname));
common_element_end('a'); $this->elementEnd('a');
common_element_end('li'); $this->elementEnd('li');
} }
common_element_end('ul'); $this->elementEnd('ul');
common_element_end('div'); $this->elementEnd('div');
} }
@ -173,13 +173,13 @@ class TwittersettingsAction extends SettingsAction
/* /*
if ($subs_count > SUBSCRIPTIONS) { 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)), array('nickname' => $profile->nickname)),
'class' => 'moresubscriptions'), 'class' => 'moresubscriptions'),
_('All subscriptions')); _('All subscriptions'));
common_element_end('p'); $this->elementEnd('p');
} }
*/ */

View File

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

View File

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

View File

@ -47,14 +47,14 @@ class XrdsAction extends Action
header('Content-Type: application/xrds+xml'); header('Content-Type: application/xrds+xml');
common_start_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', 'xml:id' => 'oauth',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0', 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
'version' => '2.0')); 'version' => '2.0'));
common_element('Type', null, 'xri://$xrds*simple'); $this->element('Type', null, 'xri://$xrds*simple');
$this->show_service(OAUTH_ENDPOINT_REQUEST, $this->show_service(OAUTH_ENDPOINT_REQUEST,
common_local_url('requesttoken'), common_local_url('requesttoken'),
@ -77,16 +77,16 @@ class XrdsAction extends Action
array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY), array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
array(OAUTH_HMAC_SHA1)); array(OAUTH_HMAC_SHA1));
common_element_end('XRD'); $this->elementEnd('XRD');
# XXX: decide whether to include user's ID/nickname in postNotice URL # 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', 'xml:id' => 'omb',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0', 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
'version' => '2.0')); 'version' => '2.0'));
common_element('Type', null, 'xri://$xrds*simple'); $this->element('Type', null, 'xri://$xrds*simple');
$this->show_service(OMB_ENDPOINT_POSTNOTICE, $this->show_service(OMB_ENDPOINT_POSTNOTICE,
common_local_url('postnotice')); common_local_url('postnotice'));
@ -94,44 +94,44 @@ class XrdsAction extends Action
$this->show_service(OMB_ENDPOINT_UPDATEPROFILE, $this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
common_local_url('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')); 'version' => '2.0'));
common_element('Type', null, 'xri://$xrds*simple'); $this->element('Type', null, 'xri://$xrds*simple');
$this->show_service(OAUTH_DISCOVERY, $this->show_service(OAUTH_DISCOVERY,
'#oauth'); '#oauth');
$this->show_service(OMB_NAMESPACE, $this->show_service(OMB_NAMESPACE,
'#omb'); '#omb');
common_element_end('XRD'); $this->elementEnd('XRD');
common_element_end('XRDS'); $this->elementEnd('XRDS');
common_end_xml(); common_end_xml();
} }
function show_service($type, $uri, $params=null, $sigs=null, $localId=null) function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
{ {
common_element_start('Service'); $this->elementStart('Service');
if ($uri) { if ($uri) {
common_element('URI', null, $uri); $this->element('URI', null, $uri);
} }
common_element('Type', null, $type); $this->element('Type', null, $type);
if ($params) { if ($params) {
foreach ($params as $param) { foreach ($params as $param) {
common_element('Type', null, $param); $this->element('Type', null, $param);
} }
} }
if ($sigs) { if ($sigs) {
foreach ($sigs as $sig) { foreach ($sigs as $sig) {
common_element('Type', null, $sig); $this->element('Type', null, $sig);
} }
} }
if ($localId) { 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->elementStart('div', array('id' => 'content'));
$this->showPageTitle(); $this->showPageTitle();
$this->showPageNotice(); $this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner')); $this->elementStart('div', array('id' => 'content_inner'));
// show the actual content (forms, lists, whatever) // show the actual content (forms, lists, whatever)
$this->showContent(); $this->showContent();
@ -326,19 +326,24 @@ class Action extends HTMLOutputter // lawsuit
$this->element('h1', NULL, $this->title()); $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) // SHOULD overload (unless there's not a notice)
function showPageNotice() 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 // MUST overload
function showContent() function showContent()