5 class Xml extends \Rsi\Fred\Controller\View{
9 foreach($data as $key => $value)
10 if($array = !\
Rsi\Xml::validTag($key)){
11 $parent[
'type'] =
'array';
14 foreach($data as $key => $value){
15 $name = $array ?
'item' : $key;
17 $child = $parent->addChild($name ?:
'null');
18 if(!$name) $child[
'null'] =
'true';
23 if($value === null) $type = null;
24 elseif(is_bool($value)){
26 $value = \Rsi\Str::bool($value);
28 elseif(is_int($value)) $type =
'int';
29 elseif(is_float($value)) $type =
'float';
30 else $value = htmlspecialchars($value);
31 $child = $parent->addChild($name ?:
'null',$value);
32 if(!$name) $child[
'null'] =
'true';
33 if($type) $child[
'type'] = $type;
35 if($array) $child[
'key'] = $key;
40 if(!headers_sent()) header(
'Content-type: application/xml; charset=utf-8');
41 $this->
xmlEncode($root =
new \SimpleXmlElement(
'<config />'),$this->data);
42 print($root->asXML());
xmlEncode($parent, $data)