Subversion Repositories Applications.gtt

Rev

Rev 94 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 187
Line 2... Line 2...
2
/**
2
/**
3
 * package.xml parsing class, package.xml version 2.0
3
 * package.xml parsing class, package.xml version 2.0
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
-
 
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
7
 * @category   pear
14
 * @package    PEAR
8
 * @package    PEAR
15
 * @author     Greg Beaver <cellog@php.net>
9
 * @author     Greg Beaver <cellog@php.net>
16
 * @copyright  1997-2006 The PHP Group
10
 * @copyright  1997-2009 The Authors
17
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
11
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
18
 * @version    CVS: $Id: v2.php,v 1.19 2006/01/23 17:39:52 cellog Exp $
-
 
19
 * @link       http://pear.php.net/package/PEAR
12
 * @link       http://pear.php.net/package/PEAR
20
 * @since      File available since Release 1.4.0a1
13
 * @since      File available since Release 1.4.0a1
21
 */
14
 */
22
/**
15
/**
23
 * base xml parser class
16
 * base xml parser class
Line 27... Line 20...
27
/**
20
/**
28
 * Parser for package.xml version 2.0
21
 * Parser for package.xml version 2.0
29
 * @category   pear
22
 * @category   pear
30
 * @package    PEAR
23
 * @package    PEAR
31
 * @author     Greg Beaver <cellog@php.net>
24
 * @author     Greg Beaver <cellog@php.net>
32
 * @copyright  1997-2006 The PHP Group
25
 * @copyright  1997-2009 The Authors
33
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
26
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
34
 * @version    Release: @PEAR-VER@
27
 * @version    Release: @PEAR-VER@
35
 * @link       http://pear.php.net/package/PEAR
28
 * @link       http://pear.php.net/package/PEAR
36
 * @since      Class available since Release 1.4.0a1
29
 * @since      Class available since Release 1.4.0a1
37
 */
30
 */
38
class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser
31
class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser
Line 68... Line 61...
68
        $data = '';
61
        $data = '';
69
        // remove the same amount of whitespace from following lines
62
        // remove the same amount of whitespace from following lines
70
        foreach (explode("\n", $str) as $line) {
63
        foreach (explode("\n", $str) as $line) {
71
            if (substr($line, 0, $indent_len) == $indent) {
64
            if (substr($line, 0, $indent_len) == $indent) {
72
                $data .= substr($line, $indent_len) . "\n";
65
                $data .= substr($line, $indent_len) . "\n";
-
 
66
            } else {
-
 
67
                $data .= $line . "\n";
73
            }
68
            }
74
        }
69
        }
75
        return $data;
70
        return $data;
76
    }
71
    }
Line 95... Line 90...
95
     * @param string|false name of the archive this package.xml came from, if any
90
     * @param string|false name of the archive this package.xml came from, if any
96
     * @param string class name to instantiate and return.  This must be PEAR_PackageFile_v2 or
91
     * @param string class name to instantiate and return.  This must be PEAR_PackageFile_v2 or
97
     *               a subclass
92
     *               a subclass
98
     * @return PEAR_PackageFile_v2
93
     * @return PEAR_PackageFile_v2
99
     */
94
     */
100
    function &parse($data, $file, $archive = false, $class = 'PEAR_PackageFile_v2')
95
    function parse($data, $file = null, $archive = false, $class = 'PEAR_PackageFile_v2')
101
    {
96
    {
102
        if (PEAR::isError($err = parent::parse($data, $file))) {
97
        if (PEAR::isError($err = parent::parse($data))) {
103
            return $err;
98
            return $err;
104
        }
99
        }
-
 
100
 
105
        $ret = new $class;
101
        $ret = new $class;
-
 
102
        $ret->encoding = $this->encoding;
106
        $ret->setConfig($this->_config);
103
        $ret->setConfig($this->_config);
107
        if (isset($this->_logger)) {
104
        if (isset($this->_logger)) {
108
            $ret->setLogger($this->_logger);
105
            $ret->setLogger($this->_logger);
109
        }
106
        }
-
 
107
 
110
        $ret->fromArray($this->_unserializedData);
108
        $ret->fromArray($this->_unserializedData);
111
        $ret->setPackagefile($file, $archive);
109
        $ret->setPackagefile($file, $archive);
112
        return $ret;
110
        return $ret;
113
    }
111
    }
114
}
-
 
115
?>
-
 
116
112
}
-
 
113
117
114