Update lib/action.php to use the right XMLOutputter functions

Global search and replace for common_element_*
This commit is contained in:
Evan Prodromou 2009-01-14 01:59:30 -05:00
parent 4009e4a75d
commit 0f7e8585cd
1 changed files with 40 additions and 41 deletions

View File

@ -106,7 +106,7 @@ class Action extends HTMLOutputter // lawsuit
function showStylesheets() function showStylesheets()
{ {
common_element('link', array('rel' => 'stylesheet', $this->element('link', array('rel' => 'stylesheet',
'type' => 'text/css', 'type' => 'text/css',
'href' => theme_path('display.css') . '?version=' . LACONICA_VERSION, 'href' => theme_path('display.css') . '?version=' . LACONICA_VERSION,
'media' => 'screen, projection, tv')); 'media' => 'screen, projection, tv'));
@ -121,27 +121,27 @@ class Action extends HTMLOutputter // lawsuit
function showScripts() function showScripts()
{ {
common_element('script', array('type' => 'text/javascript', $this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/jquery.min.js')), 'src' => common_path('js/jquery.min.js')),
' '); ' ');
common_element('script', array('type' => 'text/javascript', $this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/jquery.form.js')), 'src' => common_path('js/jquery.form.js')),
' '); ' ');
common_element('script', array('type' => 'text/javascript', $this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/xbImportNode.js')), 'src' => common_path('js/xbImportNode.js')),
' '); ' ');
common_element('script', array('type' => 'text/javascript', $this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/util.js?version='.LACONICA_VERSION)), 'src' => common_path('js/util.js?version='.LACONICA_VERSION)),
' '); ' ');
} }
function showOpenSearch() function showOpenSearch()
{ {
common_element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml', $this->element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml',
'href' => common_local_url('opensearch', array('type' => 'people')), 'href' => common_local_url('opensearch', array('type' => 'people')),
'title' => common_config('site', 'name').' People Search')); 'title' => common_config('site', 'name').' People Search'));
common_element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml', $this->element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml',
'href' => common_local_url('opensearch', array('type' => 'notice')), 'href' => common_local_url('opensearch', array('type' => 'notice')),
'title' => common_config('site', 'name').' Notice Search')); 'title' => common_config('site', 'name').' Notice Search'));
} }
@ -188,9 +188,9 @@ class Action extends HTMLOutputter // lawsuit
function showLogo() function showLogo()
{ {
$this->element_start('address', array('id' => 'site_contact', $this->elementStart('address', array('id' => 'site_contact',
'class' => 'vcard')); 'class' => 'vcard'));
$this->element_start('a', array('class' => 'url home bookmark', $this->elementStart('a', array('class' => 'url home bookmark',
'href' => common_local_url('public'))); 'href' => common_local_url('public')));
if ((isset($config['site']['logo']) && is_string($config['site']['logo']) && (strlen($config['site']['logo']) > 0)) if ((isset($config['site']['logo']) && is_string($config['site']['logo']) && (strlen($config['site']['logo']) > 0))
|| file_exists(theme_file('logo.png'))) || file_exists(theme_file('logo.png')))
@ -201,14 +201,14 @@ class Action extends HTMLOutputter // lawsuit
'alt' => $config['site']['name']); 'alt' => $config['site']['name']);
} }
$this->element('span', array('class' => 'fn org'), $config['site']['name'])); $this->element('span', array('class' => 'fn org'), $config['site']['name']));
$this->element_end('a'); $this->elementEnd('a');
$this->element_end('address'); $this->elementEnd('address');
} }
function showPrimaryNav() function showPrimaryNav()
{ {
$user = common_current_user(); $user = common_current_user();
common_element_start('ul', array('id' => 'nav')); $this->elementStart('ul', array('id' => 'nav'));
if ($user) { if ($user) {
common_menu_item(common_local_url('all', array('nickname' => $user->nickname)), common_menu_item(common_local_url('all', array('nickname' => $user->nickname)),
_('Home')); _('Home'));
@ -230,7 +230,7 @@ class Action extends HTMLOutputter // lawsuit
} }
common_menu_item(common_local_url('doc', array('title' => 'help')), common_menu_item(common_local_url('doc', array('title' => 'help')),
_('Help')); _('Help'));
common_element_end('ul'); $this->elementEnd('ul');
} }
function showSiteNotice() function showSiteNotice()
@ -315,7 +315,7 @@ class Action extends HTMLOutputter // lawsuit
function showSecondaryNav() function showSecondaryNav()
{ {
common_element_start('ul', array('id' => 'nav_sub')); $this->elementStart('ul', array('id' => 'nav_sub'));
common_menu_item(common_local_url('doc', array('title' => 'help')), common_menu_item(common_local_url('doc', array('title' => 'help')),
_('Help')); _('Help'));
common_menu_item(common_local_url('doc', array('title' => 'about')), common_menu_item(common_local_url('doc', array('title' => 'about')),
@ -328,7 +328,7 @@ class Action extends HTMLOutputter // lawsuit
_('Source')); _('Source'));
common_menu_item(common_local_url('doc', array('title' => 'contact')), common_menu_item(common_local_url('doc', array('title' => 'contact')),
_('Contact')); _('Contact'));
common_element_end('ul'); $this->elementEnd('ul');
} }
function showLicenses() function showLicenses()
@ -341,7 +341,7 @@ class Action extends HTMLOutputter // lawsuit
function showLaconicaLicense() function showLaconicaLicense()
{ {
common_element_start('div', 'laconica'); $this->elementStart('div', 'laconica');
if (common_config('site', 'broughtby')) { if (common_config('site', 'broughtby')) {
$instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). '); $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
} else { } else {
@ -350,25 +350,25 @@ class Action extends HTMLOutputter // lawsuit
$instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION); $instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION);
$output = common_markup_to_html($instr); $output = common_markup_to_html($instr);
common_raw($output); common_raw($output);
common_element_end('div'); $this->elementEnd('div');
// do it // do it
} }
function showContentLicense() function showContentLicense()
{ {
common_element_start('div', array('id' => 'footer')); $this->elementStart('div', array('id' => 'footer'));
common_element('img', array('id' => 'cc', $this->element('img', array('id' => 'cc',
'src' => $config['license']['image'], 'src' => $config['license']['image'],
'alt' => $config['license']['title'])); 'alt' => $config['license']['title']));
common_element_start('p'); $this->elementStart('p');
common_text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the ')); common_text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
common_element('a', array('class' => 'license', $this->element('a', array('class' => 'license',
'rel' => 'license', 'rel' => 'license',
'href' => $config['license']['url']), 'href' => $config['license']['url']),
$config['license']['title']); $config['license']['title']);
common_text(_('. Contributors should be attributed by full name or nickname.')); common_text(_('. Contributors should be attributed by full name or nickname.'));
common_element_end('p'); $this->elementEnd('p');
common_element_end('div'); $this->elementEnd('div');
} }
// For comparison with If-Last-Modified // For comparison with If-Last-Modified
@ -481,7 +481,7 @@ class Action extends HTMLOutputter // lawsuit
function nav_menu($menu) function nav_menu($menu)
{ {
$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) {
common_menu_item(common_local_url($menuaction, common_menu_item(common_local_url($menuaction,
isset($menudesc[2]) ? $menudesc[2] : null), isset($menudesc[2]) ? $menudesc[2] : null),
@ -489,7 +489,7 @@ class Action extends HTMLOutputter // lawsuit
$menudesc[1], $menudesc[1],
$action == $menuaction); $action == $menuaction);
} }
common_element_end('ul'); $this->elementEnd('ul');
} }
function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null) function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null)
@ -499,7 +499,7 @@ class Action extends HTMLOutputter // lawsuit
common_start_html(); common_start_html();
common_element_start('head'); $this->elementStart('head');
if ($callable) { if ($callable) {
if ($data) { if ($data) {
@ -508,14 +508,13 @@ class Action extends HTMLOutputter // lawsuit
call_user_func($callable); call_user_func($callable);
} }
} }
common_element_end('head'); $this->elementEnd('head');
common_element_start('body', $action); $this->elementStart('body', $action);
common_element_start('div', array('id' => 'wrap')); $this->elementStart('div', array('id' => 'wrap'));
common_element_start('div', array('id' => 'header')); $this->elementStart('div', array('id' => 'header'));
common_nav_menu(); common_nav_menu();
$this->element('h1', 'pagetitle', $pagetitle);
common_element('h1', 'pagetitle', $pagetitle);
if ($headercall) { if ($headercall) {
if ($data) { if ($data) {
@ -524,18 +523,18 @@ class Action extends HTMLOutputter // lawsuit
call_user_func($headercall); call_user_func($headercall);
} }
} }
common_element_end('div'); $this->elementEnd('div');
common_element_start('div', array('id' => 'content')); $this->elementStart('div', array('id' => 'content'));
} }
function common_show_footer() function common_show_footer()
{ {
global $xw, $config; global $xw, $config;
common_element_end('div'); // content div $this->elementEnd('div'); // content div
common_foot_menu(); common_foot_menu();
common_element_end('div'); $this->elementEnd('div');
common_element_end('body'); $this->elementEnd('body');
common_element_end('html'); $this->elementEnd('html');
common_end_xml(); common_end_xml();
} }
@ -545,13 +544,13 @@ class Action extends HTMLOutputter // lawsuit
if ($is_selected) { if ($is_selected) {
$lattrs['class'] = 'current'; $lattrs['class'] = 'current';
} }
common_element_start('li', $lattrs); $this->elementStart('li', $lattrs);
$attrs['href'] = $url; $attrs['href'] = $url;
if ($title) { if ($title) {
$attrs['title'] = $title; $attrs['title'] = $title;
} }
common_element('a', $attrs, $text); $this->element('a', $attrs, $text);
common_element_end('li'); $this->elementEnd('li');
} }
// Does a little before-after block for next/prev page // Does a little before-after block for next/prev page