protected function xmlTree(array $tree) { $xml = '<dir readable="' . ($tree['readable'] ? "yes" : "no") . '" writable="' . ($tree['writable'] ? "yes" : "no") . '" removable="' . ($tree['removable'] ? "yes" : "no") . '" hasDirs="' . ($tree['hasDirs'] ? "yes" : "no") . '"' . (isset($tree['current']) ? ' current="yes"' : '') . '><name>' . text::xmlData($tree['name']) . '</name>'; if (isset($tree['dirs']) && is_array($tree['dirs']) && count($tree['dirs'])) { $xml .= "<dirs>"; foreach ($tree['dirs'] as $dir) { $xml .= $this->xmlTree($dir); } $xml .= "</dirs>"; } $xml .= '</dir>'; return $xml; }
<root> <?php foreach ($dirs as $dir) { ?> <dir readable="<?php echo $dir['readable'] ? "yes" : "no"; ?> " writable="<?php echo $dir['writable'] ? "yes" : "no"; ?> " removable="<?php echo $dir['removable'] ? "yes" : "no"; ?> " hasDirs="<?php echo $dir['hasDirs'] ? "yes" : "no"; ?> "> <name><?php echo text::xmlData($dir['name']); ?> </name> </dir> <?php } ?> </root>
<root> <?php if (is_array($message)) { ?> <?php foreach ($message as $msg) { ?> <error><?php echo text::xmlData($msg); ?> </error> <?php } ?> <?php } else { ?> <error><?php echo text::xmlData($message); ?> </error> <?php } ?> </root>
?> " readable="<?php echo $file['readable'] ? "yes" : "no"; ?> " writable="<?php echo $file['writable'] ? "yes" : "no"; ?> " bigIcon="<?php echo $file['bigIcon'] ? "yes" : "no"; ?> " smallIcon="<?php echo $file['smallIcon'] ? "yes" : "no"; ?> " thumb="<?php echo $file['thumb'] ? "yes" : "no"; ?> " smallThumb="<?php echo $file['smallThumb'] ? "yes" : "no"; ?> "> <name><?php echo text::xmlData($file['name']); ?> </name> </file> <?php } ?> </files> </root>
<root> <name><?php echo text::xmlData($name); ?> </name> </root>