Редакция 69 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 69 | Редакция 87 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | /**
|
2 | /**
|
3 | * PEAR_ChannelFile_Parser for parsing channel.xml
|
3 | * PEAR_ChannelFile_Parser for parsing channel.xml
|
4 | *
|
4 | *
|
5 | * PHP versions 4 and 5
|
5 | * PHP versions 4 and 5
|
6 | *
|
6 | *
|
7 | * LICENSE: This source file is subject to version 3.0 of the PHP license
|
7 | * LICENSE: This source file is subject to version 3.0 of the PHP license
|
8 | * that is available through the world-wide-web at the following URI:
|
8 | * that is available through the world-wide-web at the following URI:
|
9 | * http://www.php.net/license/3_0.txt. If you did not receive a copy of
|
9 | * http://www.php.net/license/3_0.txt. If you did not receive a copy of
|
10 | * the PHP License and are unable to obtain it through the web, please
|
10 | * the PHP License and are unable to obtain it through the web, please
|
11 | * send a note to license@php.net so we can mail you a copy immediately.
|
11 | * send a note to license@php.net so we can mail you a copy immediately.
|
12 | *
|
12 | *
|
13 | * @category pear
|
13 | * @category pear
|
14 | * @package PEAR
|
14 | * @package PEAR
|
15 | * @author Greg Beaver <cellog@php.net>
|
15 | * @author Greg Beaver <cellog@php.net>
|
16 | * @copyright 1997-2008 The PHP Group
|
16 | * @copyright 1997-2008 The PHP Group
|
17 | * @license http://www.php.net/license/3_0.txt PHP License 3.0
|
17 | * @license http://www.php.net/license/3_0.txt PHP License 3.0
|
18 | * @version CVS: $Id: Parser.php,v 1.5 2008/01/03 20:26:36 cellog Exp $
|
18 | * @version CVS: $Id: Parser.php,v 1.5 2008/01/03 20:26:36 cellog Exp $
|
19 | * @link http://pear.php.net/package/PEAR
|
19 | * @link http://pear.php.net/package/PEAR
|
20 | * @since File available since Release 1.4.0a1
|
20 | * @since File available since Release 1.4.0a1
|
21 | */
|
21 | */
|
22 | 22 | ||
23 | /**
|
23 | /**
|
24 | * base xml parser class
|
24 | * base xml parser class
|
25 | */
|
25 | */
|
26 | require_once 'PEAR/XMLParser.php'; |
26 | require_once 'PEAR/XMLParser.php'; |
27 | require_once 'PEAR/ChannelFile.php'; |
27 | require_once 'PEAR/ChannelFile.php'; |
28 | /**
|
28 | /**
|
29 | * Parser for channel.xml
|
29 | * Parser for channel.xml
|
30 | * @category pear
|
30 | * @category pear
|
31 | * @package PEAR
|
31 | * @package PEAR
|
32 | * @author Greg Beaver <cellog@php.net>
|
32 | * @author Greg Beaver <cellog@php.net>
|
33 | * @copyright 1997-2008 The PHP Group
|
33 | * @copyright 1997-2008 The PHP Group
|
34 | * @license http://www.php.net/license/3_0.txt PHP License 3.0
|
34 | * @license http://www.php.net/license/3_0.txt PHP License 3.0
|
35 | * @version Release: 1.7.2
|
35 | * @version Release: 1.7.2
|
36 | * @link http://pear.php.net/package/PEAR
|
36 | * @link http://pear.php.net/package/PEAR
|
37 | * @since Class available since Release 1.4.0a1
|
37 | * @since Class available since Release 1.4.0a1
|
38 | */
|
38 | */
|
39 | class PEAR_ChannelFile_Parser extends PEAR_XMLParser |
39 | class PEAR_ChannelFile_Parser extends PEAR_XMLParser |
40 | {
|
40 | {
|
41 | var $_config; |
41 | var $_config; |
42 | var $_logger; |
42 | var $_logger; |
43 | var $_registry; |
43 | var $_registry; |
44 | 44 | ||
45 | function setConfig(&$c) |
45 | function setConfig(&$c) |
46 | {
|
46 | {
|
47 | $this->_config = &$c; |
47 | $this->_config = &$c; |
48 | $this->_registry = &$c->getRegistry(); |
48 | $this->_registry = &$c->getRegistry(); |
49 | }
|
49 | }
|
50 | 50 | ||
51 | function setLogger(&$l) |
51 | function setLogger(&$l) |
52 | {
|
52 | {
|
53 | $this->_logger = &$l; |
53 | $this->_logger = &$l; |
54 | }
|
54 | }
|
55 | 55 | ||
56 | function parse($data, $file) |
56 | function parse($data, $file) |
57 | {
|
57 | {
|
58 | if (PEAR::isError($err = parent::parse($data, $file))) { |
58 | if (PEAR::isError($err = parent::parse($data, $file))) { |
59 | return $err; |
59 | return $err; |
60 | }
|
60 | }
|
61 | $ret = new PEAR_ChannelFile; |
61 | $ret = new PEAR_ChannelFile; |
62 | $ret->setConfig($this->_config); |
62 | $ret->setConfig($this->_config); |
63 | if (isset($this->_logger)) { |
63 | if (isset($this->_logger)) { |
64 | $ret->setLogger($this->_logger); |
64 | $ret->setLogger($this->_logger); |
65 | }
|
65 | }
|
66 | $ret->fromArray($this->_unserializedData); |
66 | $ret->fromArray($this->_unserializedData); |
67 | // make sure the filelist is in the easy to read format needed
|
67 | // make sure the filelist is in the easy to read format needed
|
68 | $ret->flattenFilelist(); |
68 | $ret->flattenFilelist(); |
69 | $ret->setPackagefile($file, $archive); |
69 | $ret->setPackagefile($file, $archive); |
70 | return $ret; |
70 | return $ret; |
71 | }
|
71 | }
|
72 | }
|
72 | }
|
73 | ?>
|
73 | ?>
|