Remove XML-generating function from lib/util.php
This commit is contained in:
parent
2ff7bcfc5d
commit
81745625aa
71
lib/util.php
71
lib/util.php
|
@ -79,65 +79,6 @@ function common_user_error($msg, $code=400)
|
|||
common_show_footer();
|
||||
}
|
||||
|
||||
$xw = null;
|
||||
|
||||
// Start an HTML element
|
||||
function common_element_start($tag, $attrs=null)
|
||||
{
|
||||
global $xw;
|
||||
$xw->startElement($tag);
|
||||
if (is_array($attrs)) {
|
||||
foreach ($attrs as $name => $value) {
|
||||
$xw->writeAttribute($name, $value);
|
||||
}
|
||||
} else if (is_string($attrs)) {
|
||||
$xw->writeAttribute('class', $attrs);
|
||||
}
|
||||
}
|
||||
|
||||
function common_element_end($tag)
|
||||
{
|
||||
static $empty_tag = array('base', 'meta', 'link', 'hr',
|
||||
'br', 'param', 'img', 'area',
|
||||
'input', 'col');
|
||||
global $xw;
|
||||
// XXX: check namespace
|
||||
if (in_array($tag, $empty_tag)) {
|
||||
$xw->endElement();
|
||||
} else {
|
||||
$xw->fullEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
function common_element($tag, $attrs=null, $content=null)
|
||||
{
|
||||
common_element_start($tag, $attrs);
|
||||
global $xw;
|
||||
if (!is_null($content)) {
|
||||
$xw->text($content);
|
||||
}
|
||||
common_element_end($tag);
|
||||
}
|
||||
|
||||
function common_start_xml($doc=null, $public=null, $system=null, $indent=true)
|
||||
{
|
||||
global $xw;
|
||||
$xw = new XMLWriter();
|
||||
$xw->openURI('php://output');
|
||||
$xw->setIndent($indent);
|
||||
$xw->startDocument('1.0', 'UTF-8');
|
||||
if ($doc) {
|
||||
$xw->writeDTD($doc, $public, $system);
|
||||
}
|
||||
}
|
||||
|
||||
function common_end_xml()
|
||||
{
|
||||
global $xw;
|
||||
$xw->endDocument();
|
||||
$xw->flush();
|
||||
}
|
||||
|
||||
function common_init_locale($language=null)
|
||||
{
|
||||
if(!$language) {
|
||||
|
@ -319,18 +260,6 @@ function common_show_footer()
|
|||
common_end_xml();
|
||||
}
|
||||
|
||||
function common_text($txt)
|
||||
{
|
||||
global $xw;
|
||||
$xw->text($txt);
|
||||
}
|
||||
|
||||
function common_raw($xml)
|
||||
{
|
||||
global $xw;
|
||||
$xw->writeRaw($xml);
|
||||
}
|
||||
|
||||
function common_nav_menu()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
|
Loading…
Reference in New Issue
Block a user