* @since 1.2.0
* @copyright 2003
* @package PEAR_PackageFileManager
*/
class PEAR_PackageFileManager_XMLOutput extends PEAR_Common {
/**
* Generate part of an XML description with release information.
*
* @param array $pkginfo array with release information
* @param bool $changelog whether the result will be in a changelog element
*
* @return string XML data
*
* @access private
*/
function _makeReleaseXml($pkginfo, $changelog = false)
{
$indent = $changelog ? " " : "";
$ret = "$indent \n";
if (!empty($pkginfo['version'])) {
$ret .= "$indent $pkginfo[version]\n";
}
if (!empty($pkginfo['release_date'])) {
$ret .= "$indent $pkginfo[release_date]\n";
}
if (!empty($pkginfo['release_license'])) {
$ret .= "$indent $pkginfo[release_license]\n";
}
if (!empty($pkginfo['release_state'])) {
$ret .= "$indent $pkginfo[release_state]\n";
}
if (!empty($pkginfo['release_notes'])) {
$ret .= "$indent ".htmlspecialchars($pkginfo['release_notes'])."\n";
}
if (!empty($pkginfo['release_warnings'])) {
$ret .= "$indent ".htmlspecialchars($pkginfo['release_warnings'])."\n";
}
if (isset($pkginfo['release_deps']) && sizeof($pkginfo['release_deps']) > 0) {
$ret .= "$indent \n";
foreach ($pkginfo['release_deps'] as $dep) {
$ret .= "$indent $what) {
$ret .= "$indent _doFileList($indent, $pkginfo['filelist'], '/');
$ret .= "$indent \n";
}
$ret .= "$indent \n";
return $ret;
}
/**
* Generate the tag
* @access private
* @return string
*/
function _doFileList($indent, $filelist, $curdir)
{
$ret = '';
foreach ($filelist as $file => $fa) {
if (isset($fa['##files'])) {
$ret .= "$indent _doFileList("$indent ", $fa['##files'], $recurdir . $file . '/');
$displaydir = $curdir;
if ($displaydir == '///' || $displaydir == '/') {
$displaydir = '';
}
$ret .= "$indent \n";
} else {
if (empty($fa['replacements'])) {
$ret .= "/>\n";
} else {
$ret .= ">\n";
foreach ($fa['replacements'] as $r) {
$ret .= "$indent $v) {
$ret .= " $k=\"" . htmlspecialchars($v) .'"';
}
$ret .= "/>\n";
}
$ret .= "$indent \n";
}
}
}
return $ret;
}
}
?>