From ff3ee75d91a6b8794d75e9aef6179d895cc2ca3e Mon Sep 17 00:00:00 2001 From: Ferenc Kovacs Date: Tue, 16 Jun 2015 17:59:27 +0200 Subject: add a freshly built pear/install-pear-nozlib.phar. created from the current stable branch of pear-core and using the trunk from PHP_Archive where the ereg_ calls are removed already --- pear/install-pear-nozlib.phar | 8328 ++++++++++++++--------------------------- 1 file changed, 2846 insertions(+), 5482 deletions(-) (limited to 'pear') diff --git a/pear/install-pear-nozlib.phar b/pear/install-pear-nozlib.phar index f018d863ed..2f77855924 100644 --- a/pear/install-pear-nozlib.phar +++ b/pear/install-pear-nozlib.phar @@ -23,11 +23,11 @@ if (!class_exists('PHP_Archive')) {/** * @author Davey Shafik * @author Greg Beaver * @link http://www.synapticmedia.net Synaptic Media - * @version Id: Archive.php,v 1.52 2007/09/01 20:28:14 cellog Exp $ + * @version Id$ * @package PHP_Archive * @category PHP */ - + class PHP_Archive { const GZ = 0x00001000; @@ -35,6 +35,9 @@ class PHP_Archive const SIG = 0x00010000; const SHA1 = 0x0002; const MD5 = 0x0001; + const SHA256 = 0x0003; + const SHA512 = 0x0004; + const OPENSSL = 0x0010; /** * Whether this archive is compressed with zlib * @@ -55,6 +58,11 @@ class PHP_Archive * @var string */ protected $internalFileLength = null; + /** + * true if the current file is an empty directory + * @var string + */ + protected $isDir = false; /** * Current file statistics (size, creation date, etc.) * @var string @@ -78,7 +86,7 @@ class PHP_Archive * require_once 'phar://PEAR.phar/PEAR/Installer.php'; * * then the alias is "PEAR.phar" - * + * * Information stored is a boolean indicating whether this .phar is compressed * with zlib, another for bzip2, phar-specific meta-data, and * the precise offset of internal files @@ -94,9 +102,9 @@ class PHP_Archive private static $_pharFiles = array(); /** * File listing for the .phar - * + * * The manifest is indexed per phar. - * + * * Files within the .phar are indexed by their relative path within the * .phar. Each file has this information in its internal array * @@ -209,7 +217,7 @@ class PHP_Archive header("HTTP/1.0 404 Not Found"); return false; } - + } public static function introspect($archive, $dir) @@ -382,7 +390,7 @@ class PHP_Archive * Any attempt to call from outside the .phar or to re-alias the .phar will fail * as a security measure. * @param string $alias - * @param int $dataoffset the value of 42421 + * @param int $dataoffset the value of 43613 */ public static final function mapPhar($alias = NULL, $dataoffset = NULL) { @@ -439,7 +447,7 @@ class PHP_Archive $manifest .= $last; } if (strlen($manifest) < $manifest_length['len']) { - throw new Exception('ERROR: manifest length read was "' . + throw new Exception('ERROR: manifest length read was "' . strlen($manifest) .'" should be "' . $manifest_length['len'] . '"'); } @@ -563,7 +571,7 @@ class PHP_Archive return ''; } $std = str_replace("\\", "/", $path); - while ($std != ($std = ereg_replace("[^\/:?]+/\.\./", "", $std))) ; + while ($std != ($std = preg_replace("/[^\/:?]+\/\.\.\//", "", $std))) ; $std = str_replace("/./", "", $std); if (strlen($std) > 1 && $std[0] == '/') { $std = substr($std, 1); @@ -583,7 +591,15 @@ class PHP_Archive { $std = self::processFile($path); if (isset(self::$_manifest[$this->_archiveName][$path])) { - $this->_setCurrentFile($path); + if ($path[strlen($path)-1] == '/') { + // directory + if (!$allowdirs) { + return 'Error: "' . $path . '" is a directory in phar "' . $this->_basename . '"'; + } + $this->_setCurrentFile($path, true); + } else { + $this->_setCurrentFile($path); + } return true; } if (!$allowdirs) { @@ -600,17 +616,30 @@ class PHP_Archive return 'Error: "' . $path . '" not found in phar "' . $this->_basename . '"'; } - private function _setCurrentFile($path) + private function _setCurrentFile($path, $dir = false) { - $this->currentStat = array( - 2 => 0100444, // file mode, readable by all, writeable by none - 4 => 0, // uid - 5 => 0, // gid - 7 => self::$_manifest[$this->_archiveName][$path][0], // size - 9 => self::$_manifest[$this->_archiveName][$path][1], // creation time - ); + if ($dir) { + $this->currentStat = array( + 2 => 040777, // directory mode, readable by all, writeable by none + 4 => 0, // uid + 5 => 0, // gid + 7 => 0, // size + 9 => self::$_manifest[$this->_archiveName][$path][1], // creation time + ); + $this->internalFileLength = 0; + $this->isDir = true; + } else { + $this->currentStat = array( + 2 => 0100444, // file mode, readable by all, writeable by none + 4 => 0, // uid + 5 => 0, // gid + 7 => self::$_manifest[$this->_archiveName][$path][0], // size + 9 => self::$_manifest[$this->_archiveName][$path][1], // creation time + ); + $this->internalFileLength = self::$_manifest[$this->_archiveName][$path][2]; + $this->isDir = false; + } $this->currentFilename = $path; - $this->internalFileLength = self::$_manifest[$this->_archiveName][$path][2]; // seek to offset of file header within the .phar if (is_resource(@$this->fp)) { fseek($this->fp, self::$_fileStart[$this->_archiveName] + self::$_manifest[$this->_archiveName][$path][7]); @@ -687,7 +716,7 @@ class PHP_Archive return false; } $file = substr($file, 7); - + $ret = array('scheme' => 'phar'); $pos_p = strpos($file, '.phar.php'); $pos_z = strpos($file, '.phar.gz'); @@ -715,7 +744,7 @@ class PHP_Archive } return $ret; } - + /** * Locate the .phar archive in the include_path and detect the file to open within * the archive. @@ -811,7 +840,7 @@ class PHP_Archive return false; } } - + /** * Read the data - PHP streams API * @@ -824,7 +853,7 @@ class PHP_Archive $this->position += strlen($ret); return $ret; } - + /** * Whether we've hit the end of the file - PHP streams API * @access private @@ -833,7 +862,7 @@ class PHP_Archive { return $this->position >= $this->currentStat[7]; } - + /** * For seeking the stream - PHP streams API * @param int @@ -866,7 +895,7 @@ class PHP_Archive } return true; } - + /** * The current position in the stream - PHP streams API * @access private @@ -992,6 +1021,9 @@ class PHP_Archive } } elseif (strpos($file, $path) === 0) { $fname = substr($file, strlen($path) + 1); + if ($fname == '/' || $fname[strlen($fname)-1] == '/') { + continue; // empty directory + } if (strpos($fname, '/')) { // this is a directory $a = explode('/', $fname); @@ -1102,18 +1134,21 @@ class PHP_Archive /** * @return list of supported signature algorithmns. */ - public static function getsupportedsignatures() + public static function getSupportedSignatures() { $ret = array('MD5', 'SHA-1'); if (extension_loaded('hash')) { $ret[] = 'SHA-256'; $ret[] = 'SHA-512'; } + if (extension_loaded('openssl')) { + $ret[] = 'OpenSSL'; + } return $ret; } }} if (!class_exists('Phar')) { - PHP_Archive::mapPhar(null, 42421 ); + PHP_Archive::mapPhar(null, 43613 ); } else { try { Phar::mapPhar(); @@ -1234,9 +1269,10 @@ if (extension_loaded('phar')) {if (isset($_SERVER) && isset($_SERVER['REQUEST_UR require_once 'phar://install-pear-nozlib.phar/index.php'; -__HALT_COMPILER();Finstall-pear-nozlib.pharArchive/Tar.php>VT>ugmArchive_Tar-1.3.13.tarVT~mConsole/Getopt.php4VT4l1mConsole_Getopt-1.3.1.tarTVTTΞm index.php&VT&R8am OS/Guess.php)VT)]mPEAR-1.9.5.tarVTnb6dmPEAR.phpVT2mPEAR/ChannelFile.phpVTFiYmPEAR/ChannelFile/Parser.php VT &K}8mPEAR/Command.php1VT1KjtmPEAR/Command/Common.phpZ VTZ k˾7mPEAR/Command/Install.phpVTVT>b7m!PEAR/PackageFile/Generator/v1.phpJVTJ9R]m!PEAR/PackageFile/Generator/v2.php4VT4@;mPEAR/PackageFile/Parser/v1.php@VT@amPEAR/PackageFile/Parser/v2.php VT ɥsmPEAR/PackageFile/v1.php1VT1dgmPEAR/PackageFile/v2.php>VT> m!PEAR/PackageFile/v2/Validator.phpPVTPRrmPEAR/Registry.php)VT)Um PEAR/REST.phpEVTE0A!mPEAR/REST/10.phpVT>oNmPEAR/Start.php:9VT:90o?mPEAR/Start/CLI.phpUSVTUSoFfmPEAR/Task/Common.phpVT65mPEAR/Task/Postinstallscript.phpb8VTb8}Qm"PEAR/Task/Postinstallscript/rw.phpVT@ʵmPEAR/Task/Replace.phpVT3mPEAR/Task/Replace/rw.phpGVTGz80mPEAR/Task/Unixeol.phpVT]mPEAR/Task/Unixeol/rw.phpWVTW&mPEAR/Task/Windowseol.phpVTTmPEAR/Task/Windowseol/rw.phplVTlJLmPEAR/Validate.phpFVVTFV0mPEAR/Validator/PECL.phpuVTufmPEAR/XMLParser.phpVT -0/m PEAR5.php?VT?xmStructures/Graph.phpVTr *m,Structures/Graph/Manipulator/AcyclicTest.phpVT1sm2Structures/Graph/Manipulator/TopologicalSorter.phpVTEmStructures/Graph/Node.phpr+VTr+D_mStructures_Graph-1.0.4.tar,VT,fm -System.phpQVTQ m XML/Util.phpvVTvfmXML_Util-1.2.3.tarVTO}!mmPEAR/Installer/Role/Data.php FU dfAmPEAR/Installer/Role/Data.xmlFUfszmPEAR/Installer/Role/Doc.php FU [=mPEAR/Installer/Role/Doc.xmlFUh&P*mPEAR/Installer/Role/Php.php FU kmPEAR/Installer/Role/Php.xmlFUzqmPEAR/Installer/Role/Script.phpFUXɾmPEAR/Installer/Role/Script.xmlFU@vmPEAR/Installer/Role/Test.php FU amPEAR/Installer/Role/Test.xmlFUB] mPEAR/PackageFile.php>FU> m!PEAR/PackageFile/Generator/v1.phpFU 7m!PEAR/PackageFile/Generator/v2.php2FU2mPEAR/PackageFile/Parser/v1.php@FU@mPEAR/PackageFile/Parser/v2.php FU !mPEAR/PackageFile/v1.php$FU$/}mPEAR/PackageFile/v2.phpFU+Gm!PEAR/PackageFile/v2/Validator.phpvLFUvL@bmPEAR/Registry.php)FU)9^m PEAR/REST.phpDFUD\YmPEAR/REST/10.phpFUmPEAR/Start.phpB9FUB9mPEAR/Start/CLI.phpRSFURSoXmPEAR/Task/Common.phptFUt_smPEAR/Task/Postinstallscript.phpn9FUn9EWm"PEAR/Task/Postinstallscript/rw.phpDFUDՕQmPEAR/Task/Replace.phpFUSmPEAR/Task/Replace/rw.php:FU:+mPEAR/Task/Unixeol.php FU K5mPEAR/Task/Unixeol/rw.php?FU?+mPEAR/Task/Windowseol.phpFU\mPEAR/Task/Windowseol/rw.phpLFUL,mPEAR/Validate.php-VFU-VqkmPEAR/Validator/PECL.php\FU\\)mPEAR/XMLParser.phpGFUGhmStructures/Graph.phpiFUiC}m,Structures/Graph/Manipulator/AcyclicTest.phpFU1m2Structures/Graph/Manipulator/TopologicalSorter.phpFUv?mStructures/Graph/Node.phpt+FUt+_Q[mStructures_Graph-1.1.0.tar6FU6em_error('Unknow attribute code ' . $v_att_list[$i] . ''); + $this->_error('Unknown attribute code ' . $v_att_list[$i] . ''); return false; } @@ -2956,7 +2992,7 @@ class Archive_Tar extends PEAR } // ----- Extract the properties - $v_header['filename'] = $v_data['filename']; + $v_header['filename'] = rtrim($v_data['filename'], "\0"); if ($this->_maliciousFilename($v_header['filename'])) { $this->_error( 'Malicious .tar detected, file "' . $v_header['filename'] . @@ -3014,6 +3050,7 @@ class Archive_Tar extends PEAR function _readLongHeader(&$v_header) { $v_filename = ''; + $v_filesize = $v_header['size']; $n = floor($v_header['size'] / 512); for ($i = 0; $i < $n; $i++) { $v_content = $this->_readBlock(); @@ -3021,7 +3058,7 @@ class Archive_Tar extends PEAR } if (($v_header['size'] % 512) != 0) { $v_content = $this->_readBlock(); - $v_filename .= trim($v_content); + $v_filename .= $v_content; } // ----- Read the next header @@ -3031,7 +3068,7 @@ class Archive_Tar extends PEAR return false; } - $v_filename = trim($v_filename); + $v_filename = rtrim(substr($v_filename, 0, $v_filesize), "\0"); $v_header['filename'] = $v_filename; if ($this->_maliciousFilename($v_filename)) { $this->_error( @@ -3658,7 +3695,7 @@ class Archive_Tar extends PEAR } ?> -package.xml0000664000175000017500000002745612401271254013017 0ustar michielmichiel +package.xml0000664000175000017500000003170612513203354013010 0ustar michielmichiel Archive_Tar pear.php.net @@ -3691,24 +3728,23 @@ loaded. Bz2 compression is also supported with the bz2 extension loaded.stig@php.net no - 2014-09-02 - + 2015-04-14 + - 1.3.13 + 1.3.16 1.3.1 stable stable - New BSD - License + New BSD License -* Fix Bug #20382: gzopen fix [mrook] +* Fix Bug #20514: invalid package.xml; not installable with pyrus [mrook] - + @@ -3730,6 +3766,52 @@ loaded. Bz2 compression is also supported with the bz2 extension loaded. + + + 1.3.15 + 1.3.1 + + + stable + stable + + 2015-03-05 + New BSD License + +* Fixes composer.json parse error + + + + + 1.3.14 + 1.3.1 + + + stable + stable + + 2015-02-26 + New BSD License + +* Fix Bug #18505: Possible incorrect handling of file names in TAR [mrook] + + + + + 1.3.13 + 1.3.1 + + + stable + stable + + 2014-09-02 + New BSD + License + +* Fix Bug #20382: gzopen fix [mrook] + + 1.3.12 @@ -4088,7 +4170,7 @@ Windows bugfix: used wrong directory separators -Archive_Tar-1.3.13/Archive/Tar.php0000664000175000017500000023722512401271254016427 0ustar michielmichiel_error('Unknow attribute code ' . $v_att_list[$i] . ''); + $this->_error('Unknown attribute code ' . $v_att_list[$i] . ''); return false; } @@ -5808,7 +5890,7 @@ class Archive_Tar extends PEAR } // ----- Extract the properties - $v_header['filename'] = $v_data['filename']; + $v_header['filename'] = rtrim($v_data['filename'], "\0"); if ($this->_maliciousFilename($v_header['filename'])) { $this->_error( 'Malicious .tar detected, file "' . $v_header['filename'] . @@ -5866,6 +5948,7 @@ class Archive_Tar extends PEAR function _readLongHeader(&$v_header) { $v_filename = ''; + $v_filesize = $v_header['size']; $n = floor($v_header['size'] / 512); for ($i = 0; $i < $n; $i++) { $v_content = $this->_readBlock(); @@ -5873,7 +5956,7 @@ class Archive_Tar extends PEAR } if (($v_header['size'] % 512) != 0) { $v_content = $this->_readBlock(); - $v_filename .= trim($v_content); + $v_filename .= $v_content; } // ----- Read the next header @@ -5883,7 +5966,7 @@ class Archive_Tar extends PEAR return false; } - $v_filename = trim($v_filename); + $v_filename = rtrim(substr($v_filename, 0, $v_filesize), "\0"); $v_header['filename'] = $v_filename; if ($this->_maliciousFilename($v_filename)) { $this->_error( @@ -6510,7 +6593,7 @@ class Archive_Tar extends PEAR } ?> -Archive_Tar-1.3.13/docs/Archive_Tar.txt0000664000175000017500000004524612401271254017467 0ustar michielmichielDocumentation for class Archive_Tar +Archive_Tar-1.3.16/docs/Archive_Tar.txt0000664000175000017500000004524612513203354017472 0ustar michielmichielDocumentation for class Archive_Tar =================================== Last update : 2001-08-15 @@ -7004,7 +7087,7 @@ How it works : * @package Console_Getopt * @author Andrei Zmievski * @license http://www.php.net/license/3_0.txt PHP 3.0 - * @version CVS: $Id: Getopt.php 306067 2010-12-08 00:13:31Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/Console_Getopt */ @@ -7055,9 +7138,8 @@ class Console_Getopt * * @return array two-element array containing the list of parsed options and * the non-option arguments - * @access public */ - function getopt2($args, $short_options, $long_options = null, $skip_unknown = false) + public static function getopt2($args, $short_options, $long_options = null, $skip_unknown = false) { return Console_Getopt::doGetopt(2, $args, $short_options, $long_options, $skip_unknown); } @@ -7074,7 +7156,7 @@ class Console_Getopt * @return array two-element array containing the list of parsed options and * the non-option arguments */ - function getopt($args, $short_options, $long_options = null, $skip_unknown = false) + public static function getopt($args, $short_options, $long_options = null, $skip_unknown = false) { return Console_Getopt::doGetopt(1, $args, $short_options, $long_options, $skip_unknown); } @@ -7090,7 +7172,7 @@ class Console_Getopt * * @return array */ - function doGetopt($version, $args, $short_options, $long_options = null, $skip_unknown = false) + public static function doGetopt($version, $args, $short_options, $long_options = null, $skip_unknown = false) { // in case you pass directly readPHPArgv() as the first arg if (PEAR::isError($args)) { @@ -7169,10 +7251,9 @@ class Console_Getopt * @param string[] &$args * @param boolean $skip_unknown suppresses Console_Getopt: unrecognized option * - * @access private * @return void */ - function _parseShortOption($arg, $short_options, &$opts, &$args, $skip_unknown) + protected static function _parseShortOption($arg, $short_options, &$opts, &$args, $skip_unknown) { for ($i = 0; $i < strlen($arg); $i++) { $opt = $arg{$i}; @@ -7207,11 +7288,11 @@ class Console_Getopt if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) { $msg = "option requires an argument --$opt"; - return PEAR::raiseError("Console_Getopt:" . $msg); + return PEAR::raiseError("Console_Getopt: " . $msg); } } else { $msg = "option requires an argument --$opt"; - return PEAR::raiseError("Console_Getopt:" . $msg); + return PEAR::raiseError("Console_Getopt: " . $msg); } } } @@ -7225,10 +7306,9 @@ class Console_Getopt * * @param string $arg Argument to check * - * @access private * @return bool */ - function _isShortOpt($arg) + protected static function _isShortOpt($arg) { return strlen($arg) == 2 && $arg[0] == '-' && preg_match('/[a-zA-Z]/', $arg[1]); @@ -7239,10 +7319,9 @@ class Console_Getopt * * @param string $arg Argument to check * - * @access private * @return bool */ - function _isLongOpt($arg) + protected static function _isLongOpt($arg) { return strlen($arg) > 2 && $arg[0] == '-' && $arg[1] == '-' && preg_match('/[a-zA-Z]+$/', substr($arg, 2)); @@ -7256,10 +7335,9 @@ class Console_Getopt * @param string[][] &$opts * @param string[] &$args * - * @access private * @return void|PEAR_Error */ - function _parseLongOption($arg, $long_options, &$opts, &$args, $skip_unknown) + protected static function _parseLongOption($arg, $long_options, &$opts, &$args, $skip_unknown) { @list($opt, $opt_arg) = explode('=', $arg, 2); @@ -7331,10 +7409,9 @@ class Console_Getopt * Safely read the $argv PHP array across different PHP configurations. * Will take care on register_globals and register_argc_argv ini directives * - * @access public * @return mixed the $argv PHP array or PEAR error if not registered */ - function readPHPArgv() + public static function readPHPArgv() { global $argv; if (!is_array($argv)) { @@ -7350,8 +7427,8 @@ class Console_Getopt return $argv; } -}package.xml0000644000076500000240000001212011535261415012145 0ustar helgistaff - +}package.xml0000644000175000001440000001371412472354335012562 0ustar cweiskeusers + Console_Getopt pear.php.net Command-line option parser @@ -7361,7 +7438,7 @@ short and long options. Andrei Zmievski andrei andrei@php.net - yes + no Stig Bakken @@ -7375,35 +7452,37 @@ short and long options. cellog@php.net yes - 2011-03-07 - + 2015-02-22 + - 1.3.1 - 1.3.0 + 1.4.0 + 1.4.0 stable stable - PHP License + BSD-2-Clause -* Change the minimum PEAR installer dep to be lower +* Change license to BSD-2-Clause +* Set minimum PHP version to 5.4.0 +* Mark static methods with "static" keyword - + PEAR pear.php.net 1.4.0 - 1.10.0 + 1.999.999 - 4.3.0 + 5.4.0 1.8.0 @@ -7412,6 +7491,38 @@ short and long options. + + 2015-02-22 + + 1.3.1 + 1.3.0 + + + stable + stable + + BSD-2-Clause + +* Change license to BSD-2-Clause +* Set minimum PHP version to 5.4.0 +* Mark static methods with "static" keyword + + + + 2011-03-07 + + 1.3.1 + 1.3.0 + + + stable + stable + + PHP License + +* Change the minimum PEAR installer dep to be lower + + 2010-12-11 @@ -7552,7 +7663,7 @@ Initial release -Console_Getopt-1.3.1/Console/Getopt.php0000644000076500000240000003223511535261415017000 0ustar helgistaff * @license http://www.php.net/license/3_0.txt PHP 3.0 - * @version CVS: $Id: Getopt.php 306067 2010-12-08 00:13:31Z dufuz $ + * @version CVS: $Id$ * @link http://pear.php.net/package/Console_Getopt */ @@ -7622,9 +7733,8 @@ class Console_Getopt * * @return array two-element array containing the list of parsed options and * the non-option arguments - * @access public */ - function getopt2($args, $short_options, $long_options = null, $skip_unknown = false) + public static function getopt2($args, $short_options, $long_options = null, $skip_unknown = false) { return Console_Getopt::doGetopt(2, $args, $short_options, $long_options, $skip_unknown); } @@ -7641,7 +7751,7 @@ class Console_Getopt * @return array two-element array containing the list of parsed options and * the non-option arguments */ - function getopt($args, $short_options, $long_options = null, $skip_unknown = false) + public static function getopt($args, $short_options, $long_options = null, $skip_unknown = false) { return Console_Getopt::doGetopt(1, $args, $short_options, $long_options, $skip_unknown); } @@ -7657,7 +7767,7 @@ class Console_Getopt * * @return array */ - function doGetopt($version, $args, $short_options, $long_options = null, $skip_unknown = false) + public static function doGetopt($version, $args, $short_options, $long_options = null, $skip_unknown = false) { // in case you pass directly readPHPArgv() as the first arg if (PEAR::isError($args)) { @@ -7736,10 +7846,9 @@ class Console_Getopt * @param string[] &$args * @param boolean $skip_unknown suppresses Console_Getopt: unrecognized option * - * @access private * @return void */ - function _parseShortOption($arg, $short_options, &$opts, &$args, $skip_unknown) + protected static function _parseShortOption($arg, $short_options, &$opts, &$args, $skip_unknown) { for ($i = 0; $i < strlen($arg); $i++) { $opt = $arg{$i}; @@ -7774,11 +7883,11 @@ class Console_Getopt if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) { $msg = "option requires an argument --$opt"; - return PEAR::raiseError("Console_Getopt:" . $msg); + return PEAR::raiseError("Console_Getopt: " . $msg); } } else { $msg = "option requires an argument --$opt"; - return PEAR::raiseError("Console_Getopt:" . $msg); + return PEAR::raiseError("Console_Getopt: " . $msg); } } } @@ -7792,10 +7901,9 @@ class Console_Getopt * * @param string $arg Argument to check * - * @access private * @return bool */ - function _isShortOpt($arg) + protected static function _isShortOpt($arg) { return strlen($arg) == 2 && $arg[0] == '-' && preg_match('/[a-zA-Z]/', $arg[1]); @@ -7806,10 +7914,9 @@ class Console_Getopt * * @param string $arg Argument to check * - * @access private * @return bool */ - function _isLongOpt($arg) + protected static function _isLongOpt($arg) { return strlen($arg) > 2 && $arg[0] == '-' && $arg[1] == '-' && preg_match('/[a-zA-Z]+$/', substr($arg, 2)); @@ -7823,10 +7930,9 @@ class Console_Getopt * @param string[][] &$opts * @param string[] &$args * - * @access private * @return void|PEAR_Error */ - function _parseLongOption($arg, $long_options, &$opts, &$args, $skip_unknown) + protected static function _parseLongOption($arg, $long_options, &$opts, &$args, $skip_unknown) { @list($opt, $opt_arg) = explode('=', $arg, 2); @@ -7898,10 +8004,9 @@ class Console_Getopt * Safely read the $argv PHP array across different PHP configurations. * Will take care on register_globals and register_argc_argv ini directives * - * @access public * @return mixed the $argv PHP array or PEAR error if not registered */ - function readPHPArgv() + public static function readPHPArgv() { global $argv; if (!is_array($argv)) { @@ -7917,13 +8022,11 @@ class Console_Getopt return $argv; } -} 'phar://install-pear-nozlib.phar/Archive_Tar-1.3.13.tar', -'Console_Getopt' => 'phar://install-pear-nozlib.phar/Console_Getopt-1.3.1.tar', -'Structures_Graph' => 'phar://install-pear-nozlib.phar/Structures_Graph-1.0.4.tar', -'XML_Util' => 'phar://install-pear-nozlib.phar/XML_Util-1.2.3.tar', +$install_files = array('Archive_Tar' => 'phar://install-pear-nozlib.phar/Archive_Tar-1.3.16.tar', +'Console_Getopt' => 'phar://install-pear-nozlib.phar/Console_Getopt-1.4.0.tar', +'Structures_Graph' => 'phar://install-pear-nozlib.phar/Structures_Graph-1.1.0.tar', +'XML_Util' => 'phar://install-pear-nozlib.phar/XML_Util-1.3.0.tar', 'PEAR' => 'phar://install-pear-nozlib.phar/PEAR-1.9.5.tar', ); array_shift($argv); @@ -8230,7 +8333,6 @@ foreach ($install_files as $package => $instfile) { * @author Gregory Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since PEAR 0.1 */ @@ -8319,7 +8421,7 @@ class OS_Guess var $release; var $extra; - function OS_Guess($uname = null) + function __construct($uname = null) { list($this->sysname, $this->release, @@ -8555,7 +8657,8 @@ class OS_Guess * indent-tabs-mode: nil * c-basic-offset: 4 * End: - */package.xml0000644000076500000240000014127412466347403012400 0ustar tyraelstaff + */ +package.xml0000644000076500000240000014101112540043166012355 0ustar tyraelstaff PEAR pear.php.net @@ -8644,8 +8747,8 @@ class OS_Guess mj@php.net no - 2015-02-10 - + 2015-06-16 + 1.9.5 1.9.5 @@ -8677,230 +8780,229 @@ Bug fixes in 1.9.5.dev1: - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + - + - + - + - + - + - + - + - + @@ -8942,27 +9044,26 @@ Bug fixes in 1.9.5.dev1: - + - + - + - - + - - + + @@ -9546,7 +9647,7 @@ Bug fixes in 1.9.5.dev1: -PEAR-1.9.5/OS/Guess.php0000644000076500000240000002455612466347403013605 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since PEAR 0.1 */ @@ -9647,7 +9747,7 @@ class OS_Guess var $release; var $extra; - function OS_Guess($uname = null) + function __construct($uname = null) { list($this->sysname, $this->release, @@ -9883,7 +9983,8 @@ class OS_Guess * indent-tabs-mode: nil * c-basic-offset: 4 * End: - */PEAR-1.9.5/PEAR/ChannelFile/Parser.php0000644000076500000240000000330312466347403016314 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -9950,7 +10050,7 @@ class PEAR_ChannelFile_Parser extends PEAR_XMLParser $ret->setPackagefile($file, $archive); return $ret; } -}PEAR-1.9.5/PEAR/Command/Auth.xml0000644000076500000240000000231412466347403015201 0ustar tyraelstaff +}PEAR-1.9.5/PEAR/Command/Auth.xml0000644000076500000240000000231412540043166015171 0ustar tyraelstaff Connects and authenticates to remote server [Deprecated in favor of channel-login] doLogin @@ -9979,7 +10079,7 @@ Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration. -PEAR-1.9.5/PEAR/Command/Auth.php0000644000076500000240000000506112466347403015172 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Auth.php0000644000076500000240000000501112540043166015155 0ustar tyraelstaff * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 * @deprecated since 1.8.0alpha1 @@ -10055,11 +10154,12 @@ password from your user configuration.', * * @access public */ - function PEAR_Command_Auth(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Channels($ui, $config); + parent::__construct($ui, $config); } -}PEAR-1.9.5/PEAR/Command/Build.xml0000644000076500000240000000040412466347403015335 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Build.xml0000644000076500000240000000040412540043166015325 0ustar tyraelstaff Build an Extension From C Source doBuild @@ -10068,7 +10168,7 @@ password from your user configuration.', [package.xml] Builds one or more extensions contained in a package. -PEAR-1.9.5/PEAR/Command/Build.php0000644000076500000240000000437412466347403015336 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Build.php0000644000076500000240000000432512540043166015322 0ustar tyraelstaff * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -10123,9 +10222,9 @@ Builds one or more extensions contained in a package.' * * @access public */ - function PEAR_Command_Build(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } function doBuild($command, $options, $params) @@ -10152,7 +10251,8 @@ Builds one or more extensions contained in a package.' $this->ui->outputData(rtrim($data), 'build'); } } -}PEAR-1.9.5/PEAR/Command/Channels.xml0000644000076500000240000001017212466347403016034 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Channels.xml0000644000076500000240000001017212540043166016024 0ustar tyraelstaff List Available Channels doList @@ -10274,7 +10374,7 @@ the default channel is used. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration. -PEAR-1.9.5/PEAR/Command/Channels.php0000644000076500000240000010131612466347403016024 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Channels.php0000644000076500000240000010124412540043166016014 0ustar tyraelstaff * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -10443,9 +10542,9 @@ configuration.', * * @access public */ - function PEAR_Command_Channels(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } function _sortChannels($a, $b) @@ -11156,7 +11255,8 @@ configuration.', $this->config->store(); return true; } -}PEAR-1.9.5/PEAR/Command/Common.php0000644000076500000240000002006512466347403015522 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -11239,9 +11338,9 @@ class PEAR_Command_Common extends PEAR * * @access public */ - function PEAR_Command_Common(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR(); + parent::__construct(); $this->config = &$config; $this->ui = &$ui; } @@ -11428,7 +11527,8 @@ class PEAR_Command_Common extends PEAR return $this->$func($command, $options, $params); } -}PEAR-1.9.5/PEAR/Command/Config.xml0000644000076500000240000000646612466347403015521 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Config.xml0000644000076500000240000000646612540043166015511 0ustar tyraelstaff Show All Settings doConfigShow @@ -11519,7 +11619,7 @@ PEAR installation (using the --remoteconfig option of install, upgrade, and uninstall). -PEAR-1.9.5/PEAR/Command/Config.php0000644000076500000240000003607612466347403015510 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Config.php0000644000076500000240000003602612540043166015473 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -11654,9 +11753,9 @@ and uninstall). * * @access public */ - function PEAR_Command_Config(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } function doConfigShow($command, $options, $params) @@ -11932,7 +12031,8 @@ and uninstall). return false; } -}PEAR-1.9.5/PEAR/Command/Install.xml0000644000076500000240000002057612466347403015720 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Install.xml0000644000076500000240000002057612540043166015710 0ustar tyraelstaff Install Package doInstall @@ -12207,7 +12307,7 @@ package if needed. Run post-installation scripts in package <package>, if any exist. -PEAR-1.9.5/PEAR/Command/Install.php0000644000076500000240000014400012466347403015674 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Install.php0000644000076500000240000014246112540043166015675 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -12522,9 +12621,9 @@ Run post-installation scripts in package , if any exist. * * @access public */ - function PEAR_Command_Install(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } // }}} @@ -12979,18 +13078,7 @@ Run post-installation scripts in package , if any exist. $exttype = 'extension'; $extpath = $pinfo[1]['basename']; } else { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - ob_start(); - phpinfo(INFO_GENERAL); - $info = ob_get_contents(); - ob_end_clean(); - $debug = function_exists('leak') ? '_debug' : ''; - $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; - } else { - $debug = ''; - $ts = ''; - } - $exttype = 'zend_extension' . $debug . $ts; + $exttype = 'zend_extension'; $extpath = $atts['installed_as']; } $extrainfo[] = 'You should add "' . $exttype . '=' . @@ -13482,7 +13570,7 @@ Run post-installation scripts in package , if any exist. return $ret; } } -PEAR-1.9.5/PEAR/Command/Mirror.xml0000644000076500000240000000115112466347403015550 0ustar tyraelstaff +PEAR-1.9.5/PEAR/Command/Mirror.xml0000644000076500000240000000115112540043166015540 0ustar tyraelstaff Downloads each available package from the default channel doDownloadAll @@ -13499,7 +13587,7 @@ Requests a list of available packages from the default channel ({config default_ and downloads them to current working directory. Note: only packages within preferred_state ({config preferred_state}) will be downloaded -PEAR-1.9.5/PEAR/Command/Mirror.php0000644000076500000240000001070412466347403015543 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Mirror.php0000644000076500000240000001063412540043166015535 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.2.0 */ @@ -13561,9 +13648,9 @@ packages within preferred_state ({config preferred_state}) will be downloaded' * @param object PEAR_Frontend a reference to an frontend * @param object PEAR_Config a reference to the configuration data */ - function PEAR_Command_Mirror(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } /** @@ -13637,7 +13724,8 @@ packages within preferred_state ({config preferred_state}) will be downloaded' return true; } -}PEAR-1.9.5/PEAR/Command/Package.xml0000644000076500000240000001606612466347403015644 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Package.xml0000644000076500000240000001606612540043166015634 0ustar tyraelstaff Build Package doPackage @@ -13873,7 +13961,7 @@ This is not the most intelligent conversion, and should only be used for automated conversion or learning the format. -PEAR-1.9.5/PEAR/Command/Package.php0000644000076500000240000011644012466347403015630 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Package.php0000644000076500000240000011636612540043166015627 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -14158,9 +14245,9 @@ used for automated conversion or learning the format. * * @access public */ - function PEAR_Command_Package(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } function _displayValidationResults($err, $warn, $strict = false) @@ -14997,7 +15084,7 @@ used for automated conversion or learning the format. return true; } } -PEAR-1.9.5/PEAR/Command/Pickle.xml0000644000076500000240000000223312466347403015507 0ustar tyraelstaff +PEAR-1.9.5/PEAR/Command/Pickle.xml0000644000076500000240000000223312540043166015477 0ustar tyraelstaff Build PECL Package doPackage @@ -15032,7 +15119,7 @@ uses any of these features, you are best off using PEAR_PackageFileManager to generate both package.xml. -PEAR-1.9.5/PEAR/Command/Pickle.php0000644000076500000240000003707512466347403015512 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Pickle.php0000644000076500000240000003702512540043166015475 0ustar tyraelstaff * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.1 */ @@ -15110,9 +15196,9 @@ generate both package.xml. * * @access public */ - function PEAR_Command_Pickle(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } /** @@ -15452,7 +15538,8 @@ generate both package.xml. $gen = &$pf->getDefaultGenerator(); $gen->toPackageFile('.'); } -}PEAR-1.9.5/PEAR/Command/Registry.xml0000644000076500000240000000337612466347403016121 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Registry.xml0000644000076500000240000000337612540043166016111 0ustar tyraelstaff List Installed Packages In The Default Channel doList @@ -15509,7 +15596,7 @@ Displays information about a package. The package argument may be a local package file, an URL to a package file, or the name of an installed package. -PEAR-1.9.5/PEAR/Command/Registry.php0000644000076500000240000013233312466347403016104 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Registry.php0000644000076500000240000013226112540043166016074 0ustar tyraelstaff * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -15609,9 +15695,9 @@ installed package.' * * @access public */ - function PEAR_Command_Registry(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } function _sortinfo($a, $b) @@ -16653,7 +16739,8 @@ installed package.' $data['raw'] = $obj->getArray(); // no validation needed $this->ui->outputData($data, 'package-info'); } -}PEAR-1.9.5/PEAR/Command/Remote.xml0000644000076500000240000000635712466347403015546 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Remote.xml0000644000076500000240000000635712540043166015536 0ustar tyraelstaff Information About Remote Packages doRemoteInfo @@ -16761,7 +16848,7 @@ Clear the XML-RPC/REST cache. See also the cache_ttl configuration parameter. -PEAR-1.9.5/PEAR/Command/Remote.php0000644000076500000240000007250612466347403015534 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Remote.php0000644000076500000240000007243612540043166015526 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -16918,9 +17004,9 @@ parameter. * * @access public */ - function PEAR_Command_Remote(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } function _checkChannelForStatus($channel, $chan) @@ -17570,7 +17656,8 @@ parameter. $this->ui->outputData(rtrim($output), $command); return $num; } -}PEAR-1.9.5/PEAR/Command/Test.xml0000644000076500000240000000315112466347403015217 0ustar tyraelstaff +} +PEAR-1.9.5/PEAR/Command/Test.xml0000644000076500000240000000315112540043166015207 0ustar tyraelstaff Run Regression Tests doRunTests @@ -17623,7 +17710,7 @@ If none is found, all .phpt tests will be tried instead. [testfile|dir ...] Run regression tests with PHP's regression testing script (run-tests.php). -PEAR-1.9.5/PEAR/Command/Test.php0000644000076500000240000002736112466347403015217 0ustar tyraelstaffPEAR-1.9.5/PEAR/Command/Test.php0000644000076500000240000002754612540043166015214 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -17712,6 +17798,10 @@ If none is found, all .phpt tests will be tried instead.', 'shortopt' => 'x', 'doc' => 'Generate a code coverage report (requires Xdebug 2.0.0+)', ), + 'showdiff' => array( + 'shortopt' => 'd', + 'doc' => 'Output diff on test failure', + ), ), 'doc' => '[testfile|dir ...] Run regression tests with PHP\'s regression testing script (run-tests.php).', @@ -17725,9 +17815,9 @@ Run regression tests with PHP\'s regression testing script (run-tests.php).', * * @access public */ - function PEAR_Command_Test(&$ui, &$config) + function __construct(&$ui, &$config) { - parent::PEAR_Command_Common($ui, $config); + parent::__construct($ui, $config); } function doRunTests($command, $options, $params) @@ -17962,7 +18052,8 @@ Run regression tests with PHP\'s regression testing script (run-tests.php).', } return $this->raiseError('Some tests failed'); } -}PEAR-1.9.5/PEAR/Downloader/Package.php0000644000076500000240000022450012466347403016345 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -18094,7 +18184,7 @@ class PEAR_Downloader_Package /** * @param PEAR_Downloader */ - function PEAR_Downloader_Package(&$downloader) + function __construct(&$downloader) { $this->_downloader = &$downloader; $this->_config = &$this->_downloader->config; @@ -19947,7 +20037,8 @@ class PEAR_Downloader_Package return $info; } -}PEAR-1.9.5/PEAR/Frontend/CLI.php0000644000076500000240000006214212466347403015104 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -19996,9 +20086,9 @@ class PEAR_Frontend_CLI extends PEAR_Frontend 'normal' => '', ); - function PEAR_Frontend_CLI() + function __construct() { - parent::PEAR(); + parent::__construct(); $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1 if (function_exists('posix_isatty') && !posix_isatty(1)) { // output is being redirected to a file or through a pipe @@ -20697,7 +20787,8 @@ class PEAR_Frontend_CLI extends PEAR_Frontend { print $text; } -}PEAR-1.9.5/PEAR/Installer/Role/Common.php0000644000076500000240000001415412466347403017004 0ustar tyraelstaff * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -20738,7 +20828,7 @@ class PEAR_Installer_Role_Common /** * @param PEAR_Config */ - function PEAR_Installer_Role_Common(&$config) + function __construct(&$config) { $this->config = $config; } @@ -20870,7 +20960,8 @@ class PEAR_Installer_Role_Common return $roleInfo['phpextension']; } } -?>PEAR-1.9.5/PEAR/Installer/Role/Cfg.xml0000644000076500000240000000064512466347403016264 0ustar tyraelstaff +?> +PEAR-1.9.5/PEAR/Installer/Role/Cfg.xml0000644000076500000240000000064512540043166016254 0ustar tyraelstaff php extsrc extbin @@ -20884,7 +20975,7 @@ class PEAR_Installer_Role_Common -PEAR-1.9.5/PEAR/Installer/Role/Cfg.php0000644000076500000240000000762612466347403016261 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Cfg.php0000644000076500000240000000757512540043166016254 0ustar tyraelstaff * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.7.0 */ @@ -20989,7 +21079,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common return $test; } -}PEAR-1.9.5/PEAR/Installer/Role/Data.xml0000644000076500000240000000062212466347403016431 0ustar tyraelstaff +}PEAR-1.9.5/PEAR/Installer/Role/Data.xml0000644000076500000240000000062212540043166016421 0ustar tyraelstaff php extsrc extbin @@ -21003,7 +21093,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common -PEAR-1.9.5/PEAR/Installer/Role/Data.php0000644000076500000240000000144612466347403016425 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Data.php0000644000076500000240000000141512540043166016411 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21030,7 +21119,7 @@ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} -?>PEAR-1.9.5/PEAR/Installer/Role/Doc.xml0000644000076500000240000000062112466347403016264 0ustar tyraelstaff +?>PEAR-1.9.5/PEAR/Installer/Role/Doc.xml0000644000076500000240000000062112540043166016254 0ustar tyraelstaff php extsrc extbin @@ -21044,7 +21133,7 @@ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} -PEAR-1.9.5/PEAR/Installer/Role/Doc.php0000644000076500000240000000144412466347403016257 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Doc.php0000644000076500000240000000141312540043166016243 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21071,7 +21159,7 @@ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} -?>PEAR-1.9.5/PEAR/Installer/Role/Ext.xml0000644000076500000240000000050212466347403016315 0ustar tyraelstaff +?>PEAR-1.9.5/PEAR/Installer/Role/Ext.xml0000644000076500000240000000050212540043166016305 0ustar tyraelstaff extbin zendextbin 1 @@ -21082,7 +21170,7 @@ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} 1 -PEAR-1.9.5/PEAR/Installer/Role/Ext.php0000644000076500000240000000144412466347403016312 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Ext.php0000644000076500000240000000141312540043166016276 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21109,7 +21196,7 @@ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} -?>PEAR-1.9.5/PEAR/Installer/Role/Php.xml0000644000076500000240000000065512466347403016315 0ustar tyraelstaff +?>PEAR-1.9.5/PEAR/Installer/Role/Php.xml0000644000076500000240000000065512540043166016305 0ustar tyraelstaff php extsrc extbin @@ -21123,7 +21210,7 @@ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} -PEAR-1.9.5/PEAR/Installer/Role/Php.php0000644000076500000240000000144412466347403016301 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Php.php0000644000076500000240000000141312540043166016265 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21150,7 +21236,7 @@ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} -?>PEAR-1.9.5/PEAR/Installer/Role/Script.xml0000644000076500000240000000066012466347403017026 0ustar tyraelstaff +?>PEAR-1.9.5/PEAR/Installer/Role/Script.xml0000644000076500000240000000066012540043166017016 0ustar tyraelstaff php extsrc extbin @@ -21164,7 +21250,7 @@ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} 1 -PEAR-1.9.5/PEAR/Installer/Role/Script.php0000644000076500000240000000145212466347403017015 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Script.php0000644000076500000240000000142112540043166017001 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21191,7 +21276,7 @@ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} -?>PEAR-1.9.5/PEAR/Installer/Role/Src.xml0000644000076500000240000000044212466347403016307 0ustar tyraelstaff +?>PEAR-1.9.5/PEAR/Installer/Role/Src.xml0000644000076500000240000000044212540043166016277 0ustar tyraelstaff extsrc zendextsrc 1 @@ -21202,7 +21287,7 @@ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} -PEAR-1.9.5/PEAR/Installer/Role/Src.php0000644000076500000240000000161112466347403016275 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Src.php0000644000076500000240000000156012540043166016270 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21235,7 +21319,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common $installer->source_files++; } } -?>PEAR-1.9.5/PEAR/Installer/Role/Test.xml0000644000076500000240000000062212466347403016477 0ustar tyraelstaff +?>PEAR-1.9.5/PEAR/Installer/Role/Test.xml0000644000076500000240000000062212540043166016467 0ustar tyraelstaff php extsrc extbin @@ -21249,7 +21333,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common -PEAR-1.9.5/PEAR/Installer/Role/Test.php0000644000076500000240000000144612466347403016473 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Test.php0000644000076500000240000000141512540043166016457 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21276,7 +21359,7 @@ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} -?>PEAR-1.9.5/PEAR/Installer/Role/Www.xml0000644000076500000240000000064412466347403016350 0ustar tyraelstaff +?>PEAR-1.9.5/PEAR/Installer/Role/Www.xml0000644000076500000240000000064412540043166016340 0ustar tyraelstaff php extsrc extbin @@ -21290,7 +21373,7 @@ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} -PEAR-1.9.5/PEAR/Installer/Role/Www.php0000644000076500000240000000144012466347403016332 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role/Www.php0000644000076500000240000000140712540043166016325 0ustar tyraelstaff * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.7.0 */ @@ -21317,7 +21399,7 @@ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} * @since Class available since Release 1.7.0 */ class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {} -?>PEAR-1.9.5/PEAR/Installer/Role.php0000644000076500000240000001740712466347403015560 0ustar tyraelstaffPEAR-1.9.5/PEAR/Installer/Role.php0000644000076500000240000001735612540043166015553 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21592,7 +21673,7 @@ class PEAR_Installer_Role PEAR_Installer_Role::getValidRoles('****', true); return true; } -}PEAR-1.9.5/PEAR/PackageFile/Generator/v1.php0000644000076500000240000014226612466347403017333 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -21633,7 +21713,7 @@ class PEAR_PackageFile_Generator_v1 * @var PEAR_PackageFile_v1 */ var $_packagefile; - function PEAR_PackageFile_Generator_v1(&$packagefile) + function __construct(&$packagefile) { $this->_packagefile = &$packagefile; } @@ -21762,9 +21842,6 @@ class PEAR_PackageFile_Generator_v1 */ function _fixXmlEncoding($string) { - if (version_compare(phpversion(), '5.0.0', 'lt')) { - $string = utf8_encode($string); - } return strtr($string, array( '&' => '&', '>' => '>', @@ -22875,7 +22952,8 @@ class PEAR_PackageFile_Generator_v1 return $ret; } } -?>PEAR-1.9.5/PEAR/PackageFile/Generator/v2.php0000644000076500000240000010130512466347403017321 0ustar tyraelstaff +PEAR-1.9.5/PEAR/PackageFile/Generator/v2.php0000644000076500000240000010070312540043166017312 0ustar tyraelstaff_packagefile = &$packagefile; if (isset($this->_packagefile->encoding)) { @@ -23746,12 +23823,6 @@ http://pear.php.net/dtd/package-2.0.xsd', } if (is_scalar($tag['content']) || is_null($tag['content'])) { - if ($this->options['encoding'] == 'UTF-8' && - version_compare(phpversion(), '5.0.0', 'lt') - ) { - $tag['content'] = utf8_encode($tag['content']); - } - if ($replaceEntities === true) { $replaceEntities = XML_UTIL_ENTITIES_XML; } @@ -23768,7 +23839,7 @@ http://pear.php.net/dtd/package-2.0.xsd', return $tag; } } -PEAR-1.9.5/PEAR/PackageFile/Parser/v1.php0000644000076500000240000004024112466347403016627 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -24226,7 +24296,7 @@ class PEAR_PackageFile_Parser_v1 // }}} } -?>PEAR-1.9.5/PEAR/PackageFile/Parser/v2.php0000644000076500000240000000614212466347403016632 0ustar tyraelstaffPEAR-1.9.5/PEAR/PackageFile/Parser/v2.php0000644000076500000240000000611112540043166016616 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -24338,7 +24407,7 @@ class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser $ret->setPackagefile($file, $archive); return $ret; } -}PEAR-1.9.5/PEAR/PackageFile/v2/rw.php0000644000076500000240000017316612466347403016041 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ @@ -25941,7 +26009,7 @@ class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2 { unset($this->_packageInfo['changelog']); } -}PEAR-1.9.5/PEAR/PackageFile/v2/Validator.php0000644000076500000240000025020512466347403017324 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ @@ -27924,25 +27991,6 @@ class PEAR_PackageFile_v2_Validator $look_for = $token; continue 2; case T_STRING: - if (version_compare(zend_version(), '2.0', '<')) { - if (in_array(strtolower($data), - array('public', 'private', 'protected', 'abstract', - 'interface', 'implements', 'throw') - ) - ) { - if (isset($this->_stack)) { - $this->_stack->push(__FUNCTION__, 'warning', array( - 'file' => $file), - 'Error, PHP5 token encountered in %file%,' . - ' analysis should be in PHP5'); - } else { - PEAR::raiseError('Error: PHP5 token encountered in ' . $file . - 'packaging should be done in PHP 5'); - return false; - } - } - } - if ($look_for == T_CLASS) { $current_class = $data; $current_class_level = $brace_level; @@ -28096,7 +28144,7 @@ class PEAR_PackageFile_v2_Validator return $providesret; } } -PEAR-1.9.5/PEAR/PackageFile/v1.php0000644000076500000240000014370212466347403015401 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -28444,7 +28491,7 @@ class PEAR_PackageFile_v1 * @param bool determines whether to return a PEAR_Error object, or use the PEAR_ErrorStack * @param string Name of Error Stack class to use. */ - function PEAR_PackageFile_v1() + function __construct() { $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v1'); $this->_stack->setErrorMessageTemplate($this->_getErrorMessage()); @@ -29564,15 +29611,6 @@ class PEAR_PackageFile_v1 $look_for = $token; continue 2; case T_STRING: - if (version_compare(zend_version(), '2.0', '<')) { - if (in_array(strtolower($data), - array('public', 'private', 'protected', 'abstract', - 'interface', 'implements', 'throw') - )) { - $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_PHP5, - array($file)); - } - } if ($look_for == T_CLASS) { $current_class = $data; $current_class_level = $brace_level; @@ -29708,7 +29746,7 @@ class PEAR_PackageFile_v1 // }}} } ?> -PEAR-1.9.5/PEAR/PackageFile/v2.php0000644000076500000240000021003212466347403015371 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -29839,7 +29876,7 @@ class PEAR_PackageFile_v2 /** * The constructor merely sets up the private error stack */ - function PEAR_PackageFile_v2() + function __construct() { $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v2', false, null); $this->_isValid = false; @@ -30887,6 +30924,9 @@ class PEAR_PackageFile_v2 $contents['dir']['file'] = array($contents['dir']['file']); } foreach ($contents['dir']['file'] as $file) { + if (!isset($file['attribs']['name'])) { + continue; + } $name = $file['attribs']['name']; if (!$preserve) { $file = $file['attribs']; @@ -31757,7 +31797,7 @@ class PEAR_PackageFile_v2 } } ?> -PEAR-1.9.5/PEAR/REST/10.php0000644000076500000240000007765012466347403013725 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a12 */ @@ -31796,7 +31835,7 @@ class PEAR_REST_10 * @var PEAR_REST */ var $_rest; - function PEAR_REST_10($config, $options = array()) + function __construct($config, $options = array()) { $this->_rest = new PEAR_REST($config, $options); } @@ -32627,7 +32666,8 @@ class PEAR_REST_10 return 1; } } -}PEAR-1.9.5/PEAR/REST/11.php0000644000076500000240000002600012466347403013705 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.3 */ @@ -32667,7 +32706,7 @@ class PEAR_REST_11 */ var $_rest; - function PEAR_REST_11($config, $options = array()) + function __construct($config, $options = array()) { $this->_rest = new PEAR_REST($config, $options); } @@ -32967,7 +33006,8 @@ class PEAR_REST_11 return array_slice($states, $i + 1); } } -?>PEAR-1.9.5/PEAR/REST/13.php0000644000076500000240000002647112466347403013723 0ustar tyraelstaff +PEAR-1.9.5/PEAR/REST/13.php0000644000076500000240000002644012540043166013707 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a12 */ @@ -33265,20 +33304,19 @@ class PEAR_REST_13 extends PEAR_REST_10 return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel); } -}PEAR-1.9.5/PEAR/Task/Postinstallscript/rw.php0000644000076500000240000001323612466347403020011 0ustar tyraelstaff - read/write version * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a10 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a10 */ /** * Base class @@ -33302,30 +33340,31 @@ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript * * @var PEAR_PackageFile_v2_rw */ - var $_pkg; + public $_pkg; /** * Enter description here... * - * @param PEAR_PackageFile_v2_rw $pkg - * @param PEAR_Config $config - * @param PEAR_Frontend $logger - * @param array $fileXml + * @param PEAR_PackageFile_v2_rw $pkg Package + * @param PEAR_Config $config Config + * @param PEAR_Frontend $logger Logger + * @param array $fileXml XML + * * @return PEAR_Task_Postinstallscript_rw */ - function PEAR_Task_Postinstallscript_rw(&$pkg, &$config, &$logger, $fileXml) + function __construct(&$pkg, &$config, &$logger, $fileXml) { - parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE); + parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } - function validate() + public function validate() { return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); } - function getName() + public function getName() { return 'postinstallscript'; } @@ -33340,30 +33379,31 @@ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript * * Use {@link addConditionTypeGroup()} to add a containing * a tag - * @param string $id id as seen by the script - * @param array|false $params array of getParam() calls, or false for no params + * + * @param string $id id as seen by the script + * @param array|false $params array of getParam() calls, or false for no params * @param string|false $instructions */ - function addParamGroup($id, $params = false, $instructions = false) + public function addParamGroup($id, $params = false, $instructions = false) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( - $this->_pkg->getTasksNs() . ':id' => $id, + $this->_pkg->getTasksNs().':id' => $id, ); if ($instructions) { - $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions; + $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; } if ($params) { - $stuff[$this->_pkg->getTasksNs() . ':param'] = $params; + $stuff[$this->_pkg->getTasksNs().':param'] = $params; } - $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff; + $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; } /** - * add a complex to the post-install script with conditions + * Add a complex to the post-install script with conditions * * This inserts a with * @@ -33374,79 +33414,91 @@ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript * * Use {@link addParamGroup()} to add a simple * - * @param string $id id as seen by the script - * @param string $oldgroup id of the section referenced by - * - * @param string $param name of the from the older section referenced - * by - * @param string $value value to match of the parameter - * @param string $conditiontype one of '=', '!=', 'preg_match' - * @param array|false $params array of getParam() calls, or false for no params + * @param string $id id as seen by the script + * @param string $oldgroup id of the section referenced by + * + * @param string $param name of the from the older section referenced + * by + * @param string $value value to match of the parameter + * @param string $conditiontype one of '=', '!=', 'preg_match' + * @param array|false $params array of getParam() calls, or false for no params * @param string|false $instructions */ - function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=', - $params = false, $instructions = false) - { + public function addConditionTypeGroup($id, + $oldgroup, + $param, + $value, + $conditiontype = '=', + $params = false, + $instructions = false + ) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( - $this->_pkg->getTasksNs() . ':id' => $id, + $this->_pkg->getTasksNs().':id' => $id, ); if ($instructions) { - $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions; + $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; } - $stuff[$this->_pkg->getTasksNs() . ':name'] = $oldgroup . '::' . $param; - $stuff[$this->_pkg->getTasksNs() . ':conditiontype'] = $conditiontype; - $stuff[$this->_pkg->getTasksNs() . ':value'] = $value; + $stuff[$this->_pkg->getTasksNs().':name'] = $oldgroup.'::'.$param; + $stuff[$this->_pkg->getTasksNs().':conditiontype'] = $conditiontype; + $stuff[$this->_pkg->getTasksNs().':value'] = $value; if ($params) { - $stuff[$this->_pkg->getTasksNs() . ':param'] = $params; + $stuff[$this->_pkg->getTasksNs().':param'] = $params; } - $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff; + $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; } - function getXml() + public function getXml() { return $this->_params; } /** * Use to set up a param tag for use in creating a paramgroup + * + * @param mixed $name Name of parameter + * @param mixed $prompt Prompt + * @param string $type Type, defaults to 'string' + * @param mixed $default Default value + * * @static + * @return array */ - function getParam($name, $prompt, $type = 'string', $default = null) + public function getParam($name, $prompt, $type = 'string', $default = null) { if ($default !== null) { return array( - $this->_pkg->getTasksNs() . ':name' => $name, - $this->_pkg->getTasksNs() . ':prompt' => $prompt, - $this->_pkg->getTasksNs() . ':type' => $type, - $this->_pkg->getTasksNs() . ':default' => $default + $this->_pkg->getTasksNs().':name' => $name, + $this->_pkg->getTasksNs().':prompt' => $prompt, + $this->_pkg->getTasksNs().':type' => $type, + $this->_pkg->getTasksNs().':default' => $default, ); } + return array( - $this->_pkg->getTasksNs() . ':name' => $name, - $this->_pkg->getTasksNs() . ':prompt' => $prompt, - $this->_pkg->getTasksNs() . ':type' => $type, + $this->_pkg->getTasksNs().':name' => $name, + $this->_pkg->getTasksNs().':prompt' => $prompt, + $this->_pkg->getTasksNs().':type' => $type, ); } } -?>PEAR-1.9.5/PEAR/Task/Replace/rw.php0000644000076500000240000000304212466347403015615 0ustar tyraelstaff - read/write version * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a10 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a10 */ /** * Base class @@ -33465,48 +33517,47 @@ require_once 'PEAR/Task/Replace.php'; */ class PEAR_Task_Replace_rw extends PEAR_Task_Replace { - function PEAR_Task_Replace_rw(&$pkg, &$config, &$logger, $fileXml) + public function __construct(&$pkg, &$config, &$logger, $fileXml) { - parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE); + parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } - function validate() + public function validate() { return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); } - function setInfo($from, $to, $type) + public function setInfo($from, $to, $type) { $this->_params = array('attribs' => array('from' => $from, 'to' => $to, 'type' => $type)); } - function getName() + public function getName() { return 'replace'; } - function getXml() + public function getXml() { return $this->_params; } } -?>PEAR-1.9.5/PEAR/Task/Unixeol/rw.php0000644000076500000240000000246212466347403015672 0ustar tyraelstaff - read/write version * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a10 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a10 */ /** * Base class @@ -33525,43 +33576,43 @@ require_once 'PEAR/Task/Unixeol.php'; */ class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol { - function PEAR_Task_Unixeol_rw(&$pkg, &$config, &$logger, $fileXml) + function __construct(&$pkg, &$config, &$logger, $fileXml) { - parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE); + parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } - function validate() + public function validate() { return true; } - function getName() + public function getName() { return 'unixeol'; } - function getXml() + public function getXml() { return ''; } } -?>PEAR-1.9.5/PEAR/Task/Windowseol/rw.php0000644000076500000240000000250712466347403016401 0ustar tyraelstaff +PEAR-1.9.5/PEAR/Task/Windowseol/rw.php0000644000076500000240000000244712540043166016374 0ustar tyraelstaff - read/write version * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a10 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a10 */ /** * Base class @@ -33569,54 +33620,55 @@ class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol require_once 'PEAR/Task/Windowseol.php'; /** * Abstracts the windowseol task xml. - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.5 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a10 + * + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @version Release: 1.9.5 + * @link http://pear.php.net/package/PEAR + * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol { - function PEAR_Task_Windowseol_rw(&$pkg, &$config, &$logger, $fileXml) + function __construct(&$pkg, &$config, &$logger, $fileXml) { - parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE); + parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } - function validate() + public function validate() { return true; } - function getName() + public function getName() { return 'windowseol'; } - function getXml() + public function getXml() { return ''; } } -?>PEAR-1.9.5/PEAR/Task/Common.php0000644000076500000240000001365712466347403015057 0ustar tyraelstaff +PEAR-1.9.5/PEAR/Task/Common.php0000644000076500000240000001411712540043166015037 0ustar tyraelstaff - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a1 */ /**#@+ * Error codes for task validation routines @@ -33647,14 +33699,15 @@ define('PEAR_TASK_PACKAGEANDINSTALL', 3); * This will first replace any instance of @data-dir@ in the test.php file * with the path to the current data directory. Then, it will include the * test.php file and run the script it contains to configure the package post-installation. - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.5 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a1 + * + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @version Release: 1.9.5 + * @link http://pear.php.net/package/PEAR + * @since Class available since Release 1.4.0a1 * @abstract */ class PEAR_Task_Common @@ -33667,34 +33720,35 @@ class PEAR_Task_Common * changes directly to disk * * Child task classes must override this property. + * * @access protected */ - var $type = 'simple'; + protected $type = 'simple'; /** * Determines which install phase this task is executed under */ - var $phase = PEAR_TASK_INSTALL; + public $phase = PEAR_TASK_INSTALL; /** * @access protected */ - var $config; + protected $config; /** * @access protected */ - var $registry; + protected $registry; /** * @access protected */ - var $logger; + public $logger; /** * @access protected */ - var $installphase; + protected $installphase; /** * @param PEAR_Config * @param PEAR_Common */ - function PEAR_Task_Common(&$config, &$logger, $phase) + function __construct(&$config, &$logger, $phase) { $this->config = &$config; $this->registry = &$config->getRegistry(); @@ -33707,60 +33761,67 @@ class PEAR_Task_Common /** * Validate the basic contents of a task tag. + * * @param PEAR_PackageFile_v2 * @param array * @param PEAR_Config * @param array the entire parsed tag + * * @return true|array On error, return an array in format: - * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...]) + * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...]) + * + * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in + * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and + * an array of legal values in * - * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in - * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and an array - * of legal values in * @static * @abstract */ - function validateXml($pkg, $xml, $config, $fileXml) + public function validateXml($pkg, $xml, $config, $fileXml) { } /** * Initialize a task instance with the parameters - * @param array raw, parsed xml - * @param array attributes from the tag containing this task - * @param string|null last installed version of this package + * + * @param array raw, parsed xml + * @param array attributes from the tag containing this task + * @param string|null last installed version of this package * @abstract */ - function init($xml, $fileAttributes, $lastVersion) + public function init($xml, $fileAttributes, $lastVersion) { } /** - * Begin a task processing session. All multiple tasks will be processed after each file - * has been successfully installed, all simple tasks should perform their task here and - * return any errors using the custom throwError() method to allow forward compatibility + * Begin a task processing session. All multiple tasks will be processed + * after each file has been successfully installed, all simple tasks should + * perform their task here and return any errors using the custom + * throwError() method to allow forward compatibility * * This method MUST NOT write out any changes to disk - * @param PEAR_PackageFile_v2 - * @param string file contents - * @param string the eventual final file location (informational only) - * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail - * (use $this->throwError), otherwise return the new contents + * + * @param PEAR_PackageFile_v2 + * @param string file contents + * @param string the eventual final file location (informational only) + * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail + * (use $this->throwError), otherwise return the new contents * @abstract */ - function startSession($pkg, $contents, $dest) + public function startSession($pkg, $contents, $dest) { } /** - * This method is used to process each of the tasks for a particular multiple class - * type. Simple tasks need not implement this method. - * @param array an array of tasks - * @access protected + * This method is used to process each of the tasks for a particular + * multiple class type. Simple tasks need not implement this method. + * + * @param array an array of tasks + * @access protected * @static * @abstract */ - function run($tasks) + public function run($tasks) { } @@ -33768,56 +33829,58 @@ class PEAR_Task_Common * @static * @final */ - function hasPostinstallTasks() + public function hasPostinstallTasks() { return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); } - /** - * @static - * @final - */ - function runPostinstallTasks() - { - foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) { - $err = call_user_func(array($class, 'run'), - $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class]); - if ($err) { - return PEAR_Task_Common::throwError($err); - } - } - unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); + /** + * @static + * @final + */ + public function runPostinstallTasks() + { + foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) { + $err = call_user_func( + array($class, 'run'), + $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class] + ); + if ($err) { + return PEAR_Task_Common::throwError($err); + } + } + unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); } /** * Determines whether a role is a script * @return bool */ - function isScript() + public function isScript() { - return $this->type == 'script'; + return $this->type == 'script'; } - function throwError($msg, $code = -1) + public function throwError($msg, $code = -1) { include_once 'PEAR.php'; + return PEAR::raiseError($msg, $code); } } -?>PEAR-1.9.5/PEAR/Task/Postinstallscript.php0000644000076500000240000003403012466347403017354 0ustar tyraelstaff * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a1 */ /** * Base class @@ -33828,85 +33891,96 @@ require_once 'PEAR/Task/Common.php'; * * Note that post-install scripts are handled separately from installation, by the * "pear run-scripts" command - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.5 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a1 + * + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @version Release: 1.9.5 + * @link http://pear.php.net/package/PEAR + * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Postinstallscript extends PEAR_Task_Common { - var $type = 'script'; - var $_class; - var $_params; - var $_obj; + public $type = 'script'; + public $_class; + public $_params; + public $_obj; /** * * @var PEAR_PackageFile_v2 */ - var $_pkg; - var $_contents; - var $phase = PEAR_TASK_INSTALL; + public $_pkg; + public $_contents; + public $phase = PEAR_TASK_INSTALL; /** * Validate the raw xml at parsing-time. * * This also attempts to validate the script to make sure it meets the criteria * for a post-install script - * @param PEAR_PackageFile_v2 - * @param array The XML contents of the tag - * @param PEAR_Config - * @param array the entire parsed tag + * + * @param PEAR_PackageFile_v2 + * @param array The XML contents of the tag + * @param PEAR_Config + * @param array the entire parsed tag * @static */ - function validateXml($pkg, $xml, $config, $fileXml) + public function validateXml($pkg, $xml, $config, $fileXml) { if ($fileXml['role'] != 'php') { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" must be role="php"'); + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" must be role="php"', ); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $file = $pkg->getFileContents($fileXml['name']); if (PEAR::isError($file)) { PEAR::popErrorHandling(); - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" is not valid: ' . - $file->getMessage()); + + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" is not valid: '. + $file->getMessage(), ); } elseif ($file === null) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" could not be retrieved for processing!'); + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" could not be retrieved for processing!', ); } else { $analysis = $pkg->analyzeSourceCode($file, true); if (!$analysis) { PEAR::popErrorHandling(); $warnings = ''; foreach ($pkg->getValidationWarnings() as $warn) { - $warnings .= $warn['message'] . "\n"; + $warnings .= $warn['message']."\n"; } - return array(PEAR_TASK_ERROR_INVALID, 'Analysis of post-install script "' . - $fileXml['name'] . '" failed: ' . $warnings); + + return array(PEAR_TASK_ERROR_INVALID, 'Analysis of post-install script "'. + $fileXml['name'].'" failed: '.$warnings, ); } if (count($analysis['declared_classes']) != 1) { PEAR::popErrorHandling(); - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" must declare exactly 1 class'); + + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" must declare exactly 1 class', ); } $class = $analysis['declared_classes'][0]; - if ($class != str_replace(array('/', '.php'), array('_', ''), - $fileXml['name']) . '_postinstall') { + if ($class != str_replace( + array('/', '.php'), array('_', ''), + $fileXml['name'] + ).'_postinstall') { PEAR::popErrorHandling(); - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" class "' . $class . '" must be named "' . - str_replace(array('/', '.php'), array('_', ''), - $fileXml['name']) . '_postinstall"'); + + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" class "'.$class.'" must be named "'. + str_replace( + array('/', '.php'), array('_', ''), + $fileXml['name'] + ).'_postinstall"', ); } if (!isset($analysis['declared_methods'][$class])) { PEAR::popErrorHandling(); - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" must declare methods init() and run()'); + + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" must declare methods init() and run()', ); } $methods = array('init' => 0, 'run' => 1); foreach ($analysis['declared_methods'][$class] as $method) { @@ -33916,129 +33990,137 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common } if (count($methods)) { PEAR::popErrorHandling(); - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" must declare methods init() and run()'); + + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" must declare methods init() and run()', ); } } PEAR::popErrorHandling(); $definedparams = array(); - $tasksNamespace = $pkg->getTasksNs() . ':'; - if (!isset($xml[$tasksNamespace . 'paramgroup']) && isset($xml['paramgroup'])) { + $tasksNamespace = $pkg->getTasksNs().':'; + if (!isset($xml[$tasksNamespace.'paramgroup']) && isset($xml['paramgroup'])) { // in order to support the older betas, which did not expect internal tags // to also use the namespace $tasksNamespace = ''; } - if (isset($xml[$tasksNamespace . 'paramgroup'])) { - $params = $xml[$tasksNamespace . 'paramgroup']; + if (isset($xml[$tasksNamespace.'paramgroup'])) { + $params = $xml[$tasksNamespace.'paramgroup']; if (!is_array($params) || !isset($params[0])) { $params = array($params); } foreach ($params as $param) { - if (!isset($param[$tasksNamespace . 'id'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" must have ' . - 'an ' . $tasksNamespace . 'id> tag'); - } - if (isset($param[$tasksNamespace . 'name'])) { - if (!in_array($param[$tasksNamespace . 'name'], $definedparams)) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" ' . $tasksNamespace . - 'paramgroup> id "' . $param[$tasksNamespace . 'id'] . - '" parameter "' . $param[$tasksNamespace . 'name'] . - '" has not been previously defined'); - } - if (!isset($param[$tasksNamespace . 'conditiontype'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" ' . $tasksNamespace . - 'paramgroup> id "' . $param[$tasksNamespace . 'id'] . - '" must have a ' . $tasksNamespace . - 'conditiontype> tag containing either "=", ' . - '"!=", or "preg_match"'); - } - if (!in_array($param[$tasksNamespace . 'conditiontype'], - array('=', '!=', 'preg_match'))) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" ' . $tasksNamespace . - 'paramgroup> id "' . $param[$tasksNamespace . 'id'] . - '" must have a ' . $tasksNamespace . - 'conditiontype> tag containing either "=", ' . - '"!=", or "preg_match"'); - } - if (!isset($param[$tasksNamespace . 'value'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" ' . $tasksNamespace . - 'paramgroup> id "' . $param[$tasksNamespace . 'id'] . - '" must have a ' . $tasksNamespace . - 'value> tag containing expected parameter value'); - } - } - if (isset($param[$tasksNamespace . 'instructions'])) { - if (!is_string($param[$tasksNamespace . 'instructions'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" ' . $tasksNamespace . - 'paramgroup> id "' . $param[$tasksNamespace . 'id'] . - '" ' . $tasksNamespace . 'instructions> must be simple text'); - } - } - if (!isset($param[$tasksNamespace . 'param'])) { + if (!isset($param[$tasksNamespace.'id'])) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" must have '. + 'an '.$tasksNamespace.'id> tag', ); + } + if (isset($param[$tasksNamespace.'name'])) { + if (!in_array($param[$tasksNamespace.'name'], $definedparams)) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" '.$tasksNamespace. + 'paramgroup> id "'.$param[$tasksNamespace.'id']. + '" parameter "'.$param[$tasksNamespace.'name']. + '" has not been previously defined', ); + } + if (!isset($param[$tasksNamespace.'conditiontype'])) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" '.$tasksNamespace. + 'paramgroup> id "'.$param[$tasksNamespace.'id']. + '" must have a '.$tasksNamespace. + 'conditiontype> tag containing either "=", '. + '"!=", or "preg_match"', ); + } + if (!in_array( + $param[$tasksNamespace.'conditiontype'], + array('=', '!=', 'preg_match') + )) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" '.$tasksNamespace. + 'paramgroup> id "'.$param[$tasksNamespace.'id']. + '" must have a '.$tasksNamespace. + 'conditiontype> tag containing either "=", '. + '"!=", or "preg_match"', ); + } + if (!isset($param[$tasksNamespace.'value'])) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" '.$tasksNamespace. + 'paramgroup> id "'.$param[$tasksNamespace.'id']. + '" must have a '.$tasksNamespace. + 'value> tag containing expected parameter value', ); + } + } + if (isset($param[$tasksNamespace.'instructions'])) { + if (!is_string($param[$tasksNamespace.'instructions'])) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" '.$tasksNamespace. + 'paramgroup> id "'.$param[$tasksNamespace.'id']. + '" '.$tasksNamespace.'instructions> must be simple text', ); + } + } + if (!isset($param[$tasksNamespace.'param'])) { continue; // is no longer required } - $subparams = $param[$tasksNamespace . 'param']; + $subparams = $param[$tasksNamespace.'param']; if (!is_array($subparams) || !isset($subparams[0])) { $subparams = array($subparams); } foreach ($subparams as $subparam) { - if (!isset($subparam[$tasksNamespace . 'name'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" parameter for ' . - $tasksNamespace . 'paramgroup> id "' . - $param[$tasksNamespace . 'id'] . '" must have ' . - 'a ' . $tasksNamespace . 'name> tag'); - } - if (!preg_match('/[a-zA-Z0-9]+/', - $subparam[$tasksNamespace . 'name'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" parameter "' . - $subparam[$tasksNamespace . 'name'] . - '" for ' . $tasksNamespace . 'paramgroup> id "' . - $param[$tasksNamespace . 'id'] . - '" is not a valid name. Must contain only alphanumeric characters'); - } - if (!isset($subparam[$tasksNamespace . 'prompt'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" parameter "' . - $subparam[$tasksNamespace . 'name'] . - '" for ' . $tasksNamespace . 'paramgroup> id "' . - $param[$tasksNamespace . 'id'] . - '" must have a ' . $tasksNamespace . 'prompt> tag'); - } - if (!isset($subparam[$tasksNamespace . 'type'])) { - return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' . - $fileXml['name'] . '" parameter "' . - $subparam[$tasksNamespace . 'name'] . - '" for ' . $tasksNamespace . 'paramgroup> id "' . - $param[$tasksNamespace . 'id'] . - '" must have a ' . $tasksNamespace . 'type> tag'); - } - $definedparams[] = $param[$tasksNamespace . 'id'] . '::' . - $subparam[$tasksNamespace . 'name']; + if (!isset($subparam[$tasksNamespace.'name'])) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" parameter for '. + $tasksNamespace.'paramgroup> id "'. + $param[$tasksNamespace.'id'].'" must have '. + 'a '.$tasksNamespace.'name> tag', ); + } + if (!preg_match( + '/[a-zA-Z0-9]+/', + $subparam[$tasksNamespace.'name'] + )) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" parameter "'. + $subparam[$tasksNamespace.'name']. + '" for '.$tasksNamespace.'paramgroup> id "'. + $param[$tasksNamespace.'id']. + '" is not a valid name. Must contain only alphanumeric characters', ); + } + if (!isset($subparam[$tasksNamespace.'prompt'])) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" parameter "'. + $subparam[$tasksNamespace.'name']. + '" for '.$tasksNamespace.'paramgroup> id "'. + $param[$tasksNamespace.'id']. + '" must have a '.$tasksNamespace.'prompt> tag', ); + } + if (!isset($subparam[$tasksNamespace.'type'])) { + return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. + $fileXml['name'].'" parameter "'. + $subparam[$tasksNamespace.'name']. + '" for '.$tasksNamespace.'paramgroup> id "'. + $param[$tasksNamespace.'id']. + '" must have a '.$tasksNamespace.'type> tag', ); + } + $definedparams[] = $param[$tasksNamespace.'id'].'::'. + $subparam[$tasksNamespace.'name']; } } } + return true; } /** * Initialize a task instance with the parameters - * @param array raw, parsed xml - * @param array attributes from the tag containing this task - * @param string|null last installed version of this package, if any (useful for upgrades) + * @param array $xml raw, parsed xml + * @param array $fileattribs attributes from the tag containing + * this task + * @param string|null $lastversion last installed version of this package, + * if any (useful for upgrades) */ - function init($xml, $fileattribs, $lastversion) + public function init($xml, $fileattribs, $lastversion) { $this->_class = str_replace('/', '_', $fileattribs['name']); $this->_filename = $fileattribs['name']; - $this->_class = str_replace ('.php', '', $this->_class) . '_postinstall'; + $this->_class = str_replace('.php', '', $this->_class).'_postinstall'; $this->_params = $xml; $this->_lastversion = $lastversion; } @@ -34048,7 +34130,7 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common * * @access private */ - function _stripNamespace($params = null) + public function _stripNamespace($params = null) { if ($params === null) { $params = array(); @@ -34059,7 +34141,7 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common if (is_array($param)) { $param = $this->_stripNamespace($param); } - $params[str_replace($this->_pkg->getTasksNs() . ':', '', $i)] = $param; + $params[str_replace($this->_pkg->getTasksNs().':', '', $i)] = $param; } $this->_params = $params; } else { @@ -34068,21 +34150,24 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common if (is_array($param)) { $param = $this->_stripNamespace($param); } - $newparams[str_replace($this->_pkg->getTasksNs() . ':', '', $i)] = $param; + $newparams[str_replace($this->_pkg->getTasksNs().':', '', $i)] = $param; } + return $newparams; } } /** - * Unlike other tasks, the installed file name is passed in instead of the file contents, - * because this task is handled post-installation - * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @param string file name + * Unlike other tasks, the installed file name is passed in instead of the + * file contents, because this task is handled post-installation + * + * @param mixed $pkg PEAR_PackageFile_v1|PEAR_PackageFile_v2 + * @param string $contents file name + * * @return bool|PEAR_Error false to skip this file, PEAR_Error to fail - * (use $this->throwError) + * (use $this->throwError) */ - function startSession($pkg, $contents) + public function startSession($pkg, $contents) { if ($this->installphase != PEAR_TASK_INSTALL) { return false; @@ -34090,56 +34175,63 @@ class PEAR_Task_Postinstallscript extends PEAR_Task_Common // remove the tasks: namespace if present $this->_pkg = $pkg; $this->_stripNamespace(); - $this->logger->log(0, 'Including external post-installation script "' . - $contents . '" - any errors are in this script'); + $this->logger->log( + 0, 'Including external post-installation script "'. + $contents.'" - any errors are in this script' + ); include_once $contents; if (class_exists($this->_class)) { $this->logger->log(0, 'Inclusion succeeded'); } else { - return $this->throwError('init of post-install script class "' . $this->_class - . '" failed'); + return $this->throwError( + 'init of post-install script class "'.$this->_class + .'" failed' + ); } - $this->_obj = new $this->_class; - $this->logger->log(1, 'running post-install script "' . $this->_class . '->init()"'); + $this->_obj = new $this->_class(); + $this->logger->log(1, 'running post-install script "'.$this->_class.'->init()"'); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $res = $this->_obj->init($this->config, $pkg, $this->_lastversion); PEAR::popErrorHandling(); if ($res) { $this->logger->log(0, 'init succeeded'); } else { - return $this->throwError('init of post-install script "' . $this->_class . - '->init()" failed'); + return $this->throwError( + 'init of post-install script "'.$this->_class. + '->init()" failed' + ); } $this->_contents = $contents; + return true; } /** * No longer used - * @see PEAR_PackageFile_v2::runPostinstallScripts() - * @param array an array of tasks - * @param string install or upgrade + * + * @see PEAR_PackageFile_v2::runPostinstallScripts() + * @param array an array of tasks + * @param string install or upgrade * @access protected * @static */ - function run() + public function run() { } } -?>PEAR-1.9.5/PEAR/Task/Replace.php0000644000076500000240000001515212466347403015172 0ustar tyraelstaff * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a1 */ /** * Base class @@ -34158,18 +34250,19 @@ require_once 'PEAR/Task/Common.php'; */ class PEAR_Task_Replace extends PEAR_Task_Common { - var $type = 'simple'; - var $phase = PEAR_TASK_PACKAGEANDINSTALL; - var $_replacements; + public $type = 'simple'; + public $phase = PEAR_TASK_PACKAGEANDINSTALL; + public $_replacements; /** * Validate the raw xml at parsing-time. - * @param PEAR_PackageFile_v2 - * @param array raw, parsed xml - * @param PEAR_Config + * + * @param PEAR_PackageFile_v2 + * @param array raw, parsed xml + * @param PEAR_Config * @static */ - function validateXml($pkg, $xml, $config, $fileXml) + public function validateXml($pkg, $xml, $config, $fileXml) { if (!isset($xml['attribs'])) { return array(PEAR_TASK_ERROR_NOATTRIBS); @@ -34186,33 +34279,36 @@ class PEAR_Task_Replace extends PEAR_Task_Common if ($xml['attribs']['type'] == 'pear-config') { if (!in_array($xml['attribs']['to'], $config->getKeys())) { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], - $config->getKeys()); + $config->getKeys(), ); } } elseif ($xml['attribs']['type'] == 'php-const') { if (defined($xml['attribs']['to'])) { return true; } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], - array('valid PHP constant')); + array('valid PHP constant'), ); } } elseif ($xml['attribs']['type'] == 'package-info') { - if (in_array($xml['attribs']['to'], + if (in_array( + $xml['attribs']['to'], array('name', 'summary', 'channel', 'notes', 'extends', 'description', 'release_notes', 'license', 'release-license', 'license-uri', 'version', 'api-version', 'state', 'api-state', 'release_date', - 'date', 'time'))) { + 'date', 'time', ) + )) { return true; } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], array('name', 'summary', 'channel', 'notes', 'extends', 'description', 'release_notes', 'license', 'release-license', 'license-uri', 'version', 'api-version', 'state', 'api-state', 'release_date', - 'date', 'time')); + 'date', 'time', ), ); } } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'type', $xml['attribs']['type'], - array('pear-config', 'package-info', 'php-const')); + array('pear-config', 'package-info', 'php-const'), ); } + return true; } @@ -34221,7 +34317,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common * @param array raw, parsed xml * @param unused */ - function init($xml, $attribs) + public function init($xml, $attribs) { $this->_replacements = isset($xml['attribs']) ? array($xml) : $xml; } @@ -34230,13 +34326,14 @@ class PEAR_Task_Replace extends PEAR_Task_Common * Do a package.xml 1.0 replacement, with additional package-info fields available * * See validateXml() source for the complete list of allowed fields - * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @param string file contents - * @param string the eventual final file location (informational only) + * + * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 + * @param string file contents + * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail - * (use $this->throwError), otherwise return the new contents + * (use $this->throwError), otherwise return the new contents */ - function startSession($pkg, $contents, $dest) + public function startSession($pkg, $contents, $dest) { $subst_from = $subst_to = array(); foreach ($this->_replacements as $a) { @@ -34252,6 +34349,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common $to = $chan->getServer(); } else { $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); + return false; } } else { @@ -34268,6 +34366,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common } if (is_null($to)) { $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); + return false; } } elseif ($a['type'] == 'php-const') { @@ -34278,6 +34377,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common $to = constant($a['to']); } else { $this->logger->log(0, "$dest: invalid php-const replacement: $a[to]"); + return false; } } else { @@ -34285,6 +34385,7 @@ class PEAR_Task_Replace extends PEAR_Task_Common $to = $t; } else { $this->logger->log(0, "$dest: invalid package-info replacement: $a[to]"); + return false; } } @@ -34293,28 +34394,30 @@ class PEAR_Task_Replace extends PEAR_Task_Common $subst_to[] = $to; } } - $this->logger->log(3, "doing " . sizeof($subst_from) . - " substitution(s) for $dest"); + $this->logger->log( + 3, "doing ".sizeof($subst_from). + " substitution(s) for $dest" + ); if (sizeof($subst_from)) { $contents = str_replace($subst_from, $subst_to, $contents); } + return $contents; } } -?>PEAR-1.9.5/PEAR/Task/Unixeol.php0000644000076500000240000000426112466347403015241 0ustar tyraelstaff * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a1 */ /** * Base class @@ -34333,22 +34436,24 @@ require_once 'PEAR/Task/Common.php'; */ class PEAR_Task_Unixeol extends PEAR_Task_Common { - var $type = 'simple'; - var $phase = PEAR_TASK_PACKAGE; - var $_replacements; + public $type = 'simple'; + public $phase = PEAR_TASK_PACKAGE; + public $_replacements; /** * Validate the raw xml at parsing-time. - * @param PEAR_PackageFile_v2 - * @param array raw, parsed xml - * @param PEAR_Config + * + * @param PEAR_PackageFile_v2 + * @param array raw, parsed xml + * @param PEAR_Config * @static */ - function validateXml($pkg, $xml, $config, $fileXml) + public function validateXml($pkg, $xml, $config, $fileXml) { if ($xml != '') { return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); } + return true; } @@ -34357,7 +34462,7 @@ class PEAR_Task_Unixeol extends PEAR_Task_Common * @param array raw, parsed xml * @param unused */ - function init($xml, $attribs) + public function init($xml, $attribs) { } @@ -34365,32 +34470,33 @@ class PEAR_Task_Unixeol extends PEAR_Task_Common * Replace all line endings with line endings customized for the current OS * * See validateXml() source for the complete list of allowed fields - * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @param string file contents - * @param string the eventual final file location (informational only) + * + * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 + * @param string file contents + * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail - * (use $this->throwError), otherwise return the new contents + * (use $this->throwError), otherwise return the new contents */ - function startSession($pkg, $contents, $dest) + public function startSession($pkg, $contents, $dest) { $this->logger->log(3, "replacing all line endings with \\n in $dest"); + return preg_replace("/\r\n|\n\r|\r|\n/", "\n", $contents); } } -?>PEAR-1.9.5/PEAR/Task/Windowseol.php0000644000076500000240000000425212466347403015750 0ustar tyraelstaff * * PHP versions 4 and 5 * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @link http://pear.php.net/package/PEAR + * @since File available since Release 1.4.0a1 */ /** * Base class @@ -34398,33 +34504,36 @@ class PEAR_Task_Unixeol extends PEAR_Task_Common require_once 'PEAR/Task/Common.php'; /** * Implements the windows line endsings file task. - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.5 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a1 + * + * @category pear + * @package PEAR + * @author Greg Beaver + * @copyright 1997-2009 The Authors + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @version Release: 1.9.5 + * @link http://pear.php.net/package/PEAR + * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Windowseol extends PEAR_Task_Common { - var $type = 'simple'; - var $phase = PEAR_TASK_PACKAGE; - var $_replacements; + public $type = 'simple'; + public $phase = PEAR_TASK_PACKAGE; + public $_replacements; /** * Validate the raw xml at parsing-time. - * @param PEAR_PackageFile_v2 - * @param array raw, parsed xml - * @param PEAR_Config + * + * @param PEAR_PackageFile_v2 + * @param array raw, parsed xml + * @param PEAR_Config * @static */ - function validateXml($pkg, $xml, $config, $fileXml) + public function validateXml($pkg, $xml, $config, $fileXml) { if ($xml != '') { return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); } + return true; } @@ -34433,7 +34542,7 @@ class PEAR_Task_Windowseol extends PEAR_Task_Common * @param array raw, parsed xml * @param unused */ - function init($xml, $attribs) + public function init($xml, $attribs) { } @@ -34441,19 +34550,21 @@ class PEAR_Task_Windowseol extends PEAR_Task_Common * Replace all line endings with windows line endings * * See validateXml() source for the complete list of allowed fields - * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @param string file contents - * @param string the eventual final file location (informational only) + * + * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 + * @param string file contents + * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail - * (use $this->throwError), otherwise return the new contents + * (use $this->throwError), otherwise return the new contents */ - function startSession($pkg, $contents, $dest) + public function startSession($pkg, $contents, $dest) { $this->logger->log(3, "replacing all line endings with \\r\\n in $dest"); + return preg_replace("/\r\n|\n\r|\r|\n/", "\r\n", $contents); } } -?>PEAR-1.9.5/PEAR/Validator/PECL.php0000644000076500000240000000412012466347403015356 0ustar tyraelstaff * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a5 */ @@ -34515,7 +34625,7 @@ class PEAR_Validator_PECL extends PEAR_Validate return $ret; } } -?>PEAR-1.9.5/PEAR/Autoloader.php0000644000076500000240000001456112466347403015017 0ustar tyraelstaffPEAR-1.9.5/PEAR/Autoloader.php0000644000076500000240000001453012540043166015003 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader * @since File available since Release 0.1 * @deprecated File deprecated in Release 1.4.0a1 @@ -34733,7 +34842,7 @@ class PEAR_Autoloader extends PEAR overload("PEAR_Autoloader"); ?> -PEAR-1.9.5/PEAR/Builder.php0000644000076500000240000004060412466347403014303 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 * @@ -34798,9 +34906,9 @@ class PEAR_Builder extends PEAR_Common * * @access public */ - function PEAR_Builder(&$ui) + function __construct(&$ui) { - parent::PEAR_Common(); + parent::__construct(); $this->setFrontendObject($ui); } @@ -35222,7 +35330,7 @@ class PEAR_Builder extends PEAR_Common return PEAR_Common::log($level, $msg); } } -PEAR-1.9.5/PEAR/ChannelFile.php0000644000076500000240000014326212466347403015071 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -35418,7 +35525,7 @@ class PEAR_ChannelFile */ var $_isValid = false; - function PEAR_ChannelFile() + function __construct() { $this->_stack = new PEAR_ErrorStack('PEAR_ChannelFile'); $this->_stack->setErrorMessageTemplate($this->_getErrorMessage()); @@ -36780,7 +36887,8 @@ class PEAR_ChannelFile return time(); } -}PEAR-1.9.5/PEAR/Command.php0000644000076500000240000003055112466347403014273 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -37193,7 +37300,7 @@ class PEAR_Command return false; } // }}} -}PEAR-1.9.5/PEAR/Common.php0000644000076500000240000006217012466347403014147 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1.0 * @deprecated File deprecated since Release 1.4.0a1 @@ -37360,9 +37466,9 @@ class PEAR_Common extends PEAR * * @access public */ - function PEAR_Common() + function __construct() { - parent::PEAR(); + parent::__construct(); $this->config = &PEAR_Config::singleton(); $this->debug = $this->config->get('verbose'); } @@ -38029,7 +38135,8 @@ class PEAR_Common extends PEAR } require_once 'PEAR/Config.php'; -require_once 'PEAR/PackageFile.php';PEAR-1.9.5/PEAR/Config.php0000644000076500000240000020417312466347403014125 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -38623,10 +38729,10 @@ class PEAR_Config extends PEAR * * @see PEAR_Config::singleton */ - function PEAR_Config($user_file = '', $system_file = '', $ftp_file = false, + function __construct($user_file = '', $system_file = '', $ftp_file = false, $strict = true) { - $this->PEAR(); + parent::__construct(); PEAR_Installer_Role::initializeConfig($this); $sl = DIRECTORY_SEPARATOR; if (empty($user_file)) { @@ -40122,7 +40228,7 @@ class PEAR_Config extends PEAR } } } -PEAR-1.9.5/PEAR/DependencyDB.php0000644000076500000240000005661512466347403015212 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -40884,7 +40989,7 @@ class PEAR_DependencyDB ); } } -}PEAR-1.9.5/PEAR/Dependency2.php0000644000076500000240000014243112466347403015056 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -40968,7 +41072,7 @@ class PEAR_Dependency2 * @param array format of PEAR_Registry::parsedPackageName() * @param int installation state (one of PEAR_VALIDATE_*) */ - function PEAR_Dependency2(&$config, $installoptions, $package, + function __construct(&$config, $installoptions, $package, $state = PEAR_VALIDATE_INSTALLING) { $this->_config = &$config; @@ -42242,7 +42346,7 @@ class PEAR_Dependency2 $this->_currentPackage, true))); } } -PEAR-1.9.5/PEAR/Downloader.php0000644000076500000240000020174312466347403015016 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.0 */ @@ -42389,22 +42492,26 @@ class PEAR_Downloader extends PEAR_Common * @param array * @param PEAR_Config */ - function PEAR_Downloader(&$ui, $options, &$config) + function __construct($ui = null, $options = array(), $config = null) { - parent::PEAR_Common(); + parent::__construct(); $this->_options = $options; - $this->config = &$config; - $this->_preferredState = $this->config->get('preferred_state'); + if ($config !== null) { + $this->config = &$config; + $this->_preferredState = $this->config->get('preferred_state'); + } $this->ui = &$ui; if (!$this->_preferredState) { // don't inadvertantly use a non-set preferred_state $this->_preferredState = null; } - if (isset($this->_options['installroot'])) { - $this->config->setInstallRoot($this->_options['installroot']); + if ($config !== null) { + if (isset($this->_options['installroot'])) { + $this->config->setInstallRoot($this->_options['installroot']); + } + $this->_registry = &$config->getRegistry(); } - $this->_registry = &$config->getRegistry(); if (isset($this->_options['alldeps']) || isset($this->_options['onlyreqdeps'])) { $this->_installed = $this->_registry->listAllPackages(); @@ -44007,7 +44114,8 @@ class PEAR_Downloader extends PEAR_Common } return $dest_file; } -}PEAR-1.9.5/PEAR/ErrorStack.php0000644000076500000240000010210312466347403014765 0ustar tyraelstaff * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR_ErrorStack */ @@ -44146,7 +44253,6 @@ define('PEAR_ERRORSTACK_ERR_OBJTOSTRING', 2); * @category Debugging * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR_ErrorStack */ class PEAR_ErrorStack { @@ -44203,43 +44309,43 @@ class PEAR_ErrorStack { * @access protected */ var $_contextCallback = false; - + /** * If set to a valid callback, this will be called every time an error * is pushed onto the stack. The return value will be used to determine * whether to allow an error to be pushed or logged. - * + * * The return value must be one an PEAR_ERRORSTACK_* constant * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG * @var false|string|array * @access protected */ var $_errorCallback = array(); - + /** * PEAR::Log object for logging errors * @var false|Log * @access protected */ var $_logger = false; - + /** * Error messages - designed to be overridden * @var array * @abstract */ var $_errorMsgs = array(); - + /** * Set up a new error stack - * + * * @param string $package name of the package this error stack represents * @param callback $msgCallback callback used for error message generation * @param callback $contextCallback callback used for context generation, * defaults to {@link getFileLine()} * @param boolean $throwPEAR_Error */ - function PEAR_ErrorStack($package, $msgCallback = false, $contextCallback = false, + function __construct($package, $msgCallback = false, $contextCallback = false, $throwPEAR_Error = false) { $this->_package = $package; @@ -44992,7 +45098,7 @@ class PEAR_ErrorStack { $stack = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); $stack->pushCallback(array('PEAR_ErrorStack', '_handleError')); ?> -PEAR-1.9.5/PEAR/Exception.php0000644000076500000240000003320412466347403014651 0ustar tyraelstaffpushCallback(array('PEAR_ErrorStack', '_handleError')); * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.3 */ @@ -45380,13 +45485,7 @@ class PEAR_Exception extends Exception } return $causeMsg . $this->getTraceAsString(); } -}PEAR-1.9.5/PEAR/FixPHP5PEARWarnings.php0000644000076500000240000000022712466347403016256 0ustar tyraelstaffPEAR-1.9.5/PEAR/Frontend.php0000644000076500000240000001501512466347403014472 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -45613,7 +45711,7 @@ class PEAR_Frontend extends PEAR function userDialog($command, $prompts, $types = array(), $defaults = array()) { } -}PEAR-1.9.5/PEAR/Installer.php0000644000076500000240000021166512466347403014661 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -45731,9 +45828,9 @@ class PEAR_Installer extends PEAR_Downloader * * @access public */ - function PEAR_Installer(&$ui) + function __construct(&$ui) { - parent::PEAR_Common(); + parent::__construct($ui, array(), null); $this->setFrontendObject($ui); $this->debug = $this->config->get('verbose'); } @@ -47438,7 +47535,8 @@ class PEAR_Installer extends PEAR_Downloader } // }}} -}PEAR-1.9.5/PEAR/PackageFile.php0000644000076500000240000003677112466347403015062 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -47507,7 +47604,7 @@ class PEAR_PackageFile * @param string @tmpdir Optional temporary directory for uncompressing * files */ - function PEAR_PackageFile(&$config, $debug = false) + function __construct(&$config, $debug = false) { $this->_config = $config; $this->_debug = $debug; @@ -47929,7 +48026,8 @@ class PEAR_PackageFile $info = PEAR::raiseError("Cannot open '$info' for parsing"); return $info; } -}PEAR-1.9.5/PEAR/Packager.php0000644000076500000240000001706712466347403014441 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -48129,7 +48226,7 @@ class PEAR_Packager extends PEAR_Common return $dest_package; } -}PEAR-1.9.5/PEAR/Registry.php0000644000076500000240000022327612466347403014535 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -48262,10 +48358,10 @@ class PEAR_Registry extends PEAR * * @access public */ - function PEAR_Registry($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, + function __construct($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, $pecl_channel = false) { - parent::PEAR(); + parent::__construct(); $this->setInstallDir($pear_install_dir); $this->_pearChannel = $pear_channel; $this->_peclChannel = $pecl_channel; @@ -50514,7 +50610,8 @@ class PEAR_Registry extends PEAR } return $ret; } -}PEAR-1.9.5/PEAR/REST.php0000644000076500000240000004227112466347403013474 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -50553,7 +50649,7 @@ class PEAR_REST var $config; var $_options; - function PEAR_REST(&$config, $options = array()) + function __construct(&$config, $options = array()) { $this->config = &$config; $this->_options = $options; @@ -51004,7 +51100,7 @@ class PEAR_REST return $data; } } -PEAR-1.9.5/PEAR/RunTest.php0000644000076500000240000010700112466347403014314 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.3 */ @@ -51066,7 +51161,6 @@ class PEAR_RunTest var $ini_overwrites = array( 'output_handler=', 'open_basedir=', - 'safe_mode=0', 'disable_functions=', 'output_buffering=Off', 'display_errors=1', @@ -51089,7 +51183,7 @@ class PEAR_RunTest * An object that supports the PEAR_Common->log() signature, or null * @param PEAR_Common|null */ - function PEAR_RunTest($logger = null, $options = array()) + function __construct($logger = null, $options = array()) { if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 0); @@ -51120,19 +51214,11 @@ class PEAR_RunTest function system_with_timeout($commandline, $env = null, $stdin = null) { $data = ''; - if (version_compare(phpversion(), '5.0.0', '<')) { - $proc = proc_open($commandline, array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') - ), $pipes); - } else { - $proc = proc_open($commandline, array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') - ), $pipes, null, $env, array('suppress_errors' => true)); - } + $proc = proc_open($commandline, array( + 0 => array('pipe', 'r'), + 1 => array('pipe', 'w'), + 2 => array('pipe', 'w') + ), $pipes, null, $env, array('suppress_errors' => true)); if (!$proc) { return false; @@ -51236,12 +51322,7 @@ class PEAR_RunTest function _preparePhpBin($php, $file, $ini_settings) { $file = escapeshellarg($file); - // This was fixed in php 5.3 and is not needed after that - if (OS_WINDOWS && version_compare(PHP_VERSION, '5.3', '<')) { - $cmd = '"'.escapeshellarg($php).' '.$ini_settings.' -f ' . $file .'"'; - } else { - $cmd = $php . $ini_settings . ' -f ' . $file; - } + $cmd = $php . $ini_settings . ' -f ' . $file; return $cmd; } @@ -51643,6 +51724,11 @@ class PEAR_RunTest $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null; $data = $this->generate_diff($wanted, $output, $returns, $expectf); $res = $this->_writeLog($diff_filename, $data); + if (isset($this->_options['showdiff'])) { + $this->_logger->log(0, "========DIFF========"); + $this->_logger->log(0, $data); + $this->_logger->log(0, "========DONE========"); + } if (PEAR::isError($res)) { return $res; } @@ -51986,7 +52072,7 @@ $text } } } -PEAR-1.9.5/PEAR/Validate.php0000644000076500000240000005277412466347403014461 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -52614,7 +52699,7 @@ class PEAR_Validate { return true; } -}PEAR-1.9.5/PEAR/XMLParser.php0000644000076500000240000001571712466347403014541 0ustar tyraelstaffencoding = 'UTF-8'; } - if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') { - $data = utf8_decode($data); - $this->encoding = 'ISO-8859-1'; - } - $xp = xml_parser_create($this->encoding); xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0); xml_set_object($xp, $this); @@ -52866,7 +52945,7 @@ class PEAR_XMLParser { $this->_dataStack[$this->_depth] .= $cdata; } -}PEAR-1.9.5/scripts/pear.bat0000755000076500000240000001036112466347403014563 0ustar tyraelstaff@ECHO OFF +}PEAR-1.9.5/scripts/pear.bat0000755000076500000240000001036112540043166014553 0ustar tyraelstaff@ECHO OFF REM ---------------------------------------------------------------------- REM PHP version 5 @@ -52976,7 +53055,7 @@ GOTO END :RUN "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END -@ECHO ONPEAR-1.9.5/scripts/peardev.bat0000644000076500000240000001113712466347403015261 0ustar tyraelstaff@ECHO OFF +@ECHO ONPEAR-1.9.5/scripts/peardev.bat0000644000076500000240000001113712540043166015251 0ustar tyraelstaff@ECHO OFF REM ---------------------------------------------------------------------- REM PHP version 5 @@ -53090,7 +53169,7 @@ GOTO END :RUN "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d memory_limit="-1" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d open_basedir="" -d output_buffering=1 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END -@ECHO ONPEAR-1.9.5/scripts/pecl.bat0000644000076500000240000001103012466347403014546 0ustar tyraelstaff@ECHO OFF +@ECHO ONPEAR-1.9.5/scripts/pecl.bat0000644000076500000240000001103012540043166014536 0ustar tyraelstaff@ECHO OFF REM ---------------------------------------------------------------------- REM PHP version 5 @@ -53204,7 +53283,7 @@ GOTO END :RUN "%PHP_PEAR_PHP_BIN%" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END -@ECHO ONPEAR-1.9.5/scripts/pear.sh0000755000076500000240000000140412466347403014425 0ustar tyraelstaff#!/bin/sh +@ECHO ONPEAR-1.9.5/scripts/pear.sh0000755000076500000240000000140412540043166014415 0ustar tyraelstaff#!/bin/sh # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then @@ -53232,7 +53311,7 @@ else fi exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@" -PEAR-1.9.5/scripts/peardev.sh0000755000076500000240000000143112466347403015124 0ustar tyraelstaff#!/bin/sh +PEAR-1.9.5/scripts/peardev.sh0000755000076500000240000000143112540043166015114 0ustar tyraelstaff#!/bin/sh # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then @@ -53260,7 +53339,7 @@ else fi exec $PHP -d date.timezone=UTC -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d variables_order=EGPCS -d auto_append_file="" $INCDIR/pearcmd.php "$@" -PEAR-1.9.5/scripts/pecl.sh0000755000076500000240000000130512466347403014421 0ustar tyraelstaff#!/bin/sh +PEAR-1.9.5/scripts/pecl.sh0000755000076500000240000000130512540043166014411 0ustar tyraelstaff#!/bin/sh # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then @@ -53288,7 +53367,7 @@ else fi exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@" -PEAR-1.9.5/scripts/pearcmd.php0000644000076500000240000003636412466347403015300 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR */ @@ -53325,9 +53403,7 @@ if ('@include_path@ ' != '@'.'include_path'.'@ ') { $raw = true; } @ini_set('allow_url_fopen', true); -if (!ini_get('safe_mode')) { - @set_time_limit(0); -} +@set_time_limit(0); ob_implicit_flush(true); @ini_set('track_errors', true); @ini_set('html_errors', false); @@ -53370,18 +53446,14 @@ $opts = $options[0]; $fetype = 'CLI'; if ($progname == 'gpear' || $progname == 'pear-gtk') { - $fetype = 'Gtk'; + $fetype = 'Gtk2'; } else { foreach ($opts as $opt) { if ($opt[0] == 'G') { - $fetype = 'Gtk'; + $fetype = 'Gtk2'; } } } -//Check if Gtk and PHP >= 5.1.0 -if ($fetype == 'Gtk' && version_compare(phpversion(), '5.1.0', '>=')) { - $fetype = 'Gtk2'; -} $pear_user_config = ''; $pear_system_config = ''; @@ -53425,14 +53497,6 @@ if (PEAR::isError($config)) { $_PEAR_PHPDIR = $config->get('php_dir'); $ui->setConfig($config); PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError")); -if (ini_get('safe_mode')) { - $ui->outputData( - 'WARNING: running in safe mode requires that all files ' . - 'created be the same uid as the current script. ' . - 'PHP reports this script is uid: ' . @getmyuid() . - ', and current user is: ' . @get_current_user() - ); -} $verbose = $config->get("verbose"); $cmdopts = array(); @@ -53555,7 +53619,7 @@ if (empty($command) && ($store_user_config || $store_system_config)) { exit; } -if ($fetype == 'Gtk' || $fetype == 'Gtk2') { +if ($fetype == 'Gtk2') { if (!$config->validConfiguration()) { PEAR::raiseError( "CRITICAL ERROR: no existing valid configuration files found in " . @@ -53750,26 +53814,26 @@ function cmdHelp($command) */ function error_handler($errno, $errmsg, $file, $line, $vars) { - if ((defined('E_STRICT') - && $errno & E_STRICT) - || (defined('E_DEPRECATED') - && $errno & E_DEPRECATED) + if ($errno & E_STRICT + || $errno & E_DEPRECATED || !error_reporting() ) { - if (defined('E_STRICT') && $errno & E_STRICT) { + if ($errno & E_STRICT) { return; // E_STRICT } - if (defined('E_DEPRECATED') && $errno & E_DEPRECATED) { + if ($errno & E_DEPRECATED) { return; // E_DEPRECATED } - if ($GLOBALS['config']->get('verbose') < 4) { + if (isset($GLOBALS['config']) && $GLOBALS['config']->get('verbose') < 4) { return false; // @silenced error, show all if debug is high enough } } $errortype = array ( + E_DEPRECATED => 'Deprecated Warning', E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", + E_STRICT => 'Strict Warning', E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", @@ -53800,7 +53864,7 @@ function error_handler($errno, $errmsg, $file, $line, $vars) * End: */ // vim600:syn=php -PEAR-1.9.5/scripts/peclcmd.php0000644000076500000240000000202212466347403015254 0ustar tyraelstaff * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR */ @@ -53843,7 +53906,7 @@ require_once 'pearcmd.php'; // vim600:syn=php ?> -PEAR-1.9.5/LICENSE0000644000076500000240000000270512466347403012462 0ustar tyraelstaffCopyright (c) 1997-2009, +PEAR-1.9.5/LICENSE0000644000076500000240000000270512540043166012452 0ustar tyraelstaffCopyright (c) 1997-2009, Stig Bakken , Gregory Beaver , Helgi Þormar Þorbjörnsson , @@ -53870,7 +53933,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -PEAR-1.9.5/INSTALL0000644000076500000240000000417512466347403012511 0ustar tyraelstaffPEAR - The PEAR Installer +PEAR-1.9.5/INSTALL0000644000076500000240000000417012540043166012474 0ustar tyraelstaffPEAR - The PEAR Installer ========================= Installing the PEAR Installer. @@ -53922,8 +53985,7 @@ a public mailing list devoted to support for PEAR packages and installation- related issues. Happy PHPing, we hope PEAR will be a great tool for your development work! - -$Id$PEAR-1.9.5/package.dtd0000644000076500000240000000647712466347403013557 0ustar tyraelstaff - Docs For Class Structures_Graph - - - - -
-

Class Structures_Graph

- - -
-
Description
- -
- -

The Structures_Graph class represents a graph data structure.

-

A Graph is a data structure composed by a set of nodes, connected by arcs. Graphs may either be directed or undirected. In a directed graph, arcs are directional, and can be traveled only one way. In an undirected graph, arcs are bidirectional, and can be traveled both ways.

- -

- Located in /Structures/Graph.php (line 56) -

- - -

-	
-			
-
- - - - -
-
Method Summary
- -
-
- -
- Structures_Graph - Structures_Graph - ([boolean $directed = true]) -
- -
- void - addNode - (Structures_Graph_Node &$newNode) -
- -
- array - &getNodes - () -
- -
- boolean - isDirected - () -
- -
- void - removeNode - (Structures_Graph_Node &$node) -
-
-
-
- - - -
-
Methods
- -
- - -
- -
- Constructor Structures_Graph (line 76) -
- - -

Constructor

-
    -
  • access: public
  • -
- -
- Structures_Graph - - Structures_Graph - - ([boolean $directed = true]) -
- -
    -
  • - boolean - $directed: Set to true if the graph is directed. Set to false if it is not directed. (Optional, defaults to true)
  • -
- - -
- -
- -
- addNode (line 102) -
- - -

Add a Node to the Graph

-
    -
  • access: public
  • -
- -
- void - - addNode - - (Structures_Graph_Node &$newNode) -
- - - - -
- -
- -
- getNodes (line 151) -
- - -

Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.

- - -
- array - - &getNodes - - () -
- - - -
- -
- -
- isDirected (line 89) -
- - -

Return true if a graph is directed

-
    -
  • return: true if the graph is directed
  • -
  • access: public
  • -
- -
- boolean - - isDirected - - () -
- - - -
- -
- -
- removeNode (line 138) -
- - -

Remove a Node from the Graph

-
    -
  • access: public
  • -
  • todo: This is unimplemented
  • -
- -
- void - - removeNode - - (Structures_Graph_Node &$node) -
- - - - -
- -
-
- -

- Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by phpDocumentor 1.2.3 -

-
-Structures_Graph-1.0.4/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html0000644000076600000240000000741011461440275032540 0ustar bbieberstaff - - - - - Docs For Class Structures_Graph_Manipulator_AcyclicTest - - - - -
-

Class Structures_Graph_Manipulator_AcyclicTest

- - -
-
Description
- -
- -

The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator which tests whether a graph contains a cycle.

-

The definition of an acyclic graph used in this manipulator is that of a DAG. The graph must be directed, or else it is considered cyclic, even when there are no arcs.

- -

- Located in /Structures/Graph/Manipulator/AcyclicTest.php (line 55) -

- - -

-	
-			
-
- - - - -
-
Method Summary
- -
-
- -
- boolean - isAcyclic - (mixed &$graph) -
-
-
-
- - - -
-
Methods
- -
- - -
- -
- isAcyclic (line 126) -
- - -

isAcyclic returns true if a graph contains no cycles, false otherwise.

-
    -
  • return: true iff graph is acyclic
  • -
  • access: public
  • -
- -
- boolean - - isAcyclic - - (mixed &$graph) -
- - - -
- -
-
- -

- Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by phpDocumentor 1.2.3 -

-
-././@LongLink000 145 0003736 LStructures_Graph-1.0.4/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.htmlStructures_Graph-1.0.4/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.htm0000644000076600000240000001014111461440275033623 0ustar bbieberstaff - - - - - Docs For Class Structures_Graph_Manipulator_TopologicalSorter - - - - -
-

Class Structures_Graph_Manipulator_TopologicalSorter

- - -
-
Description
- -
- -

The Structures_Graph_Manipulator_TopologicalSorter is a manipulator which is able to return the set of nodes in a graph, sorted by topological order.

-

A graph may only be sorted topologically iff it's a DAG. You can test it with the Structures_Graph_Manipulator_AcyclicTest.

- -

- Located in /Structures/Graph/Manipulator/TopologicalSorter.php (line 58) -

- - -

-	
-			
-
- - - - -
-
Method Summary
- -
-
- -
- array - sort - (mixed &$graph) -
-
-
-
- - - -
-
Methods
- -
- - -
- -
- sort (line 133) -
- - -

sort returns the graph's nodes, sorted by topological order.

-

The result is an array with as many entries as topological levels. Each entry in this array is an array of nodes within the given topological level.

-
    -
  • return: The graph's nodes, sorted by topological order.
  • -
  • access: public
  • -
- -
- array - - sort - - (mixed &$graph) -
- - - -
- -
-
- -

- Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by phpDocumentor 1.2.3 -

-
-Structures_Graph-1.0.4/docs/html/Structures_Graph/Structures_Graph_Node.html0000644000076600000240000005007111461440275026644 0ustar bbieberstaff - - - - - Docs For Class Structures_Graph_Node - - - - -
-

Class Structures_Graph_Node

- - -
-
Description
- -
- -

The Structures_Graph_Node class represents a Node that can be member of a graph node set.

-

A graph node can contain data. Under this API, the node contains default data, and key index data. It behaves, thus, both as a regular data node, and as a dictionary (or associative array) node.

Regular data is accessed via getData and setData. Key indexed data is accessed via getMetadata and setMetadata.

- -

- Located in /Structures/Graph/Node.php (line 57) -

- - -

-	
-			
-
- - - - -
-
Method Summary
- -
-
- -
- Structures_Graph_Node - Structures_Graph_Node - () -
- -
- boolean - connectsTo - (mixed &$target) -
- -
- void - connectTo - (Structures_Graph &$destinationNode) -
- -
- mixed - &getData - () -
- - - -
- mixed - &getMetadata - (string $key, [boolean $nullIfNonexistent = false]) -
- -
- array - getNeighbours - () -
- -
- integer - inDegree - () -
- -
- boolean - metadataKeyExists - (string $key) -
- -
- integer - outDegree - () -
- -
- mixed - setData - (mixed $data) -
- -
- void - setGraph - (Structures_Graph &$graph) -
- -
- void - setMetadata - (string $key, mixed $data) -
- -
- void - unsetMetadata - (string $key) -
-
-
-
- - - -
-
Methods
- -
- - -
- -
- Constructor Structures_Graph_Node (line 78) -
- - -

Constructor

-
    -
  • access: public
  • -
- -
- Structures_Graph_Node - - Structures_Graph_Node - - () -
- - - -
- -
- -
- connectsTo (line 275) -
- - -

Test wether this node has an arc to the target node

-
    -
  • return: True if the two nodes are connected
  • -
  • access: public
  • -
- -
- boolean - - connectsTo - - (mixed &$target) -
- - - -
- -
- -
- connectTo (line 236) -
- - -

Connect this node to another one.

-

If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.

-
    -
  • access: public
  • -
- -
- void - - connectTo - - (Structures_Graph &$destinationNode) -
- - - - -
- -
- -
- getData (line 119) -
- - -

Node data getter.

-

Each graph node can contain a reference to one variable. This is the getter for that reference.

-
    -
  • return: Data stored in node
  • -
  • access: public
  • -
- -
- mixed - - &getData - - () -
- - - -
- -
- -
- getGraph (line 90) -
- - -

Node graph getter

-
    -
  • return: Graph where node is stored
  • -
  • access: public
  • -
- -
- Structures_Graph - - &getGraph - - () -
- - - -
- -
- -
- getMetadata (line 171) -
- - -

Node metadata getter

-

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method gets the data under the given key. If the key does not exist, an error will be thrown, so testing using metadataKeyExists might be needed.

- - -
- mixed - - &getMetadata - - (string $key, [boolean $nullIfNonexistent = false]) -
- -
    -
  • - string - $key: Key
  • -
  • - boolean - $nullIfNonexistent: nullIfNonexistent (defaults to false).
  • -
- - -
- -
- -
- getNeighbours (line 262) -
- - -

Return nodes connected to this one.

-
    -
  • return: Array of nodes
  • -
  • access: public
  • -
- -
- array - - getNeighbours - - () -
- - - -
- -
- -
- inDegree (line 309) -
- - -

Calculate the in degree of the node.

-

The indegree for a node is the number of arcs entering the node. For non directed graphs, the indegree is equal to the outdegree.

-
    -
  • return: In degree of the node
  • -
  • access: public
  • -
- -
- integer - - inDegree - - () -
- - - -
- -
- -
- metadataKeyExists (line 151) -
- - -

Test for existence of metadata under a given key.

-

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method tests whether a given metadata key exists for this node.

-
    -
  • access: public
  • -
- -
- boolean - - metadataKeyExists - - (string $key) -
- -
    -
  • - string - $key: Key to test
  • -
- - -
- -
- -
- outDegree (line 333) -
- - -

Calculate the out degree of the node.

-

The outdegree for a node is the number of arcs exiting the node. For non directed graphs, the outdegree is always equal to the indegree.

-
    -
  • return: Out degree of the node
  • -
  • access: public
  • -
- -
- integer - - outDegree - - () -
- - - -
- -
- -
- setData (line 134) -
- - -

Node data setter

-

Each graph node can contain a reference to one variable. This is the setter for that reference.

-
    -
  • return: Data to store in node
  • -
  • access: public
  • -
- -
- mixed - - setData - - (mixed $data) -
- - - -
- -
- -
- setGraph (line 104) -
- - -

Node graph setter. This method should not be called directly. Use Graph::addNode instead.

- - -
- void - - setGraph - - (Structures_Graph &$graph) -
- - - - -
- -
- -
- setMetadata (line 214) -
- - -

Node metadata setter

-

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method stores data under the given key. If the key already exists, previously stored data is discarded.

-
    -
  • access: public
  • -
- -
- void - - setMetadata - - (string $key, mixed $data) -
- -
    -
  • - string - $key: Key
  • -
  • - mixed - $data: Data
  • -
- - -
- -
- -
- unsetMetadata (line 196) -
- - -

Delete metadata by key

-

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method removes any data that might be stored under the provided key. If the key does not exist, no error is thrown, so it is safe using this method without testing for key existence.

-
    -
  • access: public
  • -
- -
- void - - unsetMetadata - - (string $key) -
- -
    -
  • - string - $key: Key
  • -
- - -
- -
-
- -

- Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by phpDocumentor 1.2.3 -

-
-Structures_Graph-1.0.4/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html0000644000076600000240000001110611461440275030376 0ustar bbieberstaff - - - - - Structures_Graph Tutorial - - - - -
- -

Structures_Graph Tutorial

-

A first tour of graph datastructure manipulation

-

Introduction

Structures_Graph is a package for creating and manipulating graph datastructures. A graph is a set of objects, called nodes, connected by arcs. When used as a datastructure, usually nodes contain data, and arcs represent relationships between nodes. When arcs have a direction, and can be travelled only one way, graphs are said to be directed. When arcs have no direction, and can always be travelled both ways, graphs are said to be non directed.

-

Structures_Graph provides an object oriented API to create and directly query a graph, as well as a set of Manipulator classes to extract information from the graph.

-

Creating a Graph

Creating a graph is done using the simple constructor: -

-require_once 'Structures/Graph.php';
-
-$directedGraph =& new Structures_Graph(true);
-$nonDirectedGraph =& new Structures_Graph(false);
-    
- and passing the constructor a flag telling it whether the graph should be directed. A directed graph will always be directed during its lifetime. It's a permanent characteristic.

-

To fill out the graph, we'll need to create some nodes, and then call Graph::addNode. -

-require_once 'Structures/Graph/Node.php';
-
-$nodeOne =& new Structures_Graph_Node();
-$nodeTwo =& new Structures_Graph_Node();
-$nodeThree =& new Structures_Graph_Node();
-
-$directedGraph->addNode(&$nodeOne);
-$directedGraph->addNode(&$nodeTwo);
-$directedGraph->addNode(&$nodeThree);
-    
- and then setup the arcs: -
-$nodeOne->connectTo($nodeTwo);
-$nodeOne->connectTo($nodeThree);
-    
- Note that arcs can only be created after the nodes have been inserted into the graph.

-

Associating Data

Graphs are only useful as datastructures if they can hold data. Structure_Graph stores data in nodes. Each node contains a setter and a getter for its data. -

-$nodeOne->setData("Node One's Data is a String");
-$nodeTwo->setData(1976);
-$nodeThree->setData('Some other string');
-
-print("NodeTwo's Data is an integer: " . $nodeTwo->getData());
-    

-

Structure_Graph nodes can also store metadata, alongside with the main data. Metadata differs from regular data just because it is stored under a key, making it possible to store more than one data reference per node. The metadata getter and setter need the key to perform the operation: -

-$nodeOne->setMetadata('example key', "Node One's Sample Metadata");
-print("Metadata stored under key 'example key' in node one: " . $nodeOne->getMetadata('example key'));
-$nodeOne->unsetMetadata('example key');
-    

-

Querying a Graph

Structures_Graph provides for basic querying of the graph: -

-// Nodes are able to calculate their indegree and outdegree
-print("NodeOne's inDegree: " . $nodeOne->inDegree());
-print("NodeOne's outDegree: " . $nodeOne->outDegree());
-
-// and naturally, nodes can report on their arcs
-$arcs = $nodeOne->getNeighbours();
-for ($i=0;$i<sizeof($arcs);$i++) {
-    print("NodeOne has an arc to " . $arcs[$i]->getData());
-}
-    

- - -

- Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by phpDocumentor 1.2.3 -

-
-././@LongLink000 144 0003735 LStructures_Graph-1.0.4/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.htmlStructures_Graph-1.0.4/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html0000644000076600000240000000746211461440275033555 0ustar bbieberstaff - - - - - Docs for page AcyclicTest.php - - - - -
-

/Structures/Graph/Manipulator/AcyclicTest.php

- - -
-
Description
- -
- -

This file contains the definition of the Structures_Graph_Manipulator_AcyclicTest graph manipulator.

- - -
-
- - -
-
Classes
- -
- - - - - - - - - -
ClassDescription
- Structures_Graph_Manipulator_AcyclicTest - - The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator which tests whether a graph contains a cycle. -
-
-
- - -
-
Includes
- -
- -
- -
- - require_once - ('PEAR.php') - (line 35) - -
- - - -
- -
- -
- - require_once - ('Structures/Graph.php') - (line 37) - -
- - - -
- -
- -
- - require_once - ('Structures/Graph/Node.php') - (line 39) - -
- - - -
-
-
- - - - -

- Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by phpDocumentor 1.2.3 -

-
-././@LongLink000 152 0003734 LStructures_Graph-1.0.4/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.htmlStructures_Graph-1.0.4/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_ph0000644000076600000240000001052511461440275033670 0ustar bbieberstaff - - - - - Docs for page TopologicalSorter.php - - - - -
-

/Structures/Graph/Manipulator/TopologicalSorter.php

- - -
-
Description
- -
- -

This file contains the definition of the Structures_Graph_Manipulator_TopologicalSorter class.

- - -
-
- - -
-
Classes
- -
- - - - - - - - - -
ClassDescription
- Structures_Graph_Manipulator_TopologicalSorter - - The Structures_Graph_Manipulator_TopologicalSorter is a manipulator which is able to return the set of nodes in a graph, sorted by topological order. -
-
-
- - -
-
Includes
- -
- -
- -
- - require_once - ('PEAR.php') - (line 35) - -
- - - -
- -
- -
- - require_once - ('Structures/Graph.php') - (line 37) - -
- - - -
- -
- -
- - require_once - ('Structures/Graph/Node.php') - (line 39) - -
- - - -
- -
- -
- - require_once - ('Structures/Graph/Manipulator/AcyclicTest.php') - (line 41) - -
- - - -
-
-
- - - - -

- Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by phpDocumentor 1.2.3 -

-
-Structures_Graph-1.0.4/docs/html/Structures_Graph/_Structures_Graph_Node_php.html0000644000076600000240000000635611461440275027661 0ustar bbieberstaff - - - - - Docs for page Node.php - - - - -
-

/Structures/Graph/Node.php

- - -
-
Description
- -
- -

This file contains the definition of the Structures_Graph_Node class

- - -
-
- - -
-
Classes
- -
- - - - - - - - - -
ClassDescription
- Structures_Graph_Node - - The Structures_Graph_Node class represents a Node that can be member of a graph node set. -
-
-
- - -
-
Includes
- -
- -
- -
- - require_once - ('PEAR.php') - (line 35) - -
- - - -
- -
- -
- - require_once - ('Structures/Graph.php') - (line 37) - -
- - - -
-
-
- - - - -

- Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by phpDocumentor 1.2.3 -

-
-Structures_Graph-1.0.4/docs/html/Structures_Graph/_Structures_Graph_php.html0000644000076600000240000001020711461440275026702 0ustar bbieberstaff - - - - - Docs for page Graph.php - - - - -
-

/Structures/Graph.php

- - -
-
Description
- -
- -

The Graph.php file contains the definition of the Structures_Graph class

- - -
-
- - -
-
Classes
- -
- - - - - - - - - -
ClassDescription
- Structures_Graph - - The Structures_Graph class represents a graph data structure. -
-
-
- - -
-
Includes
- -
- -
- -
- - require_once - ('Structures/Graph/Node.php') - (line 37) - -
- - -

Graph Node

- -
- -
- -
- - require_once - ('PEAR.php') - (line 35) - -
- - -

PEAR base classes

- -
-
-
- - -
-
Constants
- -
- -
- -
- - STRUCTURES_GRAPH_ERROR_GENERIC = 100 - (line 40) - -
- - - - -
-
-
- - - -

- Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by phpDocumentor 1.2.3 -

-
-Structures_Graph-1.0.4/docs/html/classtrees_Structures_Graph.html0000644000076600000240000000253011461440275024620 0ustar bbieberstaff - - - - - - - - - - - -

- -

-

Root class Structures_Graph

- - -

Root class Structures_Graph_Manipulator_AcyclicTest

- - -

Root class Structures_Graph_Manipulator_TopologicalSorter

- - -

Root class Structures_Graph_Node

- - -

- Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by phpDocumentor 1.2.3 -

- -Structures_Graph-1.0.4/docs/html/elementindex.html0000644000076600000240000003640711461440275021557 0ustar bbieberstaff - - - - - - - - - - -

Full index

-

Package indexes

- -
-
- a - c - g - i - m - n - o - r - s - t - u -
- - -
-
a
- -
-
-
-
- addNode -
-
- -
Add a Node to the Graph
-
-
- AcyclicTest.php -
-
-
AcyclicTest.php in AcyclicTest.php
-
-
- -
-
c
- -
-
-
-
- connectsTo -
-
- -
Test wether this node has an arc to the target node
-
-
- connectTo -
-
- -
Connect this node to another one.
-
-
- -
-
g
- -
-
-
-
- getData -
-
- -
Node data getter.
-
-
- getGraph -
-
- -
Node graph getter
-
-
- getMetadata -
-
- -
Node metadata getter
-
-
- getNeighbours -
-
- -
Return nodes connected to this one.
-
-
- getNodes -
-
- -
Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.
-
-
- Graph.php -
-
-
Graph.php in Graph.php
-
-
- -
-
i
- -
-
-
-
- inDegree -
-
- -
Calculate the in degree of the node.
-
-
- isAcyclic -
-
- -
isAcyclic returns true if a graph contains no cycles, false otherwise.
-
-
- isDirected -
-
- -
Return true if a graph is directed
-
-
- -
-
m
- -
-
-
-
- metadataKeyExists -
-
- -
Test for existence of metadata under a given key.
-
-
- -
-
n
- -
-
-
-
- Node.php -
-
-
Node.php in Node.php
-
-
- -
-
o
- -
-
-
-
- outDegree -
-
- -
Calculate the out degree of the node.
-
-
- -
-
r
- -
-
-
-
- removeNode -
-
- -
Remove a Node from the Graph
-
-
- -
-
s
- -
-
-
-
- setData -
-
- -
Node data setter
-
-
- setGraph -
-
- -
Node graph setter. This method should not be called directly. Use Graph::addNode instead.
-
-
- setMetadata -
-
- -
Node metadata setter
-
-
- sort -
-
- -
sort returns the graph's nodes, sorted by topological order.
-
-
- Structures_Graph -
-
-
Structures_Graph in Graph.php
-
The Structures_Graph class represents a graph data structure.
-
-
- Structures_Graph -
-
- -
Constructor
-
-
- STRUCTURES_GRAPH_ERROR_GENERIC -
-
- -
-
- Structures_Graph_Manipulator_AcyclicTest -
-
- -
The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator which tests whether a graph contains a cycle.
-
-
- Structures_Graph_Manipulator_TopologicalSorter -
-
- -
The Structures_Graph_Manipulator_TopologicalSorter is a manipulator which is able to return the set of nodes in a graph, sorted by topological order.
-
-
- Structures_Graph_Node -
-
- -
Constructor
-
-
- Structures_Graph_Node -
-
- -
The Structures_Graph_Node class represents a Node that can be member of a graph node set.
-
-
- -
-
t
- -
-
-
-
- TopologicalSorter.php -
-
-
TopologicalSorter.php in TopologicalSorter.php
-
-
- -
-
u
- -
-
-
-
- unsetMetadata -
-
- -
Delete metadata by key
-
-
- -
- a - c - g - i - m - n - o - r - s - t - u -
-Structures_Graph-1.0.4/docs/html/elementindex_Structures_Graph.html0000644000076600000240000003712011461440275025134 0ustar bbieberstaff - - - - - - - - - - -

[Structures_Graph] element index

-All elements -
-
- a - c - g - i - m - n - o - r - s - t - u -
- - -
-
a
- -
-
-
-
- addNode -
-
- -
Add a Node to the Graph
-
-
- AcyclicTest.php -
-
-
AcyclicTest.php in AcyclicTest.php
-
-
- -
-
c
- -
-
-
-
- connectsTo -
-
- -
Test wether this node has an arc to the target node
-
-
- connectTo -
-
- -
Connect this node to another one.
-
-
- -
-
g
- -
-
-
-
- getData -
-
- -
Node data getter.
-
-
- getGraph -
-
- -
Node graph getter
-
-
- getMetadata -
-
- -
Node metadata getter
-
-
- getNeighbours -
-
- -
Return nodes connected to this one.
-
-
- getNodes -
-
- -
Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.
-
-
- Graph.php -
-
-
Graph.php in Graph.php
-
-
- -
-
i
- -
-
-
-
- inDegree -
-
- -
Calculate the in degree of the node.
-
-
- isAcyclic -
-
- -
isAcyclic returns true if a graph contains no cycles, false otherwise.
-
-
- isDirected -
-
- -
Return true if a graph is directed
-
-
- -
-
m
- -
-
-
-
- metadataKeyExists -
-
- -
Test for existence of metadata under a given key.
-
-
- -
-
n
- -
-
-
-
- Node.php -
-
-
Node.php in Node.php
-
-
- -
-
o
- -
-
-
-
- outDegree -
-
- -
Calculate the out degree of the node.
-
-
- -
-
r
- -
-
-
-
- removeNode -
-
- -
Remove a Node from the Graph
-
-
- -
-
s
- -
-
-
-
- setData -
-
- -
Node data setter
-
-
- setGraph -
-
- -
Node graph setter. This method should not be called directly. Use Graph::addNode instead.
-
-
- setMetadata -
-
- -
Node metadata setter
-
-
- sort -
-
- -
sort returns the graph's nodes, sorted by topological order.
-
-
- Structures_Graph -
-
-
Structures_Graph in Graph.php
-
The Structures_Graph class represents a graph data structure.
-
-
- Structures_Graph -
-
- -
Constructor
-
-
- STRUCTURES_GRAPH_ERROR_GENERIC -
-
- -
-
- Structures_Graph_Manipulator_AcyclicTest -
-
- -
The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator which tests whether a graph contains a cycle.
-
-
- Structures_Graph_Manipulator_TopologicalSorter -
-
- -
The Structures_Graph_Manipulator_TopologicalSorter is a manipulator which is able to return the set of nodes in a graph, sorted by topological order.
-
-
- Structures_Graph_Node -
-
- -
Constructor
-
-
- Structures_Graph_Node -
-
- -
The Structures_Graph_Node class represents a Node that can be member of a graph node set.
-
-
- -
-
t
- -
-
-
-
- TopologicalSorter.php -
-
-
TopologicalSorter.php in TopologicalSorter.php
-
-
- -
-
u
- -
-
-
-
- unsetMetadata -
-
- -
Delete metadata by key
-
-
- -
- a - c - g - i - m - n - o - r - s - t - u -
-Structures_Graph-1.0.4/docs/html/errors.html0000644000076600000240000000132511461440275020401 0ustar bbieberstaff - - - - - phpDocumentor Parser Errors and Warnings - - - - - Post-parsing
-

- Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by phpDocumentor 1.2.3 -

- -Structures_Graph-1.0.4/docs/html/index.html0000644000076600000240000000176111461440275020200 0ustar bbieberstaff - - - - - Structures_Graph Documentation - - - - - - - - - - - <H2>Frame Alert</H2> - <P>This document is designed to be viewed using the frames feature. - If you see this message, you are using a non-frame-capable web client.</P> - - -Structures_Graph-1.0.4/docs/html/li_Structures_Graph.html0000644000076600000240000000476011461440275023063 0ustar bbieberstaff - - - - - - - - - -
Structures_Graph
- -

phpDocumentor v 1.2.3

- -Structures_Graph-1.0.4/docs/html/packages.html0000644000076600000240000000164111461440275020644 0ustar bbieberstaff - - - - - - - - - - - - - Structures_Graph-1.0.4/docs/html/todolist.html0000644000076600000240000000155411461440275020732 0ustar bbieberstaff - - - - - Todo List - - - - -

Todo List

-

Structures_Graph

-

Structures_Graph::removeNode()

-
    -
  • This is unimplemented
  • -
-

- Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by phpDocumentor 1.2.3 -

- -Structures_Graph-1.0.4/docs/tutorials/Structures_Graph/Structures_Graph.pkg0000644000076600000240000000771411461440275026604 0ustar bbieberstaff +Structures_Graph-1.1.0/docs/tutorials/Structures_Graph/Structures_Graph.pkg0000644000175000001440000000771412473724255026703 0ustar cweiskeusers Structures_Graph Tutorial A first tour of graph datastructure manipulation @@ -93665,15 +91116,7 @@ for ($i=0;$i -Structures_Graph-1.0.4/docs/generate.sh0000755000076600000240000000055511461440275017370 0ustar bbieberstaff#!/bin/sh -(cd ..; tar czf docs/arch.tgz "{arch}") -rm -Rf "../{arch}" -rm -Rf ./html -mkdir -p ./html -phpdoc --directory ../Structures,./tutorials --target ./html --title "Structures_Graph Documentation" --output "HTML:frames" --defaultpackagename structures_graph --defaultcategoryname structures --pear -(cd ..; tar --absolute-names -xzf docs/arch.tgz) -#rm arch.tgz -Structures_Graph-1.0.4/Structures/Graph/Manipulator/AcyclicTest.php0000644000076600000240000001316011461440275024742 0ustar bbieberstaff_graph->getNodes(); foreach (array_keys($graphNodes) as $key) { @@ -93750,9 +91192,9 @@ class Structures_Graph_Manipulator_AcyclicTest { /* _isAcyclic {{{ */ /** - * @access private - */ - function _isAcyclic(&$graph) { + * Check if the graph is acyclic + */ + protected static function _isAcyclic(&$graph) { // Mark every node as not visited $nodes =& $graph->getNodes(); $nodeKeys = array_keys($nodes); @@ -93796,9 +91238,8 @@ class Structures_Graph_Manipulator_AcyclicTest { * isAcyclic returns true if a graph contains no cycles, false otherwise. * * @return boolean true iff graph is acyclic - * @access public */ - function isAcyclic(&$graph) { + public static function isAcyclic(&$graph) { // We only test graphs if (!is_a($graph, 'Structures_Graph')) return Pear::raiseError('Structures_Graph_Manipulator_AcyclicTest::isAcyclic received an object that is not a Structures_Graph', STRUCTURES_GRAPH_ERROR_GENERIC); if (!$graph->isDirected()) return false; // Only directed graphs may be acyclic @@ -93809,7 +91250,7 @@ class Structures_Graph_Manipulator_AcyclicTest { } /* }}} */ ?> -Structures_Graph-1.0.4/Structures/Graph/Manipulator/TopologicalSorter.php0000644000076600000240000001504611461440275026213 0ustar bbieberstaff - * @copyright (c) 2004 by Srgio Carvalho - * @see Structures_Graph_Manipulator_AcyclicTest - * @package Structures_Graph + * @author Srgio Carvalho + * @copyright (c) 2004 by Srgio Carvalho + * @see Structures_Graph_Manipulator_AcyclicTest + * @package Structures_Graph */ -class Structures_Graph_Manipulator_TopologicalSorter { - /* _nonVisitedInDegree {{{ */ +class Structures_Graph_Manipulator_TopologicalSorter +{ /** - * - * This is a variant of Structures_Graph::inDegree which does - * not count nodes marked as visited. - * - * @access private - * @return integer Number of non-visited nodes that link to this one - */ - function _nonVisitedInDegree(&$node) { + * This is a variant of Structures_Graph::inDegree which does + * not count nodes marked as visited. + * + * @param object $node Node to check + * + * @return integer Number of non-visited nodes that link to this one + */ + protected static function _nonVisitedInDegree(&$node) + { $result = 0; $graphNodes =& $node->_graph->getNodes(); foreach (array_keys($graphNodes) as $key) { - if ((!$graphNodes[$key]->getMetadata('topological-sort-visited')) && $graphNodes[$key]->connectsTo($node)) $result++; + if ((!$graphNodes[$key]->getMetadata('topological-sort-visited')) + && $graphNodes[$key]->connectsTo($node) + ) { + $result++; + } } return $result; } - /* }}} */ - /* _sort {{{ */ /** - * @access private - */ - function _sort(&$graph) { + * Sort implementation + * + * @param object $graph Graph to sort + * + * @return void + */ + protected static function _sort(&$graph) + { // Mark every node as not visited $nodes =& $graph->getNodes(); $nodeKeys = array_keys($nodes); $refGenerator = array(); - foreach($nodeKeys as $key) { + foreach ($nodeKeys as $key) { $refGenerator[] = false; - $nodes[$key]->setMetadata('topological-sort-visited', $refGenerator[sizeof($refGenerator) - 1]); + $nodes[$key]->setMetadata( + 'topological-sort-visited', + $refGenerator[sizeof($refGenerator) - 1] + ); } // Iteratively peel off leaf nodes @@ -93906,43 +91350,61 @@ class Structures_Graph_Manipulator_TopologicalSorter { do { // Find out which nodes are leafs (excluding visited nodes) $leafNodes = array(); - foreach($nodeKeys as $key) { - if ((!$nodes[$key]->getMetadata('topological-sort-visited')) && Structures_Graph_Manipulator_TopologicalSorter::_nonVisitedInDegree($nodes[$key]) == 0) { + foreach ($nodeKeys as $key) { + if ((!$nodes[$key]->getMetadata('topological-sort-visited')) + && static::_nonVisitedInDegree($nodes[$key]) == 0 + ) { $leafNodes[] =& $nodes[$key]; } } // Mark leafs as visited $refGenerator[] = $topologicalLevel; - for ($i=sizeof($leafNodes) - 1; $i>=0; $i--) { + for ($i = sizeof($leafNodes) - 1; $i>=0; $i--) { $visited =& $leafNodes[$i]->getMetadata('topological-sort-visited'); $visited = true; $leafNodes[$i]->setMetadata('topological-sort-visited', $visited); - $leafNodes[$i]->setMetadata('topological-sort-level', $refGenerator[sizeof($refGenerator) - 1]); + $leafNodes[$i]->setMetadata( + 'topological-sort-level', + $refGenerator[sizeof($refGenerator) - 1] + ); } $topologicalLevel++; } while (sizeof($leafNodes) > 0); // Cleanup visited marks - foreach($nodeKeys as $key) $nodes[$key]->unsetMetadata('topological-sort-visited'); + foreach ($nodeKeys as $key) { + $nodes[$key]->unsetMetadata('topological-sort-visited'); + } } - /* }}} */ - /* sort {{{ */ /** - * - * sort returns the graph's nodes, sorted by topological order. - * - * The result is an array with - * as many entries as topological levels. Each entry in this array is an array of nodes within - * the given topological level. - * - * @return array The graph's nodes, sorted by topological order. - * @access public - */ - function sort(&$graph) { + * Sort returns the graph's nodes, sorted by topological order. + * + * The result is an array with as many entries as topological levels. + * Each entry in this array is an array of nodes within + * the given topological level. + * + * @param object $graph Graph to sort + * + * @return array The graph's nodes, sorted by topological order. + */ + public static function sort(&$graph) + { // We only sort graphs - if (!is_a($graph, 'Structures_Graph')) return Pear::raiseError('Structures_Graph_Manipulator_TopologicalSorter::sort received an object that is not a Structures_Graph', STRUCTURES_GRAPH_ERROR_GENERIC); - if (!Structures_Graph_Manipulator_AcyclicTest::isAcyclic($graph)) return Pear::raiseError('Structures_Graph_Manipulator_TopologicalSorter::sort received an graph that has cycles', STRUCTURES_GRAPH_ERROR_GENERIC); + if (!is_a($graph, 'Structures_Graph')) { + return Pear::raiseError( + 'Structures_Graph_Manipulator_TopologicalSorter::sort received' + . ' an object that is not a Structures_Graph', + STRUCTURES_GRAPH_ERROR_GENERIC + ); + } + if (!Structures_Graph_Manipulator_AcyclicTest::isAcyclic($graph)) { + return Pear::raiseError( + 'Structures_Graph_Manipulator_TopologicalSorter::sort' + . ' received an graph that has cycles', + STRUCTURES_GRAPH_ERROR_GENERIC + ); + } Structures_Graph_Manipulator_TopologicalSorter::_sort($graph); $result = array(); @@ -93950,19 +91412,21 @@ class Structures_Graph_Manipulator_TopologicalSorter { // Fill out result array $nodes =& $graph->getNodes(); $nodeKeys = array_keys($nodes); - foreach($nodeKeys as $key) { - if (!array_key_exists($nodes[$key]->getMetadata('topological-sort-level'), $result)) $result[$nodes[$key]->getMetadata('topological-sort-level')] = array(); - $result[$nodes[$key]->getMetadata('topological-sort-level')][] =& $nodes[$key]; + foreach ($nodeKeys as $key) { + if (!array_key_exists($nodes[$key]->getMetadata('topological-sort-level'), $result)) { + $result[$nodes[$key]->getMetadata('topological-sort-level')] + = array(); + } + $result[$nodes[$key]->getMetadata('topological-sort-level')][] + =& $nodes[$key]; $nodes[$key]->unsetMetadata('topological-sort-level'); } return $result; } - /* }}} */ } -/* }}} */ ?> -Structures_Graph-1.0.4/Structures/Graph/Node.php0000644000076600000240000002545011461440275021132 0ustar bbieberstaff_data =& $data; } /* }}} */ @@ -94177,7 +91641,7 @@ class Structures_Graph_Node { * @param mixed Data * @access public */ - function setMetadata($key, $data) { + function setMetadata($key, &$data) { $this->_metadata[$key] =& $data; } /* }}} */ @@ -94304,7 +91768,7 @@ class Structures_Graph_Node { /* }}} */ } ?> -Structures_Graph-1.0.4/Structures/Graph.php0000644000076600000240000001316311461440275020243 0ustar bbieberstaff - * @copyright (c) 2004 by Srgio Carvalho - * @package Structures_Graph + * @author Srgio Carvalho + * @copyright (c) 2004 by Srgio Carvalho + * @package Structures_Graph */ /* }}} */ -class Structures_Graph { - /* fields {{{ */ +class Structures_Graph +{ /** + * List of node objects in this graph * @access private */ var $_nodes = array(); + /** + * If the graph is directed or not * @access private */ var $_directed = false; - /* }}} */ - /* Constructor {{{ */ + /** - * - * Constructor - * - * @param boolean Set to true if the graph is directed. Set to false if it is not directed. (Optional, defaults to true) - * @access public - */ - function Structures_Graph($directed = true) { + * Constructor + * + * @param boolean $directed Set to true if the graph is directed. + * Set to false if it is not directed. + */ + public function __construct($directed = true) + { $this->_directed = $directed; } - /* }}} */ - /* isDirected {{{ */ /** - * - * Return true if a graph is directed - * - * @return boolean true if the graph is directed - * @access public - */ - function isDirected() { + * Old constructor (PHP4-style; kept for BC with extending classes) + * + * @param boolean $directed Set to true if the graph is directed. + * Set to false if it is not directed. + * + * @return void + */ + public function Structures_Graph($directed = true) + { + $this->__construct($directed); + } + + /** + * Return true if a graph is directed + * + * @return boolean true if the graph is directed + */ + public function isDirected() + { return (boolean) $this->_directed; } - /* }}} */ - /* addNode {{{ */ /** - * - * Add a Node to the Graph - * - * @param Structures_Graph_Node The node to be added. - * @access public - */ - function addNode(&$newNode) { + * Add a Node to the Graph + * + * @param Structures_Graph_Node $newNode The node to be added. + * + * @return void + */ + public function addNode(&$newNode) + { // We only add nodes - if (!is_a($newNode, 'Structures_Graph_Node')) return Pear::raiseError('Structures_Graph::addNode received an object that is not a Structures_Graph_Node', STRUCTURES_GRAPH_ERROR_GENERIC); - // Graphs are node *sets*, so duplicates are forbidden. We allow nodes that are exactly equal, but disallow equal references. - foreach($this->_nodes as $key => $node) { + if (!is_a($newNode, 'Structures_Graph_Node')) { + return Pear::raiseError( + 'Structures_Graph::addNode received an object that is not' + . ' a Structures_Graph_Node', + STRUCTURES_GRAPH_ERROR_GENERIC + ); + } + + //Graphs are node *sets*, so duplicates are forbidden. + // We allow nodes that are exactly equal, but disallow equal references. + foreach ($this->_nodes as $key => $node) { /* - ZE1 equality operators choke on the recursive cycle introduced by the _graph field in the Node object. - So, we'll check references the hard way (change $this->_nodes[$key] and check if the change reflects in + ZE1 equality operators choke on the recursive cycle introduced + by the _graph field in the Node object. + So, we'll check references the hard way + (change $this->_nodes[$key] and check if the change reflects in $node) */ $savedData = $this->_nodes[$key]; @@ -94420,45 +91902,69 @@ class Structures_Graph { $this->_nodes[$key] = true; if ($node === true) { $this->_nodes[$key] = false; - if ($node === false) $referenceIsEqualFlag = true; + if ($node === false) { + $referenceIsEqualFlag = true; + } } $this->_nodes[$key] = $savedData; - if ($referenceIsEqualFlag) return Pear::raiseError('Structures_Graph::addNode received an object that is a duplicate for this dataset', STRUCTURES_GRAPH_ERROR_GENERIC); + if ($referenceIsEqualFlag) { + return Pear::raiseError( + 'Structures_Graph::addNode received an object that is' + . ' a duplicate for this dataset', + STRUCTURES_GRAPH_ERROR_GENERIC + ); + } } $this->_nodes[] =& $newNode; $newNode->setGraph($this); } - /* }}} */ - /* removeNode (unimplemented) {{{ */ /** - * - * Remove a Node from the Graph - * - * @todo This is unimplemented - * @param Structures_Graph_Node The node to be removed from the graph - * @access public - */ - function removeNode(&$node) { + * Remove a Node from the Graph + * + * @param Structures_Graph_Node $node The node to be removed from the graph + * + * @return void + * @todo This is unimplemented + */ + public function removeNode(&$node) + { } - /* }}} */ - /* getNodes {{{ */ /** - * - * Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted. - * - * @access public - * @see Structures_Graph_Manipulator_TopologicalSorter - * @return array The set of nodes in this graph - */ - function &getNodes() { + * Return the node set, in no particular order. + * For ordered node sets, use a Graph Manipulator insted. + * + * @return array The set of nodes in this graph + * @see Structures_Graph_Manipulator_TopologicalSorter + */ + public function &getNodes() + { return $this->_nodes; } - /* }}} */ } ?> -Structures_Graph-1.0.4/tests/testCase/BasicGraph.php0000644000076600000240000002161111461440275021734 0ustar bbieberstaffaddTestFiles($dir); + + return $suite; + } +} +Structures_Graph-1.1.0/tests/BasicGraphTest.php0000644000175000001440000002155212473724255021124 0ustar cweiskeusers_graph = new Structures_Graph(); $data = 1; $node = new Structures_Graph_Node(); - $node->setData(&$data); + $node->setData($data); $this->_graph->addNode($node); $data = 2; $dataInNode =& $this->_graph->getNodes(); $dataInNode =& $dataInNode[0]; $dataInNode =& $dataInNode->getData(); - $this->assertTrue($data === $dataInNode); + $this->assertEquals($data, $dataInNode); } function test_metadata_references() { $this->_graph = new Structures_Graph(); $data = 1; $node = new Structures_Graph_Node(); - $node->setMetadata('5', &$data); + $node->setMetadata('5', $data); $data = 2; $dataInNode =& $node->getMetadata('5'); - $this->assertTrue($data === $dataInNode); + $this->assertEquals($data, $dataInNode); } function test_metadata_key_exists() { @@ -94629,632 +92134,460 @@ class BasicGraph extends PHPUnit_Framework_TestCase } } ?> -Structures_Graph-1.0.4/tests/AllTests.php0000644000076600000240000000641411461440275017715 0ustar bbieberstaff - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/XML_Util - * @since 1.2.0a1 - */ +class TopologicalSorterTest extends PHPUnit_Framework_TestCase +{ + public function testSort() + { + $graph = new Structures_Graph(); + + $name1 = 'node1'; + $node1 = new Structures_Graph_Node(); + $node1->setData($name1); + $graph->addNode($node1); + + $name11 = 'node11'; + $node11 = new Structures_Graph_Node(); + $node11->setData($name11); + $graph->addNode($node11); + $node1->connectTo($node11); + + $name12 = 'node12'; + $node12 = new Structures_Graph_Node(); + $node12->setData($name12); + $graph->addNode($node12); + $node1->connectTo($node12); + + $name121 = 'node121'; + $node121 = new Structures_Graph_Node(); + $node121->setData($name121); + $graph->addNode($node121); + $node12->connectTo($node121); + + $name2 = 'node2'; + $node2 = new Structures_Graph_Node(); + $node2->setData($name2); + $graph->addNode($node2); + + $name21 = 'node21'; + $node21 = new Structures_Graph_Node(); + $node21->setData($name21); + $graph->addNode($node21); + $node2->connectTo($node21); + + $nodes = Structures_Graph_Manipulator_TopologicalSorter::sort($graph); + $this->assertCount(2, $nodes[0]); + $this->assertEquals('node1', $nodes[0][0]->getData()); + $this->assertEquals('node2', $nodes[0][1]->getData()); + + $this->assertCount(3, $nodes[1]); + $this->assertEquals('node11', $nodes[1][0]->getData()); + $this->assertEquals('node12', $nodes[1][1]->getData()); + $this->assertEquals('node21', $nodes[1][2]->getData()); + + $this->assertCount(1, $nodes[2]); + $this->assertEquals('node121', $nodes[2][0]->getData()); + } +} +?> +Structures_Graph-1.1.0/tests/AcyclicTestTest.php0000644000175000001440000000243412473724255021326 0ustar cweiskeusersaddNode($node1); -/** - * Check PHP version... PhpUnit v3+ requires at least PHP v5.1.4 - */ -if (version_compare(PHP_VERSION, "5.1.4") < 0) { - // Cannnot run test suites - echo 'Cannot run test suite via PhpUnit... requires at least PHP v5.1.4.' . PHP_EOL; - echo 'Use "pear run-tests -p xml_util" to run the PHPT tests directly.' . PHP_EOL; - exit(1); -} + $node2 = new Structures_Graph_Node(); + $graph->addNode($node2); + $node1->connectTo($node2); + $node3 = new Structures_Graph_Node(); + $graph->addNode($node3); + $node2->connectTo($node3); -/** - * Derive the "main" method name - * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD - * to make this usage meet the PEAR CS... we cannot rename it here. - */ -if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Structures_Graph_AllTests::main'); -} + $node3->connectTo($node1); + $this->assertFalse( + Structures_Graph_Manipulator_AcyclicTest::isAcyclic($graph), + 'Graph is cyclic' + ); + } -/* - * Files needed by PhpUnit - */ -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; -require_once 'PHPUnit/Extensions/PhptTestSuite.php'; + public function testIsAcyclicTrue() + { + $graph = new Structures_Graph(); + $node1 = new Structures_Graph_Node(); + $graph->addNode($node1); -/* - * You must add each additional class-level test suite file here - */ -require_once dirname(__FILE__).'/testCase/BasicGraph.php'; + $node2 = new Structures_Graph_Node(); + $graph->addNode($node2); + $node1->connectTo($node2); + + $node3 = new Structures_Graph_Node(); + $graph->addNode($node3); + $node2->connectTo($node3); + + $this->assertTrue( + Structures_Graph_Manipulator_AcyclicTest::isAcyclic($graph), + 'Graph is acyclic' + ); + } +} +?> +Structures_Graph-1.1.0/tests/BasicGraphTest.php0000644000175000001440000002155212473724255021124 0ustar cweiskeusers | +// +-----------------------------------------------------------------------------+ +// +require_once dirname(__FILE__) . '/helper.inc'; /** - * Master Unit Test Suite class for Structures_Graph - * - * This top-level test suite class organizes - * all class test suite files, - * so that the full suite can be run - * by PhpUnit or via "pear run-tests -up Structures_Graph". - * - * @category Structures - * @package Structures_Graph - * @subpackage UnitTesting - * @author Chuck Burgess - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version Release: @package_version@ - * @link http://pear.php.net/package/XML_Util - * @since 1.2.0a1 + * @access private */ -class Structures_Graph_AllTests +class BasicGraph extends PHPUnit_Framework_TestCase { + var $_graph = null; - /** - * Launches the TextUI test runner - * - * @return void - * @uses PHPUnit_TextUI_TestRunner - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); + function test_create_graph() { + $this->_graph = new Structures_Graph(); + $this->assertTrue(is_a($this->_graph, 'Structures_Graph')); } + function test_add_node() { + $this->_graph = new Structures_Graph(); + $data = 1; + $node = new Structures_Graph_Node($data); + $this->_graph->addNode($node); + $node = new Structures_Graph_Node($data); + $this->_graph->addNode($node); + $node = new Structures_Graph_Node($data); + $this->_graph->addNode($node); + } - /** - * Adds all class test suites into the master suite - * - * @return PHPUnit_Framework_TestSuite a master test suite - * containing all class test suites - * @uses PHPUnit_Framework_TestSuite - */ - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite( - 'Structures_Graph Full Suite of Unit Tests'); + function test_connect_node() { + $this->_graph = new Structures_Graph(); + $data = 1; + $node1 = new Structures_Graph_Node($data); + $node2 = new Structures_Graph_Node($data); + $this->_graph->addNode($node1); + $this->_graph->addNode($node2); + $node1->connectTo($node2); - /* - * You must add each additional class-level test suite name here - */ - $suite->addTestSuite('BasicGraph'); + $node =& $this->_graph->getNodes(); + $node =& $node[0]; + $node = $node->getNeighbours(); + $node =& $node[0]; + /* + ZE1 == and === operators fail on $node,$node2 because of the recursion introduced + by the _graph field in the Node object. So, we'll use the stupid method for reference + testing + */ + $node = true; + $this->assertTrue($node2); + $node = false; + $this->assertFalse($node2); + } - return $suite; + function test_data_references() { + $this->_graph = new Structures_Graph(); + $data = 1; + $node = new Structures_Graph_Node(); + $node->setData($data); + $this->_graph->addNode($node); + $data = 2; + $dataInNode =& $this->_graph->getNodes(); + $dataInNode =& $dataInNode[0]; + $dataInNode =& $dataInNode->getData(); + $this->assertEquals($data, $dataInNode); } -} -/** - * Call the main method if this file is executed directly - * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD - * to make this usage meet the PEAR CS... we cannot rename it here. - */ -if (PHPUnit_MAIN_METHOD == 'Structures_Graph_AllTests::main') { - Structures_Graph_AllTests::main(); -} + function test_metadata_references() { + $this->_graph = new Structures_Graph(); + $data = 1; + $node = new Structures_Graph_Node(); + $node->setMetadata('5', $data); + $data = 2; + $dataInNode =& $node->getMetadata('5'); + $this->assertEquals($data, $dataInNode); + } + + function test_metadata_key_exists() { + $this->_graph = new Structures_Graph(); + $data = 1; + $node = new Structures_Graph_Node(); + $node->setMetadata('5', $data); + $this->assertTrue($node->metadataKeyExists('5')); + $this->assertFalse($node->metadataKeyExists('1')); + } -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + function test_directed_degree() { + $this->_graph = new Structures_Graph(true); + $node = array(); + $node[] = new Structures_Graph_Node(); + $node[] = new Structures_Graph_Node(); + $node[] = new Structures_Graph_Node(); + $this->_graph->addNode($node[0]); + $this->_graph->addNode($node[1]); + $this->_graph->addNode($node[2]); + $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 0 arcs'); + $this->assertEquals(0, $node[1]->inDegree(), 'inDegree test failed for node 1 with 0 arcs'); + $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 0 arcs'); + $this->assertEquals(0, $node[0]->outDegree(), 'outDegree test failed for node 0 with 0 arcs'); + $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 0 arcs'); + $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 0 arcs'); + $node[0]->connectTo($node[1]); + $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 1 arc'); + $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 1 arc'); + $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 1 arc'); + $this->assertEquals(1, $node[0]->outDegree(), 'outDegree test failed for node 0 with 1 arc'); + $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 1 arc'); + $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 1 arc'); + $node[0]->connectTo($node[2]); + $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 2 arcs'); + $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 2 arcs'); + $this->assertEquals(1, $node[2]->inDegree(), 'inDegree test failed for node 2 with 2 arcs'); + $this->assertEquals(2, $node[0]->outDegree(), 'outDegree test failed for node 0 with 2 arcs'); + $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 2 arcs'); + $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 2 arcs'); + } + + function test_undirected_degree() { + $this->_graph = new Structures_Graph(false); + $node = array(); + $node[] = new Structures_Graph_Node(); + $node[] = new Structures_Graph_Node(); + $node[] = new Structures_Graph_Node(); + $this->_graph->addNode($node[0]); + $this->_graph->addNode($node[1]); + $this->_graph->addNode($node[2]); + $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 0 arcs'); + $this->assertEquals(0, $node[1]->inDegree(), 'inDegree test failed for node 1 with 0 arcs'); + $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 0 arcs'); + $this->assertEquals(0, $node[0]->outDegree(), 'outDegree test failed for node 0 with 0 arcs'); + $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 0 arcs'); + $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 0 arcs'); + $node[0]->connectTo($node[1]); + $this->assertEquals(1, $node[0]->inDegree(), 'inDegree test failed for node 0 with 1 arc'); + $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 1 arc'); + $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 1 arc'); + $this->assertEquals(1, $node[0]->outDegree(), 'outDegree test failed for node 0 with 1 arc'); + $this->assertEquals(1, $node[1]->outDegree(), 'outDegree test failed for node 1 with 1 arc'); + $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 1 arc'); + $node[0]->connectTo($node[2]); + $this->assertEquals(2, $node[0]->inDegree(), 'inDegree test failed for node 0 with 2 arcs'); + $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 2 arcs'); + $this->assertEquals(1, $node[2]->inDegree(), 'inDegree test failed for node 2 with 2 arcs'); + $this->assertEquals(2, $node[0]->outDegree(), 'outDegree test failed for node 0 with 2 arcs'); + $this->assertEquals(1, $node[1]->outDegree(), 'outDegree test failed for node 1 with 2 arcs'); + $this->assertEquals(1, $node[2]->outDegree(), 'outDegree test failed for node 2 with 2 arcs'); + } +} ?> -Structures_Graph-1.0.4/LICENSE0000644000076600000240000006347611461440275015327 0ustar bbieberstaff GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 +Structures_Graph-1.1.0/tests/helper.inc0000644000175000001440000000052512473724255017517 0ustar cweiskeusers Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - - * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -95778,13 +93110,11 @@ class System $path_elements[] = dirname($program); $program = basename($program); } else { - // Honor safe mode - if (!ini_get('safe_mode') || !$path = ini_get('safe_mode_exec_dir')) { - $path = getenv('PATH'); - if (!$path) { - $path = getenv('Path'); // some OSes are just stupid enough to do this - } + $path = getenv('PATH'); + if (!$path) { + $path = getenv('Path'); // some OSes are just stupid enough to do this } + $path_elements = explode(PATH_SEPARATOR, $path); } @@ -95796,17 +93126,14 @@ class System if (strpos($program, '.') !== false) { array_unshift($exe_suffixes, ''); } - // is_executable() is not available on windows for PHP4 - $pear_is_executable = (function_exists('is_executable')) ? 'is_executable' : 'is_file'; } else { $exe_suffixes = array(''); - $pear_is_executable = 'is_executable'; } foreach ($exe_suffixes as $suff) { foreach ($path_elements as $dir) { $file = $dir . DIRECTORY_SEPARATOR . $program . $suff; - if (@$pear_is_executable($file)) { + if (is_executable($file)) { return $file; } } @@ -95901,9 +93228,6 @@ class System return $files; } }, ", ' and & */ define('XML_UTIL_ENTITIES_XML', 1); /** - * replace only required XML entitites + * Replace only required XML entitites * This setting will replace <, " and & */ define('XML_UTIL_ENTITIES_XML_REQUIRED', 2); /** - * replace HTML entitites + * Replace HTML entitites * @link http://www.php.net/htmlentities */ define('XML_UTIL_ENTITIES_HTML', 3); @@ -96013,33 +93337,30 @@ define('XML_UTIL_COLLAPSE_ALL', 1); define('XML_UTIL_COLLAPSE_XHTML_ONLY', 2); /** - * utility class for working with XML documents + * Utility class for working with XML documents * - * @category XML * @package XML_Util * @author Stephan Schmidt * @copyright 2003-2008 Stephan Schmidt * @license http://opensource.org/licenses/bsd-license New BSD License - * @version Release: 1.2.3 + * @version Release: 1.3.0 * @link http://pear.php.net/package/XML_Util */ class XML_Util { /** - * return API version + * Return API version * * @return string $version API version - * @access public - * @static */ - function apiVersion() + public static function apiVersion() { return '1.1'; } /** - * replace XML entities + * Replace XML entities * * With the optional second parameter, you may select, which * entities should be replaced. @@ -96074,27 +93395,33 @@ class XML_Util * by the htmlentities() function * * @return string string with replaced chars - * @access public - * @static - * @see reverseEntities() + * @see reverseEntities() */ - function replaceEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML, - $encoding = 'ISO-8859-1') - { + public static function replaceEntities( + $string, $replaceEntities = XML_UTIL_ENTITIES_XML, $encoding = 'ISO-8859-1' + ) { switch ($replaceEntities) { case XML_UTIL_ENTITIES_XML: - return strtr($string, array( - '&' => '&', - '>' => '>', - '<' => '<', - '"' => '"', - '\'' => ''' )); + return strtr( + $string, + array( + '&' => '&', + '>' => '>', + '<' => '<', + '"' => '"', + '\'' => ''' + ) + ); break; case XML_UTIL_ENTITIES_XML_REQUIRED: - return strtr($string, array( - '&' => '&', - '<' => '<', - '"' => '"' )); + return strtr( + $string, + array( + '&' => '&', + '<' => '<', + '"' => '"' + ) + ); break; case XML_UTIL_ENTITIES_HTML: return htmlentities($string, ENT_COMPAT, $encoding); @@ -96104,7 +93431,7 @@ class XML_Util } /** - * reverse XML entities + * Reverse XML entities * * With the optional second parameter, you may select, which * entities should be reversed. @@ -96140,27 +93467,33 @@ class XML_Util * by the html_entity_decode() function * * @return string string with replaced chars - * @access public - * @static - * @see replaceEntities() + * @see replaceEntities() */ - function reverseEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML, - $encoding = 'ISO-8859-1') - { + public static function reverseEntities( + $string, $replaceEntities = XML_UTIL_ENTITIES_XML, $encoding = 'ISO-8859-1' + ) { switch ($replaceEntities) { case XML_UTIL_ENTITIES_XML: - return strtr($string, array( - '&' => '&', - '>' => '>', - '<' => '<', - '"' => '"', - ''' => '\'' )); + return strtr( + $string, + array( + '&' => '&', + '>' => '>', + '<' => '<', + '"' => '"', + ''' => '\'' + ) + ); break; case XML_UTIL_ENTITIES_XML_REQUIRED: - return strtr($string, array( - '&' => '&', - '<' => '<', - '"' => '"' )); + return strtr( + $string, + array( + '&' => '&', + '<' => '<', + '"' => '"' + ) + ); break; case XML_UTIL_ENTITIES_HTML: return html_entity_decode($string, ENT_COMPAT, $encoding); @@ -96170,7 +93503,7 @@ class XML_Util } /** - * build an xml declaration + * Build an xml declaration * * * require_once 'XML/Util.php'; @@ -96184,13 +93517,12 @@ class XML_Util * @param bool $standalone document is standalone (or not) * * @return string xml declaration - * @access public - * @static - * @uses attributesToString() to serialize the attributes of the XML declaration + * @uses attributesToString() to serialize the attributes of the + * XML declaration */ - function getXMLDeclaration($version = '1.0', $encoding = null, - $standalone = null) - { + public static function getXMLDeclaration( + $version = '1.0', $encoding = null, $standalone = null + ) { $attributes = array( 'version' => $version, ); @@ -96203,12 +93535,14 @@ class XML_Util $attributes['standalone'] = $standalone ? 'yes' : 'no'; } - return sprintf('', - XML_Util::attributesToString($attributes, false)); + return sprintf( + '', + XML_Util::attributesToString($attributes, false) + ); } /** - * build a document type declaration + * Build a document type declaration * * * require_once 'XML/Util.php'; @@ -96223,12 +93557,11 @@ class XML_Util * @param string $internalDtd internal dtd entries * * @return string doctype declaration - * @access public - * @static - * @since 0.2 + * @since 0.2 */ - function getDocTypeDeclaration($root, $uri = null, $internalDtd = null) - { + public static function getDocTypeDeclaration( + $root, $uri = null, $internalDtd = null + ) { if (is_array($uri)) { $ref = sprintf(' PUBLIC "%s" "%s"', $uri['id'], $uri['uri']); } elseif (!empty($uri)) { @@ -96245,7 +93578,7 @@ class XML_Util } /** - * create string representation of an attribute list + * Create string representation of an attribute list * * * require_once 'XML/Util.php'; @@ -96277,14 +93610,13 @@ class XML_Util * XML_UTIL_ENTITIES_HTML) * * @return string string representation of the attributes - * @access public - * @static - * @uses replaceEntities() to replace XML entities in attribute values - * @todo allow sort also to be an options array + * @uses replaceEntities() to replace XML entities in attribute values + * @todo allow sort also to be an options array */ - function attributesToString($attributes, $sort = true, $multiline = false, - $indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML) - { + public static function attributesToString( + $attributes, $sort = true, $multiline = false, + $indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML + ) { /* * second parameter may be an array */ @@ -96312,7 +93644,7 @@ class XML_Util if ($sort) { ksort($attributes); } - if ( !$multiline || count($attributes) == 1) { + if (!$multiline || count($attributes) == 1) { foreach ($attributes as $key => $value) { if ($entities != XML_UTIL_ENTITIES_NONE) { if ($entities === XML_UTIL_CDATA_SECTION) { @@ -96348,26 +93680,23 @@ class XML_Util * or only XHTML (XML_UTIL_COLLAPSE_XHTML_ONLY) ones. * * @return string XML - * @access public - * @static - * @todo PEAR CS - unable to avoid "space after open parens" error - * in the IF branch */ - function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) + public static function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) { if ($mode == XML_UTIL_COLLAPSE_XHTML_ONLY) { return preg_replace( '/<(area|base(?:font)?|br|col|frame|hr|img|input|isindex|link|meta|' . 'param)([^>]*)><\/\\1>/s', '<\\1\\2 />', - $xml); + $xml + ); } else { return preg_replace('/<(\w+)([^>]*)><\/\\1>/s', '<\\1\\2 />', $xml); } } /** - * create a tag + * Create a tag * * This method will call XML_Util::createTagFromArray(), which * is more flexible. @@ -96398,16 +93727,15 @@ class XML_Util * @param bool $sortAttributes Whether to sort the attributes or not * * @return string XML tag - * @access public - * @static - * @see createTagFromArray() - * @uses createTagFromArray() to create the tag + * @see createTagFromArray() + * @uses createTagFromArray() to create the tag */ - function createTag($qname, $attributes = array(), $content = null, + public static function createTag( + $qname, $attributes = array(), $content = null, $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, $multiline = false, $indent = '_auto', $linebreak = "\n", - $sortAttributes = true) - { + $sortAttributes = true + ) { $tag = array( 'qname' => $qname, 'attributes' => $attributes @@ -96423,13 +93751,15 @@ class XML_Util $tag['namespaceUri'] = $namespaceUri; } - return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, - $indent, $linebreak, $sortAttributes); + return XML_Util::createTagFromArray( + $tag, $replaceEntities, $multiline, + $indent, $linebreak, $sortAttributes + ); } /** - * create a tag from an array - * this method awaits an array in the following format + * Create a tag from an array. + * This method awaits an array in the following format *
      * array(
      *     // qualified name of the tag
@@ -96478,27 +93808,31 @@ class XML_Util
      * @param bool   $sortAttributes  Whether to sort the attributes or not
      *
      * @return string XML tag
-     * @access public
-     * @static
-     * @see createTag()
+     *
+     * @see  createTag()
      * @uses attributesToString() to serialize the attributes of the tag
      * @uses splitQualifiedName() to get local part and namespace of a qualified name
      * @uses createCDataSection()
      * @uses raiseError()
      */
-    function createTagFromArray($tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES,
+    public static function createTagFromArray(
+        $tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES,
         $multiline = false, $indent = '_auto', $linebreak = "\n",
-        $sortAttributes = true)
-    {
+        $sortAttributes = true
+    ) {
         if (isset($tag['content']) && !is_scalar($tag['content'])) {
-            return XML_Util::raiseError('Supplied non-scalar value as tag content',
-            XML_UTIL_ERROR_NON_SCALAR_CONTENT);
+            return XML_Util::raiseError(
+                'Supplied non-scalar value as tag content',
+                XML_UTIL_ERROR_NON_SCALAR_CONTENT
+            );
         }
 
         if (!isset($tag['qname']) && !isset($tag['localPart'])) {
-            return XML_Util::raiseError('You must either supply a qualified name '
+            return XML_Util::raiseError(
+                'You must either supply a qualified name '
                 . '(qname) or local tag name (localPart).',
-                XML_UTIL_ERROR_NO_TAG_NAME);
+                XML_UTIL_ERROR_NO_TAG_NAME
+            );
         }
 
         // if no attributes hav been set, use empty attributes
@@ -96535,8 +93869,8 @@ class XML_Util
         if (isset($tag['namespaceUri']) && !empty($tag['namespaceUri'])) {
             // is a namespace given
             if (isset($tag['namespace']) && !empty($tag['namespace'])) {
-                $tag['attributes']['xmlns:' . $tag['namespace']] =
-                    $tag['namespaceUri'];
+                $tag['attributes']['xmlns:' . $tag['namespace']]
+                    = $tag['namespaceUri'];
             } else {
                 // define this Uri as the default namespace
                 $tag['attributes']['xmlns'] = $tag['namespaceUri'];
@@ -96551,8 +93885,10 @@ class XML_Util
         }
 
         // create attribute list
-        $attList = XML_Util::attributesToString($tag['attributes'],
-            $sortAttributes, $multiline, $indent, $linebreak);
+        $attList = XML_Util::attributesToString(
+            $tag['attributes'],
+            $sortAttributes, $multiline, $indent, $linebreak
+        );
         if (!isset($tag['content']) || (string)$tag['content'] == '') {
             $tag = sprintf('<%s%s />', $tag['qname'], $attList);
         } else {
@@ -96563,18 +93899,21 @@ class XML_Util
                 $tag['content'] = XML_Util::createCDataSection($tag['content']);
                 break;
             default:
-                $tag['content'] = XML_Util::replaceEntities($tag['content'],
-                    $replaceEntities);
+                $tag['content'] = XML_Util::replaceEntities(
+                    $tag['content'], $replaceEntities
+                );
                 break;
             }
-            $tag = sprintf('<%s%s>%s', $tag['qname'], $attList, $tag['content'],
-                $tag['qname']);
+            $tag = sprintf(
+                '<%s%s>%s', $tag['qname'], $attList, $tag['content'],
+                $tag['qname']
+            );
         }
         return $tag;
     }
 
     /**
-     * create a start element
+     * Create a start element
      *
      * 
      * require_once 'XML/Util.php';
@@ -96595,14 +93934,13 @@ class XML_Util
      * @param bool   $sortAttributes Whether to sort the attributes or not
      *
      * @return string XML start element
-     * @access public
-     * @static
-     * @see createEndElement(), createTag()
+     * @see    createEndElement(), createTag()
      */
-    function createStartElement($qname, $attributes = array(), $namespaceUri = null,
+    public static function createStartElement(
+        $qname, $attributes = array(), $namespaceUri = null,
         $multiline = false, $indent = '_auto', $linebreak = "\n",
-        $sortAttributes = true)
-    {
+        $sortAttributes = true
+    ) {
         // if no attributes hav been set, use empty attributes
         if (!isset($attributes) || !is_array($attributes)) {
             $attributes = array();
@@ -96630,14 +93968,16 @@ class XML_Util
         }
 
         // create attribute list
-        $attList = XML_Util::attributesToString($attributes, $sortAttributes,
-            $multiline, $indent, $linebreak);
+        $attList = XML_Util::attributesToString(
+            $attributes, $sortAttributes,
+            $multiline, $indent, $linebreak
+        );
         $element = sprintf('<%s%s>', $qname, $attList);
         return  $element;
     }
 
     /**
-     * create an end element
+     * Create an end element
      *
      * 
      * require_once 'XML/Util.php';
@@ -96649,18 +93989,16 @@ class XML_Util
      * @param string $qname qualified tagname (including namespace)
      *
      * @return string XML end element
-     * @access public
-     * @static
-     * @see createStartElement(), createTag()
+     * @see    createStartElement(), createTag()
      */
-    function createEndElement($qname)
+    public static function createEndElement($qname)
     {
         $element = sprintf('', $qname);
         return $element;
     }
 
     /**
-     * create an XML comment
+     * Create an XML comment
      *
      * 
      * require_once 'XML/Util.php';
@@ -96672,17 +94010,15 @@ class XML_Util
      * @param string $content content of the comment
      *
      * @return string XML comment
-     * @access public
-     * @static
      */
-    function createComment($content)
+    public static function createComment($content)
     {
         $comment = sprintf('', $content);
         return $comment;
     }
 
     /**
-     * create a CData section
+     * Create a CData section
      *
      * 
      * require_once 'XML/Util.php';
@@ -96694,18 +94030,17 @@ class XML_Util
      * @param string $data data of the CData section
      *
      * @return string CData section with content
-     * @access public
-     * @static
      */
-    function createCDataSection($data)
+    public static function createCDataSection($data)
     {
-        return sprintf('',
-            preg_replace('/\]\]>/', ']]]]>', strval($data)));
-
+        return sprintf(
+            '',
+            preg_replace('/\]\]>/', ']]]]>', strval($data))
+        );
     }
 
     /**
-     * split qualified name and return namespace and local part
+     * Split qualified name and return namespace and local part
      *
      * 
      * require_once 'XML/Util.php';
@@ -96725,10 +94060,8 @@ class XML_Util
      * @param string $defaultNs default namespace (optional)
      *
      * @return array array containing namespace and local part
-     * @access public
-     * @static
      */
-    function splitQualifiedName($qname, $defaultNs = null)
+    public static function splitQualifiedName($qname, $defaultNs = null)
     {
         if (strstr($qname, ':')) {
             $tmp = explode(':', $qname);
@@ -96744,7 +94077,7 @@ class XML_Util
     }
 
     /**
-     * check, whether string is valid XML name
+     * Check, whether string is valid XML name
      *
      * 

XML names are used for tagname, attribute names and various * other, lesser known entities.

@@ -96765,33 +94098,39 @@ class XML_Util * @param string $string string that should be checked * * @return mixed true, if string is a valid XML name, PEAR error otherwise - * @access public - * @static + * * @todo support for other charsets * @todo PEAR CS - unable to avoid 85-char limit on second preg_match */ - function isValidName($string) + public static function isValidName($string) { // check for invalid chars if (!preg_match('/^[[:alpha:]_]\\z/', $string{0})) { - return XML_Util::raiseError('XML names may only start with letter ' - . 'or underscore', XML_UTIL_ERROR_INVALID_START); + return XML_Util::raiseError( + 'XML names may only start with letter or underscore', + XML_UTIL_ERROR_INVALID_START + ); } // check for invalid chars - if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/', - $string) - ) { - return XML_Util::raiseError('XML names may only contain alphanumeric ' + $match = preg_match( + '/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?' + . '[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/', + $string + ); + if (!$match) { + return XML_Util::raiseError( + 'XML names may only contain alphanumeric ' . 'chars, period, hyphen, colon and underscores', - XML_UTIL_ERROR_INVALID_CHARS); + XML_UTIL_ERROR_INVALID_CHARS + ); } // XML name is valid return true; } /** - * replacement for XML_Util::raiseError + * Replacement for XML_Util::raiseError * * Avoids the necessity to always require * PEAR.php @@ -96800,18 +94139,16 @@ class XML_Util * @param int $code error code * * @return PEAR_Error - * @access public - * @static - * @todo PEAR CS - should this use include_once instead? + * @todo PEAR CS - should this use include_once instead? */ - function raiseError($msg, $code) + public static function raiseError($msg, $code) { - require_once 'phar://install-pear-nozlib.phar/' . 'PEAR.php'; + include_once 'phar://install-pear-nozlib.phar/' . 'PEAR.php'; return PEAR::raiseError($msg, $code); } } ?> -package.xml0000664000175000017500000003767212344563343014007 0ustar clockwerxclockwerx +package.xml0000664000175000017500000004055112474057375013066 0ustar cweiskecweiske XML_Util pear.php.net @@ -96835,11 +94172,11 @@ package.xml davey@php.net no - 2014-06-07 - + 2015-02-27 + - 1.2.3 - 1.2.0 + 1.3.0 + 1.3.0 stable @@ -96847,7 +94184,8 @@ package.xml BSD License -Bug #20293 Broken installation for 1.2.2 +* Set minimum PHP version to 5.3.0 +* Mark static methods with static keyword @@ -96872,7 +94210,7 @@ Bug #20293 Broken installation for 1.2.2 - + @@ -96880,7 +94218,7 @@ Bug #20293 Broken installation for 1.2.2 - 4.3.0 + 5.3.0 1.4.3 @@ -97292,9 +94630,25 @@ Request #19750 examples/example.php encoding Bug #20293 Broken installation for 1.2.2 + + + 1.3.0 + 1.3.0 + + + stable + stable + + 2015-02-27 + BSD License + +* Set minimum PHP version to 5.3.0 +* Mark static methods with static keyword + + -XML_Util-1.2.3/examples/example.php0000664000175000017500000002171012344563343017732 0ustar clockwerxclockwerx'; print "\n

\n"; ?> -XML_Util-1.2.3/examples/example2.php0000664000175000017500000001135312344563343020016 0ustar clockwerxclockwerx -XML_Util-1.2.3/tests/testBasic_apiVersion.phpt0000664000175000017500000000070112344563343022124 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_apiVersion.phpt0000664000175000017500000000070112474057375021213 0ustar cweiskecweiske--TEST-- XML_Util::apiVersion() basic tests --CREDITS-- Chuck Burgess @@ -97756,7 +95110,7 @@ echo XML_Util::apiVersion() . PHP_EOL; TEST: basic apiVersion() call 1.1 -XML_Util-1.2.3/tests/testBasic_attributesToString.phpt0000664000175000017500000000705712344563343023700 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_attributesToString.phpt0000664000175000017500000000705712474057375022767 0ustar cweiskecweiske--TEST-- XML_Util::attributesToString() basic tests --CREDITS-- Chuck Burgess @@ -97874,7 +95228,7 @@ TEST: replace only required XML entities TEST: replace HTML entities boo="b><z" foo="b@&r" -XML_Util-1.2.3/tests/testBasic_collapseEmptyTags.phpt0000664000175000017500000000340312344563343023447 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_collapseEmptyTags.phpt0000664000175000017500000000340312474057375022536 0ustar cweiskecweiske--TEST-- XML_Util::collapseEmptyTags() basic tests --CREDITS-- Chuck Burgess @@ -97926,7 +95280,7 @@ TEST: one empty tag, with COLLAPSE_XHTML_ONLY set TEST: one empty tag alongside non-empty tag, with COLLAPSE_XHTML_ONLY set baz -XML_Util-1.2.3/tests/testBasic_createCDataSection.phpt0000664000175000017500000000075612344563343023504 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_createCDataSection.phpt0000664000175000017500000000075612474057375022573 0ustar cweiskecweiske--TEST-- XML_Util::createCDataSection() basic tests --CREDITS-- Chuck Burgess @@ -97944,7 +95298,7 @@ echo XML_Util::createCDataSection("I am content.") . PHP_EOL; TEST: basic usage -XML_Util-1.2.3/tests/testBasic_createComment.phpt0000664000175000017500000000072712344563343022603 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_createComment.phpt0000664000175000017500000000072712474057375021672 0ustar cweiskecweiske--TEST-- XML_Util::createComment() basic tests --CREDITS-- Chuck Burgess @@ -97962,7 +95316,7 @@ echo XML_Util::createComment("I am comment.") . PHP_EOL; TEST: basic usage -XML_Util-1.2.3/tests/testBasic_createEndElement.phpt0000664000175000017500000000127012344563343023213 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_createEndElement.phpt0000664000175000017500000000127012474057375022302 0ustar cweiskecweiske--TEST-- XML_Util::createEndElement() basic tests --CREDITS-- Chuck Burgess @@ -97986,7 +95340,7 @@ TEST: basic usage (myTag) TEST: basic usage with a namespaced tag (myNs:myTag) -XML_Util-1.2.3/tests/testBasic_createStartElement.phpt0000664000175000017500000000727512344563343023615 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_createStartElement.phpt0000664000175000017500000000727512474057375022704 0ustar cweiskecweiske--TEST-- XML_Util::createStartElement() basic tests --CREDITS-- Chuck Burgess @@ -98110,7 +95464,7 @@ TEST: tag with attributes, namespace, multiline = true, indent = (2 spaces only TEST: tag with attributes, namespace, multiline = true, indent = (2 spaces only), linebreak = '^', and sortAttributes = false -XML_Util-1.2.3/tests/testBasic_createTag.phpt0000664000175000017500000001343412344563343021713 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_createTag.phpt0000664000175000017500000001343412474057375021002 0ustar cweiskecweiske--TEST-- XML_Util::createTag() basic tests --CREDITS-- Chuck Burgess @@ -98265,7 +95619,7 @@ TEST: tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = tru TEST: tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = false This is inside the tag and has < & @ > in it -XML_Util-1.2.3/tests/testBasic_createTagFromArray.phpt0000664000175000017500000002213512344563343023534 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_createTagFromArray.phpt0000664000175000017500000002213512474057375022623 0ustar cweiskecweiske--TEST-- XML_Util::createTagFromArray() basic tests --CREDITS-- Chuck Burgess @@ -98468,7 +95822,7 @@ TEST: qname is derived from localPart only TEST: namespaceUri is given, but namespace is not -XML_Util-1.2.3/tests/testBasic_getDocTypeDeclaration.phpt0000664000175000017500000000275412344563343024234 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_getDocTypeDeclaration.phpt0000664000175000017500000000275412474057375023323 0ustar cweiskecweiske--TEST-- XML_Util::getDocTypeDeclaration() basic tests --CREDITS-- Chuck Burgess @@ -98512,7 +95866,7 @@ TEST: using root and an array URI and an internal DTD entry ]> -XML_Util-1.2.3/tests/testBasic_getXmlDeclaration.phpt0000664000175000017500000000221712344563343023417 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_getXmlDeclaration.phpt0000664000175000017500000000221712474057375022506 0ustar cweiskecweiske--TEST-- XML_Util::getXmlDeclaration() basic tests --CREDITS-- Chuck Burgess @@ -98548,7 +95902,7 @@ TEST: using version, encoding, and standalone flag TEST: using version and standalone flag -XML_Util-1.2.3/tests/testBasic_isValidName.phpt0000664000175000017500000000260212344563343022203 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_isValidName.phpt0000664000175000017500000000260212474057375021272 0ustar cweiskecweiske--TEST-- XML_Util::isValidName() basic tests --CREDITS-- Chuck Burgess @@ -98594,7 +95948,7 @@ Invalid XML name: XML names may only contain alphanumeric chars, period, hyphen, TEST: invalid tag that doesn't start with a letter Invalid XML name: XML names may only start with letter or underscore -XML_Util-1.2.3/tests/testBasic_raiseError.phpt0000664000175000017500000000076612344563343022135 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_raiseError.phpt0000664000175000017500000000076612474057375021224 0ustar cweiskecweiske--TEST-- XML_Util::raiseError() basic tests --CREDITS-- Chuck Burgess @@ -98613,7 +95967,7 @@ if (is_a($error, 'PEAR_Error')) { =====XML_Util::raiseError() basic tests===== PEAR Error: I am an error -XML_Util-1.2.3/tests/testBasic_replaceEntities.phpt0000664000175000017500000000626012344563343023133 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_replaceEntities.phpt0000664000175000017500000000626012474057375022222 0ustar cweiskecweiske--TEST-- XML_Util::replaceEntities() basic tests --CREDITS-- Chuck Burgess @@ -98695,7 +96049,7 @@ This string contains < & >. TEST: utf8 usage with ENTITIES_HTML and UTF-8 This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê -XML_Util-1.2.3/tests/testBasic_reverseEntities.phpt0000664000175000017500000000624112344563343023172 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_reverseEntities.phpt0000664000175000017500000000624112474057375022261 0ustar cweiskecweiske--TEST-- XML_Util::reverseEntities() basic tests --CREDITS-- Chuck Burgess @@ -98776,7 +96130,7 @@ This string contains < & >. TEST: utf8 usage with ENTITIES_HTML and UTF-8 This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê -XML_Util-1.2.3/tests/testBasic_splitQualifiedName.phpt0000664000175000017500000000172712344563343023576 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBasic_splitQualifiedName.phpt0000664000175000017500000000172712474057375022665 0ustar cweiskecweiske--TEST-- XML_Util::splitQualifiedName() basic tests --CREDITS-- Chuck Burgess @@ -98808,7 +96162,7 @@ localPart => stylesheet TEST: basic usage with namespace namespace => myNs localPart => stylesheet -XML_Util-1.2.3/tests/testBug_4950.phpt0000664000175000017500000000124312344563343020104 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBug_4950.phpt0000664000175000017500000000124312474057375017173 0ustar cweiskecweiske--TEST-- XML_Util tests for Bug #4950 "Incorrect CDATA serializing" --CREDITS-- Chuck Burgess @@ -98829,7 +96183,7 @@ echo XML_Util::createTag("test", array(), "Content ]]> here!", TEST: test case provided in bug report here!]]> -XML_Util-1.2.3/tests/testBug_5392.phpt0000664000175000017500000000211112344563343020100 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBug_5392.phpt0000664000175000017500000000211112474057375017167 0ustar cweiskecweiske--TEST-- XML_Util tests for Bug #5392 "encoding of ISO-8859-1 is the only supported encoding" --CREDITS-- Chuck Burgess @@ -98856,7 +96210,7 @@ echo $reversed . PHP_EOL; TEST: test case provided in bug report This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê -XML_Util-1.2.3/tests/testBug_18343.phpt0000664000175000017500000000622312344563343020170 0ustar clockwerxclockwerx--TEST-- +XML_Util-1.3.0/tests/testBug_18343.phpt0000664000175000017500000000622312474057375017257 0ustar cweiskecweiske--TEST-- XML_Util tests for Bug #18343 Entities in file names decoded during packaging --CREDITS-- Chuck Burgess @@ -98918,10 +96272,7 @@ Testing with ENTITIES_HTML: Testing with REPLACE_ENTITIES: -XML_Util-1.2.3/XML/Util.php0000664000175000017500000007313212344563343016043 0ustar clockwerxclockwerx, ", ' and & */ define('XML_UTIL_ENTITIES_XML', 1); /** - * replace only required XML entitites + * Replace only required XML entitites * This setting will replace <, " and & */ define('XML_UTIL_ENTITIES_XML_REQUIRED', 2); /** - * replace HTML entitites + * Replace HTML entitites * @link http://www.php.net/htmlentities */ define('XML_UTIL_ENTITIES_HTML', 3); @@ -99031,33 +96382,30 @@ define('XML_UTIL_COLLAPSE_ALL', 1); define('XML_UTIL_COLLAPSE_XHTML_ONLY', 2); /** - * utility class for working with XML documents + * Utility class for working with XML documents * - * @category XML * @package XML_Util * @author Stephan Schmidt * @copyright 2003-2008 Stephan Schmidt * @license http://opensource.org/licenses/bsd-license New BSD License - * @version Release: 1.2.3 + * @version Release: 1.3.0 * @link http://pear.php.net/package/XML_Util */ class XML_Util { /** - * return API version + * Return API version * * @return string $version API version - * @access public - * @static */ - function apiVersion() + public static function apiVersion() { return '1.1'; } /** - * replace XML entities + * Replace XML entities * * With the optional second parameter, you may select, which * entities should be replaced. @@ -99092,27 +96440,33 @@ class XML_Util * by the htmlentities() function * * @return string string with replaced chars - * @access public - * @static - * @see reverseEntities() + * @see reverseEntities() */ - function replaceEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML, - $encoding = 'ISO-8859-1') - { + public static function replaceEntities( + $string, $replaceEntities = XML_UTIL_ENTITIES_XML, $encoding = 'ISO-8859-1' + ) { switch ($replaceEntities) { case XML_UTIL_ENTITIES_XML: - return strtr($string, array( - '&' => '&', - '>' => '>', - '<' => '<', - '"' => '"', - '\'' => ''' )); + return strtr( + $string, + array( + '&' => '&', + '>' => '>', + '<' => '<', + '"' => '"', + '\'' => ''' + ) + ); break; case XML_UTIL_ENTITIES_XML_REQUIRED: - return strtr($string, array( - '&' => '&', - '<' => '<', - '"' => '"' )); + return strtr( + $string, + array( + '&' => '&', + '<' => '<', + '"' => '"' + ) + ); break; case XML_UTIL_ENTITIES_HTML: return htmlentities($string, ENT_COMPAT, $encoding); @@ -99122,7 +96476,7 @@ class XML_Util } /** - * reverse XML entities + * Reverse XML entities * * With the optional second parameter, you may select, which * entities should be reversed. @@ -99158,27 +96512,33 @@ class XML_Util * by the html_entity_decode() function * * @return string string with replaced chars - * @access public - * @static - * @see replaceEntities() + * @see replaceEntities() */ - function reverseEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML, - $encoding = 'ISO-8859-1') - { + public static function reverseEntities( + $string, $replaceEntities = XML_UTIL_ENTITIES_XML, $encoding = 'ISO-8859-1' + ) { switch ($replaceEntities) { case XML_UTIL_ENTITIES_XML: - return strtr($string, array( - '&' => '&', - '>' => '>', - '<' => '<', - '"' => '"', - ''' => '\'' )); + return strtr( + $string, + array( + '&' => '&', + '>' => '>', + '<' => '<', + '"' => '"', + ''' => '\'' + ) + ); break; case XML_UTIL_ENTITIES_XML_REQUIRED: - return strtr($string, array( - '&' => '&', - '<' => '<', - '"' => '"' )); + return strtr( + $string, + array( + '&' => '&', + '<' => '<', + '"' => '"' + ) + ); break; case XML_UTIL_ENTITIES_HTML: return html_entity_decode($string, ENT_COMPAT, $encoding); @@ -99188,7 +96548,7 @@ class XML_Util } /** - * build an xml declaration + * Build an xml declaration * * * require_once 'XML/Util.php'; @@ -99202,13 +96562,12 @@ class XML_Util * @param bool $standalone document is standalone (or not) * * @return string xml declaration - * @access public - * @static - * @uses attributesToString() to serialize the attributes of the XML declaration + * @uses attributesToString() to serialize the attributes of the + * XML declaration */ - function getXMLDeclaration($version = '1.0', $encoding = null, - $standalone = null) - { + public static function getXMLDeclaration( + $version = '1.0', $encoding = null, $standalone = null + ) { $attributes = array( 'version' => $version, ); @@ -99221,12 +96580,14 @@ class XML_Util $attributes['standalone'] = $standalone ? 'yes' : 'no'; } - return sprintf('', - XML_Util::attributesToString($attributes, false)); + return sprintf( + '', + XML_Util::attributesToString($attributes, false) + ); } /** - * build a document type declaration + * Build a document type declaration * * * require_once 'XML/Util.php'; @@ -99241,12 +96602,11 @@ class XML_Util * @param string $internalDtd internal dtd entries * * @return string doctype declaration - * @access public - * @static - * @since 0.2 + * @since 0.2 */ - function getDocTypeDeclaration($root, $uri = null, $internalDtd = null) - { + public static function getDocTypeDeclaration( + $root, $uri = null, $internalDtd = null + ) { if (is_array($uri)) { $ref = sprintf(' PUBLIC "%s" "%s"', $uri['id'], $uri['uri']); } elseif (!empty($uri)) { @@ -99263,7 +96623,7 @@ class XML_Util } /** - * create string representation of an attribute list + * Create string representation of an attribute list * * * require_once 'XML/Util.php'; @@ -99295,14 +96655,13 @@ class XML_Util * XML_UTIL_ENTITIES_HTML) * * @return string string representation of the attributes - * @access public - * @static - * @uses replaceEntities() to replace XML entities in attribute values - * @todo allow sort also to be an options array + * @uses replaceEntities() to replace XML entities in attribute values + * @todo allow sort also to be an options array */ - function attributesToString($attributes, $sort = true, $multiline = false, - $indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML) - { + public static function attributesToString( + $attributes, $sort = true, $multiline = false, + $indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML + ) { /* * second parameter may be an array */ @@ -99330,7 +96689,7 @@ class XML_Util if ($sort) { ksort($attributes); } - if ( !$multiline || count($attributes) == 1) { + if (!$multiline || count($attributes) == 1) { foreach ($attributes as $key => $value) { if ($entities != XML_UTIL_ENTITIES_NONE) { if ($entities === XML_UTIL_CDATA_SECTION) { @@ -99366,26 +96725,23 @@ class XML_Util * or only XHTML (XML_UTIL_COLLAPSE_XHTML_ONLY) ones. * * @return string XML - * @access public - * @static - * @todo PEAR CS - unable to avoid "space after open parens" error - * in the IF branch */ - function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) + public static function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) { if ($mode == XML_UTIL_COLLAPSE_XHTML_ONLY) { return preg_replace( '/<(area|base(?:font)?|br|col|frame|hr|img|input|isindex|link|meta|' . 'param)([^>]*)><\/\\1>/s', '<\\1\\2 />', - $xml); + $xml + ); } else { return preg_replace('/<(\w+)([^>]*)><\/\\1>/s', '<\\1\\2 />', $xml); } } /** - * create a tag + * Create a tag * * This method will call XML_Util::createTagFromArray(), which * is more flexible. @@ -99416,16 +96772,15 @@ class XML_Util * @param bool $sortAttributes Whether to sort the attributes or not * * @return string XML tag - * @access public - * @static - * @see createTagFromArray() - * @uses createTagFromArray() to create the tag + * @see createTagFromArray() + * @uses createTagFromArray() to create the tag */ - function createTag($qname, $attributes = array(), $content = null, + public static function createTag( + $qname, $attributes = array(), $content = null, $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, $multiline = false, $indent = '_auto', $linebreak = "\n", - $sortAttributes = true) - { + $sortAttributes = true + ) { $tag = array( 'qname' => $qname, 'attributes' => $attributes @@ -99441,13 +96796,15 @@ class XML_Util $tag['namespaceUri'] = $namespaceUri; } - return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, - $indent, $linebreak, $sortAttributes); + return XML_Util::createTagFromArray( + $tag, $replaceEntities, $multiline, + $indent, $linebreak, $sortAttributes + ); } /** - * create a tag from an array - * this method awaits an array in the following format + * Create a tag from an array. + * This method awaits an array in the following format *
      * array(
      *     // qualified name of the tag
@@ -99496,27 +96853,31 @@ class XML_Util
      * @param bool   $sortAttributes  Whether to sort the attributes or not
      *
      * @return string XML tag
-     * @access public
-     * @static
-     * @see createTag()
+     *
+     * @see  createTag()
      * @uses attributesToString() to serialize the attributes of the tag
      * @uses splitQualifiedName() to get local part and namespace of a qualified name
      * @uses createCDataSection()
      * @uses raiseError()
      */
-    function createTagFromArray($tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES,
+    public static function createTagFromArray(
+        $tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES,
         $multiline = false, $indent = '_auto', $linebreak = "\n",
-        $sortAttributes = true)
-    {
+        $sortAttributes = true
+    ) {
         if (isset($tag['content']) && !is_scalar($tag['content'])) {
-            return XML_Util::raiseError('Supplied non-scalar value as tag content',
-            XML_UTIL_ERROR_NON_SCALAR_CONTENT);
+            return XML_Util::raiseError(
+                'Supplied non-scalar value as tag content',
+                XML_UTIL_ERROR_NON_SCALAR_CONTENT
+            );
         }
 
         if (!isset($tag['qname']) && !isset($tag['localPart'])) {
-            return XML_Util::raiseError('You must either supply a qualified name '
+            return XML_Util::raiseError(
+                'You must either supply a qualified name '
                 . '(qname) or local tag name (localPart).',
-                XML_UTIL_ERROR_NO_TAG_NAME);
+                XML_UTIL_ERROR_NO_TAG_NAME
+            );
         }
 
         // if no attributes hav been set, use empty attributes
@@ -99553,8 +96914,8 @@ class XML_Util
         if (isset($tag['namespaceUri']) && !empty($tag['namespaceUri'])) {
             // is a namespace given
             if (isset($tag['namespace']) && !empty($tag['namespace'])) {
-                $tag['attributes']['xmlns:' . $tag['namespace']] =
-                    $tag['namespaceUri'];
+                $tag['attributes']['xmlns:' . $tag['namespace']]
+                    = $tag['namespaceUri'];
             } else {
                 // define this Uri as the default namespace
                 $tag['attributes']['xmlns'] = $tag['namespaceUri'];
@@ -99569,8 +96930,10 @@ class XML_Util
         }
 
         // create attribute list
-        $attList = XML_Util::attributesToString($tag['attributes'],
-            $sortAttributes, $multiline, $indent, $linebreak);
+        $attList = XML_Util::attributesToString(
+            $tag['attributes'],
+            $sortAttributes, $multiline, $indent, $linebreak
+        );
         if (!isset($tag['content']) || (string)$tag['content'] == '') {
             $tag = sprintf('<%s%s />', $tag['qname'], $attList);
         } else {
@@ -99581,18 +96944,21 @@ class XML_Util
                 $tag['content'] = XML_Util::createCDataSection($tag['content']);
                 break;
             default:
-                $tag['content'] = XML_Util::replaceEntities($tag['content'],
-                    $replaceEntities);
+                $tag['content'] = XML_Util::replaceEntities(
+                    $tag['content'], $replaceEntities
+                );
                 break;
             }
-            $tag = sprintf('<%s%s>%s', $tag['qname'], $attList, $tag['content'],
-                $tag['qname']);
+            $tag = sprintf(
+                '<%s%s>%s', $tag['qname'], $attList, $tag['content'],
+                $tag['qname']
+            );
         }
         return $tag;
     }
 
     /**
-     * create a start element
+     * Create a start element
      *
      * 
      * require_once 'XML/Util.php';
@@ -99613,14 +96979,13 @@ class XML_Util
      * @param bool   $sortAttributes Whether to sort the attributes or not
      *
      * @return string XML start element
-     * @access public
-     * @static
-     * @see createEndElement(), createTag()
+     * @see    createEndElement(), createTag()
      */
-    function createStartElement($qname, $attributes = array(), $namespaceUri = null,
+    public static function createStartElement(
+        $qname, $attributes = array(), $namespaceUri = null,
         $multiline = false, $indent = '_auto', $linebreak = "\n",
-        $sortAttributes = true)
-    {
+        $sortAttributes = true
+    ) {
         // if no attributes hav been set, use empty attributes
         if (!isset($attributes) || !is_array($attributes)) {
             $attributes = array();
@@ -99648,14 +97013,16 @@ class XML_Util
         }
 
         // create attribute list
-        $attList = XML_Util::attributesToString($attributes, $sortAttributes,
-            $multiline, $indent, $linebreak);
+        $attList = XML_Util::attributesToString(
+            $attributes, $sortAttributes,
+            $multiline, $indent, $linebreak
+        );
         $element = sprintf('<%s%s>', $qname, $attList);
         return  $element;
     }
 
     /**
-     * create an end element
+     * Create an end element
      *
      * 
      * require_once 'XML/Util.php';
@@ -99667,18 +97034,16 @@ class XML_Util
      * @param string $qname qualified tagname (including namespace)
      *
      * @return string XML end element
-     * @access public
-     * @static
-     * @see createStartElement(), createTag()
+     * @see    createStartElement(), createTag()
      */
-    function createEndElement($qname)
+    public static function createEndElement($qname)
     {
         $element = sprintf('', $qname);
         return $element;
     }
 
     /**
-     * create an XML comment
+     * Create an XML comment
      *
      * 
      * require_once 'XML/Util.php';
@@ -99690,17 +97055,15 @@ class XML_Util
      * @param string $content content of the comment
      *
      * @return string XML comment
-     * @access public
-     * @static
      */
-    function createComment($content)
+    public static function createComment($content)
     {
         $comment = sprintf('', $content);
         return $comment;
     }
 
     /**
-     * create a CData section
+     * Create a CData section
      *
      * 
      * require_once 'XML/Util.php';
@@ -99712,18 +97075,17 @@ class XML_Util
      * @param string $data data of the CData section
      *
      * @return string CData section with content
-     * @access public
-     * @static
      */
-    function createCDataSection($data)
+    public static function createCDataSection($data)
     {
-        return sprintf('',
-            preg_replace('/\]\]>/', ']]]]>', strval($data)));
-
+        return sprintf(
+            '',
+            preg_replace('/\]\]>/', ']]]]>', strval($data))
+        );
     }
 
     /**
-     * split qualified name and return namespace and local part
+     * Split qualified name and return namespace and local part
      *
      * 
      * require_once 'XML/Util.php';
@@ -99743,10 +97105,8 @@ class XML_Util
      * @param string $defaultNs default namespace (optional)
      *
      * @return array array containing namespace and local part
-     * @access public
-     * @static
      */
-    function splitQualifiedName($qname, $defaultNs = null)
+    public static function splitQualifiedName($qname, $defaultNs = null)
     {
         if (strstr($qname, ':')) {
             $tmp = explode(':', $qname);
@@ -99762,7 +97122,7 @@ class XML_Util
     }
 
     /**
-     * check, whether string is valid XML name
+     * Check, whether string is valid XML name
      *
      * 

XML names are used for tagname, attribute names and various * other, lesser known entities.

@@ -99783,33 +97143,39 @@ class XML_Util * @param string $string string that should be checked * * @return mixed true, if string is a valid XML name, PEAR error otherwise - * @access public - * @static + * * @todo support for other charsets * @todo PEAR CS - unable to avoid 85-char limit on second preg_match */ - function isValidName($string) + public static function isValidName($string) { // check for invalid chars if (!preg_match('/^[[:alpha:]_]\\z/', $string{0})) { - return XML_Util::raiseError('XML names may only start with letter ' - . 'or underscore', XML_UTIL_ERROR_INVALID_START); + return XML_Util::raiseError( + 'XML names may only start with letter or underscore', + XML_UTIL_ERROR_INVALID_START + ); } // check for invalid chars - if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/', - $string) - ) { - return XML_Util::raiseError('XML names may only contain alphanumeric ' + $match = preg_match( + '/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?' + . '[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/', + $string + ); + if (!$match) { + return XML_Util::raiseError( + 'XML names may only contain alphanumeric ' . 'chars, period, hyphen, colon and underscores', - XML_UTIL_ERROR_INVALID_CHARS); + XML_UTIL_ERROR_INVALID_CHARS + ); } // XML name is valid return true; } /** - * replacement for XML_Util::raiseError + * Replacement for XML_Util::raiseError * * Avoids the necessity to always require * PEAR.php @@ -99818,15 +97184,13 @@ class XML_Util * @param int $code error code * * @return PEAR_Error - * @access public - * @static - * @todo PEAR CS - should this use include_once instead? + * @todo PEAR CS - should this use include_once instead? */ - function raiseError($msg, $code) + public static function raiseError($msg, $code) { - require_once 'PEAR.php'; + include_once 'PEAR.php'; return PEAR::raiseError($msg, $code); } } ?> -G: r'.{&`GBMB \ No newline at end of file +f/9 0 GrGGBMB \ No newline at end of file -- cgit v1.2.1