XpressEngine Core
1.11.2
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
classes
display
XMLDisplayHandler.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
4
class
XMLDisplayHandler
5
{
6
12
function
toDoc
(&$oModule)
13
{
14
$variables = $oModule->getVariables();
15
16
$xmlDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n"
;
17
$xmlDoc .= sprintf(
"<error>%s</error>\n"
, $oModule->getError());
18
$xmlDoc .= sprintf(
"<message>%s</message>\n"
, htmlspecialchars($oModule->getMessage(), ENT_COMPAT,
'UTF-8'
,
true
));
19
20
$xmlDoc .= $this->
_makeXmlDoc
($variables);
21
22
$xmlDoc .=
"</response>"
;
23
24
return
$xmlDoc;
25
}
26
32
function
_makeXmlDoc
(
$obj
)
33
{
34
if
(!count(
$obj
))
35
{
36
return
;
37
}
38
39
$xmlDoc =
''
;
40
41
foreach
(
$obj
as $key => $val)
42
{
43
if
(is_numeric($key))
44
{
45
$key =
'item'
;
46
}
47
48
if
(is_string($val))
49
{
50
$xmlDoc .= sprintf(
'<%s>%s</%s>%s'
, $key, htmlspecialchars($val, ENT_COMPAT,
'UTF-8'
,
true
), $key,
"\n"
);
51
}
52
else
if
(!is_array($val) && !is_object($val))
53
{
54
$xmlDoc .= sprintf(
'<%s>%s</%s>%s'
, $key, $val, $key,
"\n"
);
55
}
56
else
57
{
58
$xmlDoc .= sprintf(
'<%s>%s%s</%s>%s'
, $key,
"\n"
, $this->
_makeXmlDoc
($val), $key,
"\n"
);
59
}
60
}
61
62
return
$xmlDoc;
63
}
64
65
}
66
/* End of file XMLDisplayHandler.class.php */
67
/* Location: ./classes/display/XMLDisplayHandler.class.php */
XMLDisplayHandler\toDoc
toDoc(&$oModule)
Definition:
XMLDisplayHandler.php:12
$obj
$obj
Definition:
ko.install.php:262
XMLDisplayHandler
Definition:
XMLDisplayHandler.php:4
XMLDisplayHandler\_makeXmlDoc
_makeXmlDoc($obj)
Definition:
XMLDisplayHandler.php:32
Generated on Tue Dec 18 2018 17:04:25 for XpressEngine Core by
1.8.5