summaryrefslogtreecommitdiff
path: root/webgli
diff options
context:
space:
mode:
authorAndrew Gaffney <agaffney@gentoo.org>2006-04-16 02:12:25 +0000
committerAndrew Gaffney <agaffney@gentoo.org>2006-04-16 02:12:25 +0000
commit097c90e57f694e28ea043bbc24793f4e1d2748ab (patch)
treeab5765b8598856c7aa751cd2d030d4cb88f19320 /webgli
parentdon't serialize etc-files if it's empty (diff)
downloadscire-097c90e57f694e28ea043bbc24793f4e1d2748ab.tar.gz
scire-097c90e57f694e28ea043bbc24793f4e1d2748ab.tar.bz2
scire-097c90e57f694e28ea043bbc24793f4e1d2748ab.zip
output self-closing tag is value is empty
svn path=/; revision=27
Diffstat (limited to 'webgli')
-rw-r--r--webgli/webgliIP.php33
1 files changed, 19 insertions, 14 deletions
diff --git a/webgli/webgliIP.php b/webgli/webgliIP.php
index 563e33d..3277c13 100644
--- a/webgli/webgliIP.php
+++ b/webgli/webgliIP.php
@@ -133,20 +133,25 @@ class InstallProfile extends XMLParser {
break;
}
}
- switch($value['type']) {
- case 'string':
- case 'uri':
- $this->xmldoc .= sprintf("\t<%s>\n\t\t%s\n\t</%s>\n", $xmlname, $this->get($name), $xmlname);
- break;
- case 'bool':
- $this->xmldoc .= sprintf("\t<%s>\n\t\t%s\n\t</%s>\n", $xmlname, $this->get($name) ? "True" : "False", $xmlname);
- break;
- case 'int':
- $this->xmldoc .= sprintf("\t<%s>\n\t\t%d\n\t</%s>\n", $xmlname, intval($this->get($name)), $xmlname);
- break;
- case 'array':
- $this->xmldoc .= sprintf("\t<%s>\n\t\t%s\n\t</%s>\n", $xmlname, implode(" ", $this->get($name)), $xmlname);
- break;
+ $value = $this->get($name);
+ if($value) {
+ switch($value['type']) {
+ case 'string':
+ case 'uri':
+ $this->xmldoc .= sprintf("\t<%s>\n\t\t%s\n\t</%s>\n", $xmlname, $value, $xmlname);
+ break;
+ case 'bool':
+ $this->xmldoc .= sprintf("\t<%s>\n\t\t%s\n\t</%s>\n", $xmlname, $value ? "True" : "False", $xmlname);
+ break;
+ case 'int':
+ $this->xmldoc .= sprintf("\t<%s>\n\t\t%d\n\t</%s>\n", $xmlname, intval($value), $xmlname);
+ break;
+ case 'array':
+ $this->xmldoc .= sprintf("\t<%s>\n\t\t%s\n\t</%s>\n", $xmlname, implode(" ", $value), $xmlname);
+ break;
+ }
+ } else {
+ $this->xmldoc .= sprintf("\t<%s />\n", $xmlname);
}
}
}