// {{{ destructor
function _PEAR_Packager() {
- $this->_PEAR();
+ $this->_PEAR();
while (is_array($this->_tempfiles) &&
$file = array_shift($this->_tempfiles))
{
return $this->raiseError($php_errormsg);
}
- $xp = xml_parser_create();
- if (!$xp) {
- return $this->raiseError("Unable to create XML parser.");
- }
- xml_set_object($xp, $this);
- xml_set_element_handler($xp, "startHandler", "endHandler");
- xml_set_character_data_handler($xp, "charHandler");
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
- xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING, "UTF-8");
-
- $this->element_stack = array();
- $this->pkginfo = array();
- $this->current_element = false;
+ $xp = xml_parser_create();
+ if (!$xp) {
+ return $this->raiseError("Unable to create XML parser.");
+ }
+ xml_set_object($xp, $this);
+ xml_set_element_handler($xp, "startHandler", "endHandler");
+ xml_set_character_data_handler($xp, "charHandler");
+ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
+ xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING, "UTF-8");
+
+ $this->element_stack = array();
+ $this->pkginfo = array();
+ $this->current_element = false;
$data = fread($fp, filesize($pkgfile));
fclose($fp);
xml_get_current_line_number($xp));
xml_parser_free($xp);
return $this->raiseError($msg);
- }
- xml_parser_free($xp);
+ }
+ xml_parser_free($xp);
$pkginfofile = $this->tmpdir . DIRECTORY_SEPARATOR . "package.xml";
$fp = fopen($pkginfofile, "w");
function startHandler($xp, $name, $attribs)
{
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $this->current_attributes = $attribs;
+ array_push($this->element_stack, $name);
+ $this->current_element = $name;
+ $this->current_attributes = $attribs;
$this->tmpdata = '';
if ($this->recordfilelist) {
$this->filelist .= "<$name";
}
$this->filelist .= ">";
}
- switch ($name) {
- case "Package":
+ switch ($name) {
+ case "Package":
if ($attribs["Type"]) {
// warning
}
- break;
+ break;
case "FileList":
// XXX FIXME Windows
$this->recordfilelist = true;
}
$this->_tempfiles[] = $this->tmpdir;
break;
- }
+ }
}
// }}}
function endHandler($xp, $name)
{
- array_pop($this->element_stack);
- $this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
+ array_pop($this->element_stack);
+ $this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
switch ($name) {
case "FileList":
$this->recordfilelist = false;
if ($this->recordfilelist) {
$this->filelist .= $data;
}
- switch ($this->current_element) {
- case "Dir":
- break;
- case "File":
+ switch ($this->current_element) {
+ case "Dir":
+ break;
+ case "File":
$file = "$this->tmpdir/$data";
$dir = dirname($file);
if (!is_dir($dir)) {
$this->pkginfo[$id] = $data;
}
break;
- }
+ }
}
// }}}