home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / tmp / PEAR-1.7.1 / PEAR / ChannelFile / Parser.php
Encoding:
PHP Script  |  2008-02-15  |  2.1 KB  |  73 lines

  1. <?php
  2. /**
  3.  * PEAR_ChannelFile_Parser for parsing channel.xml
  4.  *
  5.  * PHP versions 4 and 5
  6.  *
  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:
  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
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @category   pear
  14.  * @package    PEAR
  15.  * @author     Greg Beaver <cellog@php.net>
  16.  * @copyright  1997-2008 The PHP Group
  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 $
  19.  * @link       http://pear.php.net/package/PEAR
  20.  * @since      File available since Release 1.4.0a1
  21.  */
  22.  
  23. /**
  24.  * base xml parser class
  25.  */
  26. require_once 'PEAR/XMLParser.php';
  27. require_once 'PEAR/ChannelFile.php';
  28. /**
  29.  * Parser for channel.xml
  30.  * @category   pear
  31.  * @package    PEAR
  32.  * @author     Greg Beaver <cellog@php.net>
  33.  * @copyright  1997-2008 The PHP Group
  34.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  35.  * @version    Release: 1.7.1
  36.  * @link       http://pear.php.net/package/PEAR
  37.  * @since      Class available since Release 1.4.0a1
  38.  */
  39. class PEAR_ChannelFile_Parser extends PEAR_XMLParser
  40. {
  41.     var $_config;
  42.     var $_logger;
  43.     var $_registry;
  44.  
  45.     function setConfig(&$c)
  46.     {
  47.         $this->_config = &$c;
  48.         $this->_registry = &$c->getRegistry();
  49.     }
  50.  
  51.     function setLogger(&$l)
  52.     {
  53.         $this->_logger = &$l;
  54.     }
  55.  
  56.     function parse($data, $file)
  57.     {
  58.         if (PEAR::isError($err = parent::parse($data, $file))) {
  59.             return $err;
  60.         }
  61.         $ret = new PEAR_ChannelFile;
  62.         $ret->setConfig($this->_config);
  63.         if (isset($this->_logger)) {
  64.             $ret->setLogger($this->_logger);
  65.         }
  66.         $ret->fromArray($this->_unserializedData);
  67.         // make sure the filelist is in the easy to read format needed
  68.         $ret->flattenFilelist();
  69.         $ret->setPackagefile($file, $archive);
  70.         return $ret;
  71.     }
  72. }
  73. ?>