require_once "PEAR.php";
-class PEAR_Common
+class PEAR_Common extends PEAR
{
// {{{ properties
}
// }}}
+ // {{{ _element_start()
function _element_start($xp, $name, $attribs)
{
$this->current_attributes = $attribs;
}
+ // }}}
+ // {{{ _element_end()
function _element_end($xp, $name)
{
$this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
}
+ // }}}
+ // {{{ _pkginfo_cdata()
function _pkginfo_cdata($xp, $data)
{
case "Name":
switch ($next) {
case "Package":
- $this->pkginfo["package"] = trim($data);
+ $this->pkginfo["package"] .= $data;
break;
case "Maintainer":
- $this->pkginfo["maintainer_name"] = trim($data);
+ $this->pkginfo["maintainer_name"] .= $data;
break;
}
break;
case "Summary":
- $this->pkginfo["summary"] = trim($data);
+ $this->pkginfo["summary"] .= $data;
break;
case "Initials":
- $this->pkginfo["maintainer_handle"] = trim($data);
+ $this->pkginfo["maintainer_handle"] .= $data;
break;
case "Email":
- $this->pkginfo["maintainer_email"] = trim($data);
+ $this->pkginfo["maintainer_email"] .= $data;
break;
case "Version":
- $this->pkginfo["version"] = trim($data);
+ $this->pkginfo["version"] .= $data;
break;
case "Date":
- $this->pkginfo["release_date"] = trim($data);
+ $this->pkginfo["release_date"] .= $data;
break;
case "Notes":
- $this->pkginfo["release_notes"] = trim($data);
+ $this->pkginfo["release_notes"] .= $data;
break;
case "Dir":
if (!$this->phpdir) {
}
}
+ // }}}
+ // {{{ infoFromDescriptionFile()
- function infoFromDescriptionFile($file)
+ function infoFromDescriptionFile($descfile)
{
$fp = fopen($descfile, "r");
- $xp = xml_parser_create();
+ $xp = @xml_parser_create();
if (!$xp) {
return $this->raiseError("Unable to create XML parser.");
}
// read the whole thing so we only get one cdata callback
// for each block of cdata
$data = fread($fp, filesize($descfile));
- if (!xml_parse($xp, $data, 1)) {
+ if (!@xml_parse($xp, $data, 1)) {
$msg = sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xp)),
xml_get_current_line_number($xp));
xml_parser_free($xp);
+ foreach ($this->pkginfo as $k => $v) {
+ $this->pkginfo[$k] = trim($v);
+ }
+
return $this->pkginfo;
}
+
+ // }}}
}
?>