Subversion Repositories Applications.gtt

Rev

Rev 94 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
94 jpm 1
<?php
2
/**
3
 * PEAR_ChannelFile_Parser for parsing channel.xml
4
 *
5
 * PHP versions 4 and 5
6
 *
7
 * @category   pear
8
 * @package    PEAR
9
 * @author     Greg Beaver <cellog@php.net>
187 mathias 10
 * @copyright  1997-2009 The Authors
11
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
94 jpm 12
 * @link       http://pear.php.net/package/PEAR
13
 * @since      File available since Release 1.4.0a1
14
 */
15
 
16
/**
17
 * base xml parser class
18
 */
19
require_once 'PEAR/XMLParser.php';
20
require_once 'PEAR/ChannelFile.php';
21
/**
22
 * Parser for channel.xml
23
 * @category   pear
24
 * @package    PEAR
25
 * @author     Greg Beaver <cellog@php.net>
187 mathias 26
 * @copyright  1997-2009 The Authors
27
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
28
 * @version    Release: 1.10.1
94 jpm 29
 * @link       http://pear.php.net/package/PEAR
30
 * @since      Class available since Release 1.4.0a1
31
 */
32
class PEAR_ChannelFile_Parser extends PEAR_XMLParser
33
{
34
    var $_config;
35
    var $_logger;
36
    var $_registry;
37
 
38
    function setConfig(&$c)
39
    {
40
        $this->_config = &$c;
41
        $this->_registry = &$c->getRegistry();
42
    }
43
 
44
    function setLogger(&$l)
45
    {
46
        $this->_logger = &$l;
47
    }
48
 
49
    function parse($data, $file)
50
    {
51
        if (PEAR::isError($err = parent::parse($data, $file))) {
52
            return $err;
53
        }
187 mathias 54
 
94 jpm 55
        $ret = new PEAR_ChannelFile;
56
        $ret->setConfig($this->_config);
57
        if (isset($this->_logger)) {
58
            $ret->setLogger($this->_logger);
59
        }
187 mathias 60
 
94 jpm 61
        $ret->fromArray($this->_unserializedData);
62
        // make sure the filelist is in the easy to read format needed
63
        $ret->flattenFilelist();
64
        $ret->setPackagefile($file, $archive);
65
        return $ret;
66
    }
187 mathias 67
}