removed mods directory from the ATutor codebase
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Setup.inc.php
diff --git a/mods/phpdoc2/PhpDocumentor/phpDocumentor/Setup.inc.php b/mods/phpdoc2/PhpDocumentor/phpDocumentor/Setup.inc.php
deleted file mode 100644 (file)
index 64ba624..0000000
+++ /dev/null
@@ -1,970 +0,0 @@
-<?php\r
-/**\r
- * This was all in {@link phpdoc.inc}, and now encapsulates the complexity\r
- * \r
- * phpDocumentor :: automatic documentation generator\r
- * \r
- * PHP versions 4 and 5\r
- *\r
- * Copyright (c) 2002-2006 Gregory Beaver\r
- * \r
- * LICENSE:\r
- * \r
- * This library is free software; you can redistribute it\r
- * and/or modify it under the terms of the GNU Lesser General\r
- * Public License as published by the Free Software Foundation;\r
- * either version 2.1 of the License, or (at your option) any\r
- * later version.\r
- * \r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * @package    phpDocumentor\r
- * @author     Gregory Beaver <cellog@php.net>\r
- * @copyright  2002-2006 Gregory Beaver\r
- * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL\r
- * @version    CVS: $Id: Setup.inc.php,v 1.27 2007/12/09 23:40:07 ashnazg Exp $\r
- * @link       http://www.phpdoc.org\r
- * @link       http://pear.php.net/PhpDocumentor\r
- * @since      1.2\r
- */\r
-error_reporting(E_ALL);\r
-\r
-/** ensure top-level PhpDocumentor dir is in include path */\r
-set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__)));\r
-\r
-/** common settings */\r
-include_once("phpDocumentor/common.inc.php");\r
-\r
-include_once("phpDocumentor/Io.inc");\r
-include_once("phpDocumentor/Publisher.inc");\r
-include_once("phpDocumentor/Classes.inc");\r
-include_once("phpDocumentor/ProceduralPages.inc");\r
-include_once("phpDocumentor/IntermediateParser.inc");\r
-include_once("phpDocumentor/WordParser.inc");\r
-include_once("phpDocumentor/EventStack.inc");\r
-include_once("phpDocumentor/ParserData.inc");\r
-include_once("phpDocumentor/InlineTags.inc");\r
-include_once("phpDocumentor/DocBlockTags.inc");\r
-include_once("phpDocumentor/DescHTML.inc");\r
-include_once("phpDocumentor/ParserDocBlock.inc");\r
-include_once("phpDocumentor/ParserElements.inc");\r
-include_once("phpDocumentor/Parser.inc");\r
-include_once("phpDocumentor/phpDocumentorTWordParser.inc");\r
-include_once("phpDocumentor/phpDocumentorTParser.inc");\r
-include_once("phpDocumentor/HighlightParser.inc");\r
-include_once("phpDocumentor/TutorialHighlightParser.inc");\r
-include_once("phpDocumentor/ParserDescCleanup.inc");\r
-include_once("phpDocumentor/PackagePageElements.inc");\r
-include_once("phpDocumentor/XMLpackagePageParser.inc");\r
-include_once("phpDocumentor/LinkClasses.inc");\r
-include_once("phpDocumentor/Converter.inc");\r
-include_once("phpDocumentor/Errors.inc");\r
-if (isset($_GET))\r
-{\r
-/**\r
- * $interface is either 'web' or is not set at all\r
- * @global array $interface\r
- */\r
-    if (isset($_GET['interface'])) $interface = $_GET['interface'];\r
-/**\r
- * $_phpDocumentor_setting is either the value from the web interface, or is set up by {@link Io::parseArgv()}\r
- * @global array $_phpDocumentor_setting\r
- */\r
-    if (isset($_GET['setting'])) $_phpDocumentor_setting = $_GET['setting'];\r
-}\r
-\r
-/**\r
- * default package name, set using -dn --defaultpackagename\r
- * @global string $GLOBALS['phpDocumentor_DefaultPackageName']\r
- * @name $phpDocumentor_DefaultPackageName\r
- */\r
-$GLOBALS['phpDocumentor_DefaultPackageName'] = 'default';\r
-\r
-/**\r
- * default package name, set using -dn --defaultcategoryname\r
- * @global string $GLOBALS['phpDocumentor_DefaultCategoryName']\r
- * @name $phpDocumentor_DefaultCategoryName\r
- */\r
-$GLOBALS['phpDocumentor_DefaultCategoryName'] = 'default';\r
-\r
-/**\r
- * @package phpDocumentor\r
- */\r
-class phpDocumentor_setup\r
-{\r
-    /**\r
-     * The main parser\r
-     * @var Parser|phpDocumentorTParser\r
-     */\r
-    var $parse;\r
-    /**\r
-     * Used to parse command-line options\r
-     * @var Io\r
-     */\r
-    var $setup;\r
-    /**\r
-     * Used to organize output from the Parser before Conversion\r
-     * @var phpDocumentor_IntermediateParser\r
-     */\r
-    var $render = false;\r
-    /**\r
-     * Packages to create documentation for\r
-     * @var string\r
-     */\r
-    var $packages = false;\r
-    /**\r
-     * contents of --filename commandline\r
-     * @tutorial phpDocumentor.howto.pkg#using.command-line.filename\r
-     * @var string\r
-     */\r
-    var $files = '';\r
-    /**\r
-     * contents of --directory commandline\r
-     * @tutorial phpDocumentor.howto.pkg#using.command-line.directory\r
-     * @var string\r
-     */\r
-    var $dirs = '';\r
-    /**\r
-     * contents of --hidden commandline\r
-     * @tutorial phpDocumentor.howto.pkg#using.command-line.hidden\r
-     * @var boolean\r
-     */\r
-    var $hidden = false;\r
-    /**\r
-     * time that parsing was started, used for informative timing of output\r
-     * @access private\r
-     */\r
-    var $parse_start_time;\r
-    /**\r
-     * contents of --ignore commandline\r
-     * @tutorial phpDocumentor.howto.pkg#using.command-line.ignore\r
-     * @var string\r
-     */\r
-    var $ignore_files = array();\r
-    /**\r
-     * contents of --ignoresymlinks commandline\r
-     * @var boolean\r
-     */\r
-    var $ignoresymlinks = false;\r
-\r
-    /**\r
-     * Checks PHP version, makes sure it is 4.2.0+, and chooses the\r
-     * phpDocumentorTParser if version is 4.3.0+\r
-     * @uses parseIni()\r
-     */\r
-    function phpDocumentor_setup()\r
-    {\r
-        global $_phpDocumentor_cvsphpfile_exts, $_phpDocumentor_setting;\r
-        if (!function_exists('is_a'))\r
-        {\r
-            print "phpDocumentor requires PHP version 4.2.0 or greater to function";\r
-            exit;\r
-        }\r
-\r
-        $this->setup = new Io;\r
-        if (!isset($interface) && !isset($_GET['interface']) && !isset($_phpDocumentor_setting))\r
-        {\r
-            // Parse the argv settings\r
-            $_phpDocumentor_setting = $this->setup->parseArgv();\r
-        }\r
-        if (isset($_phpDocumentor_setting['useconfig']) &&\r
-             !empty($_phpDocumentor_setting['useconfig'])) {\r
-            $this->readConfigFile($_phpDocumentor_setting['useconfig']);\r
-        }\r
-\r
-        // set runtime to a large value since this can take quite a while\r
-        // we can only set_time_limit when not in safe_mode bug #912064\r
-        if (!ini_get('safe_mode'))\r
-        {\r
-            set_time_limit(0);    // unlimited runtime\r
-        } else\r
-        {\r
-            phpDocumentor_out("time_limit cannot be set since your in safe_mode, please edit time_limit in your php.ini to allow enough time for phpDocumentor to run"); \r
-        }\r
-  \r
-        $phpver = phpversion();\r
-        $phpdocver = PHPDOCUMENTOR_VER;\r
-        if (isset($_GET['interface'])) {\r
-            $phpver = "<b>$phpver</b>";\r
-            $phpdocver = "<b>$phpdocver</b>";\r
-        }\r
-        phpDocumentor_out("PHP Version $phpver\n");\r
-        phpDocumentor_out("phpDocumentor version $phpdocver\n\n");\r
-\r
-        $this->parseIni();\r
-        $this->setMemoryLimit();\r
-\r
-        if (tokenizer_ext)\r
-        {\r
-            phpDocumentor_out("using tokenizer Parser\n");\r
-            $this->parse = new phpDocumentorTParser;\r
-        } else\r
-        {\r
-            phpDocumentor_out("No Tokenizer support detected, so using default (slower) Parser..." . PHP_EOL);\r
-\r
-            if (version_compare(phpversion(), '4.3.0', '<')) {\r
-                phpDocumentor_out("    for faster parsing, recompile PHP with --enable-tokenizer." . PHP_EOL );\r
-            } else {\r
-                phpDocumentor_out("    for faster parsing, recompile PHP without --disable-tokenizer." . PHP_EOL );\r
-            }\r
-\r
-            $this->parse = new Parser;\r
-        }\r
-    }\r
-    \r
-    /**\r
-     * Get phpDocumentor settings from a user configuration file\r
-     * @param string user configuration file\r
-     */\r
-    function readConfigFile($file)\r
-    {\r
-        global $_phpDocumentor_setting, $_phpDocumentor_options;\r
-        // security\r
-        $file = str_replace(array('..','.ini','\\'),array('','','/'),$file);\r
-        if (is_file($file . '.ini'))\r
-        {\r
-            $_phpDocumentor_setting = phpDocumentor_parse_ini_file($file.'.ini');\r
-        } else\r
-        {\r
-            if ('@DATA-DIR@' != '@'.'DATA-DIR@')\r
-            {\r
-                $configdir = str_replace('\\','/', '@DATA-DIR@/PhpDocumentor') . PATH_DELIMITER . 'user' . PATH_DELIMITER;\r
-            } else {\r
-                $configdir = str_replace('\\','/',$GLOBALS['_phpDocumentor_install_dir']) . PATH_DELIMITER . 'user' . PATH_DELIMITER;\r
-            }\r
-            if (isset($_phpDocumentor_options['userdir'])) $configdir = $_phpDocumentor_options['userdir'];\r
-            if (substr($configdir,-1) != '/')\r
-            {\r
-                $configdir .= '/';\r
-            }\r
-            $_phpDocumentor_setting = phpDocumentor_parse_ini_file( $configdir . $file . '.ini');\r
-            if (empty($_phpDocumentor_setting['defaultpackagename']))\r
-            {\r
-                $_phpDocumentor_setting['defaultpackagename'] = 'default';\r
-            }\r
-        }\r
-        // don't want a loop condition!\r
-        unset($_phpDocumentor_setting['useconfig']);\r
-    }\r
-    \r
-    /**\r
-     * Get phpDocumentor settings from command-line or web interface\r
-     */\r
-    function readCommandLineSettings()\r
-    {\r
-        global $_phpDocumentor_setting,$interface,$_phpDocumentor_RIC_files;\r
-        // subscribe $render class to $parse class events\r
-        if (!isset($_phpDocumentor_setting['junk'])) $_phpDocumentor_setting['junk'] = '';\r
-        if (!isset($_phpDocumentor_setting['title'])) $_phpDocumentor_setting['title'] = 'Generated Documentation';\r
-        $temp_title = $_phpDocumentor_setting['title'];\r
-        $this->render = new phpDocumentor_IntermediateParser($temp_title);\r
-        if (isset($_phpDocumentor_setting['help']) || $_phpDocumentor_setting['junk'] == "-h" || $_phpDocumentor_setting['junk'] == "--help")\r
-        {\r
-            echo $this->setup->displayHelpMsg();\r
-            die();\r
-        }\r
-\r
-        // set to parse hidden files\r
-        $this->hidden = (isset($_phpDocumentor_setting['hidden'])) ? decideOnOrOff($_phpDocumentor_setting['hidden']) : false;\r
-\r
-        // set to parse through symlinks\r
-        $this->ignoresymlinks = (isset($_phpDocumentor_setting['ignoresymlinks'])) ? decideOnOrOff($_phpDocumentor_setting['ignoresymlinks']) : false;\r
-        \r
-        // set to parse elements marked private with @access private\r
-        $this->render->setParsePrivate((isset($_phpDocumentor_setting['parseprivate'])) ? decideOnOrOff($_phpDocumentor_setting['parseprivate']) : false);\r
-\r
-        // set to print warnings when undocumented elements are spotted\r
-        $this->render->setUndocumentedElementWarningsMode((isset($_phpDocumentor_setting['undocumentedelements'])) ? decideOnOrOff($_phpDocumentor_setting['undocumentedelements']) : false);\r
-\r
-        if (isset($_phpDocumentor_setting['ignoretags']))\r
-        {\r
-            $ignoretags = explode(',', $_phpDocumentor_setting['ignoretags']);\r
-            $ignoretags = array_map('trim', $ignoretags);\r
-            $tags = array();\r
-            foreach($ignoretags as $tag)\r
-            {\r
-                if (!in_array($tag,array('@global', '@access', '@package', '@ignore', '@name', '@param', '@return', '@staticvar', '@var')))\r
-                    $tags[] = $tag;\r
-            }\r
-            $_phpDocumentor_setting['ignoretags'] = $tags;\r
-        }\r
-        \r
-        if (isset($_phpDocumentor_setting['readmeinstallchangelog']))\r
-        {\r
-            $_phpDocumentor_setting['readmeinstallchangelog'] = explode(',',str_replace(' ','',$_phpDocumentor_setting['readmeinstallchangelog']));\r
-            $rics = array();\r
-            foreach($_phpDocumentor_setting['readmeinstallchangelog'] as $ric)\r
-            {\r
-                $rics[] = strtoupper(trim($ric));\r
-            }\r
-            $_phpDocumentor_RIC_files = $rics;\r
-        }\r
-        \r
-        if (isset($_phpDocumentor_setting['javadocdesc']) && $_phpDocumentor_setting['javadocdesc'] == 'on')\r
-        {\r
-            $this->parse->eventHandlers[PARSER_EVENT_DOCBLOCK] = 'JavaDochandleDocblock';\r
-        }\r
-        if (tokenizer_ext)\r
-        {\r
-            if (isset($_phpDocumentor_setting['sourcecode']) && $_phpDocumentor_setting['sourcecode'] == 'on')\r
-            {\r
-                $_phpDocumentor_setting['sourcecode'] = true;\r
-            } else\r
-            {\r
-                $_phpDocumentor_setting['sourcecode'] = false;\r
-            }\r
-        } else\r
-        {\r
-            if (isset($_phpDocumentor_setting['sourcecode']) && $_phpDocumentor_setting['sourcecode'] == 'on')\r
-            {\r
-                addWarning(PDERROR_SOURCECODE_IGNORED);\r
-            }\r
-            $_phpDocumentor_setting['sourcecode'] = false;\r
-        }\r
-        if (isset($_phpDocumentor_setting['converterparams']))\r
-        {\r
-            $_phpDocumentor_setting['converterparams'] = explode($_phpDocumentor_setting['converterparams']);\r
-            foreach($_phpDocumentor_setting['converterparams'] as $i => $p)\r
-            {\r
-                $_phpDocumentor_setting['converterparams'][$i] = trim($p);\r
-            }\r
-        }\r
-        if (isset($_phpDocumentor_setting['customtags']) && !empty($_phpDocumentor_setting['customtags']))\r
-        {\r
-            $c = explode(',',$_phpDocumentor_setting['customtags']);\r
-            for($i=0;$i<count($c); $i++)\r
-            {\r
-                $GLOBALS['_phpDocumentor_tags_allowed'][] = trim($c[$i]);\r
-            }\r
-        }\r
-        if (isset($_phpDocumentor_setting['pear']))\r
-        {\r
-            if ($_phpDocumentor_setting['pear'] === 'off') $_phpDocumentor_setting['pear'] = false;\r
-            if ($_phpDocumentor_setting['pear'] === 'on') $_phpDocumentor_setting['pear'] = true;\r
-        }\r
-        if (!isset($_phpDocumentor_setting['pear'])) $_phpDocumentor_setting['pear'] = false;\r
-        // set to change the default package name from "default" to whatever you want\r
-        if (isset($_phpDocumentor_setting['defaultpackagename']))\r
-        {\r
-            $GLOBALS['phpDocumentor_DefaultPackageName'] = trim($_phpDocumentor_setting['defaultpackagename']);\r
-        }\r
-        // set to change the default category name from "default" to whatever you want\r
-        if (isset($_phpDocumentor_setting['defaultcategoryname']))\r
-        {\r
-            $GLOBALS['phpDocumentor_DefaultCategoryName'] = trim($_phpDocumentor_setting['defaultcategoryname']);\r
-        }\r
-        \r
-        // set the mode (quiet or verbose)\r
-        $this->render->setQuietMode((isset($_phpDocumentor_setting['quiet'])) ? decideOnOrOff($_phpDocumentor_setting['quiet']) : false);\r
-\r
-        // Setup the different classes\r
-        if (isset($_phpDocumentor_setting['templatebase']))\r
-        {\r
-            $this->render->setTemplateBase(trim($_phpDocumentor_setting['templatebase']));\r
-        }\r
-        if (isset($_phpDocumentor_setting['target']) && !empty($_phpDocumentor_setting['target']))\r
-        {\r
-            $this->render->setTargetDir(trim($_phpDocumentor_setting['target']));\r
-        }\r
-        else\r
-        {\r
-            echo "a target directory must be specified\n try phpdoc -h\n";\r
-            die();\r
-        }\r
-        if (!empty($_phpDocumentor_setting['packageoutput']))\r
-        {\r
-            $this->packages = explode(",",trim($_phpDocumentor_setting['packageoutput']));\r
-            foreach($this->packages as $p => $v)\r
-            {\r
-                $this->packages[$p] = trim($v);\r
-            }\r
-        }\r
-        if (!empty($_phpDocumentor_setting['filename'])) {\r
-            $this->files = trim($_phpDocumentor_setting['filename']);\r
-        }\r
-        if (!empty($_phpDocumentor_setting['directory'])) {\r
-            $this->dirs = trim($_phpDocumentor_setting['directory']);\r
-        }\r
-    }\r
-    \r
-    function checkIgnoreTag($tagname, $inline = false)\r
-    {\r
-        global $_phpDocumentor_setting;\r
-        $tagname = '@'.$tagname;\r
-        if (!isset($_phpDocumentor_setting['ignoretags'])) return false;\r
-        if ($inline) $tagname = '{'.$tagname.'}';\r
-        return in_array($tagname, $_phpDocumentor_setting['ignoretags']);\r
-    }\r
-\r
-    /**\r
-     * Allow a memory_limit setting in phpDocumentor.ini to override php.ini or default memory limit\r
-     * @todo recognize "K" and "G" in memory_limit settings, rather than just "M"\r
-     */\r
-    function setMemoryLimit() {\r
-        global $_phpDocumentor_options;\r
-        $DEFAULT_MEMORY_SIZE_MINIMUM = 256;\r
-        \r
-        // PhpDoc memory_limit from phpDocumentor.ini overrides all other considerations\r
-        if (isset($_phpDocumentor_options['memory_limit'])) {\r
-            $phpdoc_ini_setting = str_replace('M', '', $_phpDocumentor_options['memory_limit']);\r
-\r
-            // allow phpdoc.ini to DISABLE the setting via "= -1"\r
-            if ($phpdoc_ini_setting == -1)\r
-            {\r
-                $memory_setting_to_use = $phpdoc_ini_setting;\r
-                $max_mem_log_message = "setting disabled by phpDocumentor.ini...\n";\r
-            }\r
-            else\r
-            {\r
-                $memory_setting_to_use = $phpdoc_ini_setting . "M";\r
-                $max_mem_log_message = "set at " . $memory_setting_to_use . " by phpDocumentor.ini...\n";\r
-            }\r
-        } else {\r
-            $php_ini_setting = str_replace('M', '', ini_get('memory_limit'));\r
-\r
-            // allow php.ini to DISABLE the setting via "= -1"\r
-            if ($php_ini_setting == -1)\r
-            {\r
-                // allow it to remain disabled\r
-                $memory_setting_to_use = $php_ini_setting;\r
-                $max_mem_log_message = "setting disabled by php.ini...\n";\r
-            }\r
-            else\r
-            {\r
-                // memory_limit from php.ini must be at least the default minimum\r
-                $memory_setting_to_use = ($php_ini_setting > $DEFAULT_MEMORY_SIZE_MINIMUM) ? $php_ini_setting . "M" : $DEFAULT_MEMORY_SIZE_MINIMUM . "M";\r
-                $max_mem_log_message = "set at " . $memory_setting_to_use . " after considering php.ini...\n";                \r
-            }\r
-        }\r
-        if (ini_set("memory_limit", $memory_setting_to_use))\r
-        {\r
-            // PHP had to have been compiled with "--enable-memory-limit" to allow setting the value explicitly\r
-            phpDocumentor_out("Maximum memory usage " . $max_mem_log_message);\r
-        }\r
-        else\r
-        {\r
-            // PHP must not have been compiled with "--enable-memory-limit", so we cannot modify it...\r
-            // no need to notify user of this unless they tried using memory_limit in their phpDocumentor.ini...\r
-            if (isset($phpdoc_ini_setting))\r
-            {\r
-                phpDocumentor_out("Unable to alter memory_limit via your phpDocumentor.ini... perhaps PHP wasn't compiled with \"--enable-memory-limit\"?\n");\r
-            }\r
-        }\r
-    }\r
-    \r
-    function setJavadocDesc()\r
-    {\r
-           $this->parse->eventHandlers[PARSER_EVENT_DOCBLOCK] = 'JavaDochandleDocblock';\r
-    }\r
-    \r
-    function setParsePrivate($flag = true)\r
-    {\r
-        $this->render->setParsePrivate($flag);\r
-    }\r
-    \r
-    function setQuietMode($flag = true)\r
-    {\r
-        $this->render->setQuietMode($flag);\r
-    }\r
-\r
-    function setUndocumentedElementWarnings($flag = true)\r
-    {\r
-        $this->render->setUndocumentedElementWarnings($flag);\r
-    }\r
-    \r
-    function setTargetDir($target)\r
-    {\r
-        $this->render->setTargetDir($target);\r
-    }\r
-    \r
-    function setTemplateBase($dir)\r
-    {\r
-        $this->render->setTemplateBase($dir);\r
-    }\r
-    \r
-    function setPackageOutput($po)\r
-    {\r
-        $this->packages = explode(",",$po);\r
-        array_map('trim', $this->packages);\r
-    }\r
-    \r
-    function setTitle($ti)\r
-    {\r
-        $this->render = new phpDocumentor_IntermediateParser($ti);\r
-    }\r
-    \r
-    function setFilesToParse($files)\r
-    {\r
-        $this->files = $files;\r
-    }\r
-    \r
-    function setDirectoriesToParse($dirs)\r
-    {\r
-        $this->dirs = $dirs;\r
-    }\r
-    \r
-    function parseHiddenFiles($flag = true)\r
-    {\r
-        $this->hidden = $flag;\r
-    }\r
-    \r
-    function setIgnore($ig)\r
-    {\r
-        if (strstr($ig,","))\r
-        {\r
-            $this->ignore_files = explode(",",$ig);\r
-        } else {\r
-            if (!empty($ig))\r
-            $this->ignore_files = array($ig);\r
-        }\r
-        $this->ignore_files = array_map('trim', $this->ignore_files);\r
-    }\r
-    \r
-    function createDocs($title = false)\r
-    {\r
-        $this->parse_start_time = time();\r
-        global $_phpDocumentor_setting;\r
-        if (!$this->render)\r
-        {\r
-            $this->render = new phpDocumentor_IntermediateParser($title);\r
-        }\r
-        // setup ignore  list\r
-        $this->ignore_files =array();\r
-        if(isset($_phpDocumentor_setting['ignore']))\r
-        {\r
-            $this->setIgnore($_phpDocumentor_setting['ignore']);\r
-        }\r
-        $this->parse->subscribe("*",$this->render);\r
-        // parse the directory\r
-        if (!empty($this->files))\r
-        {\r
-            $files = explode(",",$this->files);\r
-            foreach($files as $file)\r
-            {\r
-                $file = trim($file);\r
-                $test = $this->setup->getAllFiles($file);\r
-                if ($test)\r
-                {\r
-                    foreach($test as $file)\r
-                    {\r
-                        $file = trim($file);\r
-                        $dir = realpath(dirname($file));\r
-                        $dir = strtr($dir, "\\", "/");\r
-                        $dir = str_replace('//','/',$dir);\r
-                        // strip trailing directory seperator\r
-                        if (substr($dir,-1) == "/" || substr($dir,-1) == "\\")\r
-                        {\r
-                            $dir = substr($dir,0,-1);\r
-                        }\r
-                        $file = strtr(realpath($file), "\\", "/");\r
-                        $file = str_replace('//','/',$file);\r
-\r
-                        if (!$this->setup->checkIgnore(basename($file),dirname($file),$this->ignore_files,true,$this->ignoresymlinks))\r
-                        {\r
-                            $filelist[] = str_replace('\\','/',$file);\r
-                        } else {\r
-                            phpDocumentor_out("File $file Ignored\n");\r
-                            flush();\r
-                        }\r
-                    }\r
-                } else\r
-                {\r
-                    $dir = dirname(realpath($file));\r
-                    $dir = strtr($dir, "\\", "/");\r
-                    $dir = str_replace('//','/',$dir);\r
-                    // strip trailing directory seperator\r
-                    if (substr($dir,-1) == "/" || substr($dir,-1) == "\\")\r
-                    {\r
-                        $dir = substr($dir,0,-1);\r
-                    }\r
-                    $base = count(explode("/",$dir));\r
-                    $file = strtr(realpath($file), "\\", "/");\r
-                    $file = str_replace('//','/',$file);\r
-                    flush();\r
-\r
-                    if (!$this->setup->checkIgnore(basename($file),dirname($file),$this->ignore_files,true,$this->ignoresymlinks))\r
-                    {\r
-                        $filelist[] = str_replace('\\','/',$file);\r
-                    } else {\r
-                        phpDocumentor_out("File $file Ignored\n");\r
-                        flush();\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if (!empty($this->dirs))\r
-        {\r
-            $dirs = explode(",",$this->dirs);\r
-            foreach($dirs as $dir)\r
-            {\r
-                $olddir = $dir;\r
-                $dir = realpath($dir);\r
-                if (!$dir) {\r
-                    phpDocumentor_out('ERROR: "' . $olddir . '" does not exist, skipping');\r
-                    continue;\r
-                }\r
-                $dir = trim($dir);\r
-                $dir = strtr($dir, "\\", "/");\r
-                $dir = str_replace('//','/',$dir);\r
-                // strip trailing directory seperator\r
-                if (substr($dir,-1) == "/" || substr($dir,-1) == "\\")\r
-                {\r
-                    $dir = substr($dir,0,-1);\r
-                }\r
-                $files = $this->setup->dirList($dir,$this->hidden,$this->ignoresymlinks);\r
-                if (is_array($files))\r
-                {\r
-                    foreach($files as $file)\r
-                    {\r
-                        $file = strtr($file, '\\', '/');\r
-                        // file's subpath, relative to $dir\r
-                        $file_subpath = str_replace('\\', '/', realpath(dirname($file)));\r
-                        $file_subpath = preg_replace('~^' . preg_quote($dir, '~') . '~', '', $file_subpath);\r
-\r
-                        if (!$this->setup->checkIgnore(basename($file), $file_subpath, $this->ignore_files,true,$this->ignoresymlinks))\r
-                        {\r
-                            $filelist[] = $file;\r
-                        } else {\r
-                            phpDocumentor_out("File $file Ignored\n");\r
-                            flush();\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if (isset($filelist))\r
-        {\r
-            if (PHPDOCUMENTOR_WINDOWS)\r
-            {\r
-                // case insensitive array_unique\r
-                usort($filelist,'strnatcasecmp');\r
-                reset($filelist);\r
-                \r
-                $newarray = array();\r
-                $i = 0;\r
-                \r
-                $element = current($filelist);\r
-                for ($n=0;$n<sizeof($filelist);$n++)\r
-                {\r
-                    if (strtolower(next($filelist)) != strtolower($element))\r
-                    {\r
-                        $newarray[$i] = $element;\r
-                        $element = current($filelist);\r
-                        $i++;\r
-                    }\r
-                }\r
-                $filelist = $newarray; \r
-            } else $filelist = array_unique($filelist);\r
-\r
-            $base = count(explode("/",$source_base = $this->setup->getBase($filelist)));\r
-            define("PHPDOCUMENTOR_BASE",$source_base);\r
-            list($filelist,$ric) = $this->setup->getReadmeInstallChangelog($source_base, $filelist);\r
-            phpDocumentor_out("\n\nGrabbing README/INSTALL/CHANGELOG\n");\r
-            flush();\r
-            foreach($ric as $file)\r
-            {\r
-                phpDocumentor_out(basename($file).'...');\r
-                flush();\r
-                $fp = fopen($file,'r');\r
-                $contents = fread($fp,filesize($file));\r
-                $this->render->HandleEvent(PHPDOCUMENTOR_EVENT_README_INSTALL_CHANGELOG, array(basename($file),$contents));\r
-                fclose($fp);\r
-            }\r
-            phpDocumentor_out("\ndone\n");\r
-            flush();\r
-            list($filelist,$tutorials) = $this->setup->getTutorials($filelist);\r
-            phpDocumentor_out("\n\nTutorial/Extended Documentation Parsing Stage\n\n");\r
-            flush();\r
-            if (count($tutorials))\r
-            {\r
-                $tuteparser = new XMLPackagePageParser;\r
-                $tuteparser->subscribe('*',$this->render);\r
-                foreach($tutorials as $tutorial)\r
-                {\r
-                    switch($tutorial['tutetype'])\r
-                    {\r
-                        case 'pkg' :\r
-                        case 'cls' :\r
-                        case 'proc' :\r
-                        switch($tutorial['tutetype'])\r
-                        {\r
-                            case 'pkg' :\r
-                                $ptext = 'Package-level Docs ';\r
-                                if (!empty($tutorial['subpackage']))\r
-                                $ptext = 'Sub-Package Docs ';\r
-                            break;\r
-                            case 'cls' :\r
-                                $ptext = 'Class-level Docs ';\r
-                            break;\r
-                            case 'proc' :\r
-                                $ptext = 'Procedural-level Docs ';\r
-                            break;\r
-                        }\r
-                        $fp = @fopen($tutorial['path'],"r");\r
-                        if ($fp)\r
-                        {\r
-                            $ret = fread($fp,filesize($tutorial['path']));\r
-                            // fix 1151650\r
-                            if (stristr($ret, "utf-8") !== "")\r
-                            {\r
-                                $ret = utf8_decode($ret);\r
-                            }\r
-                            fclose($fp);\r
-                            unset($fp);\r
-                            phpDocumentor_out('Parsing '.$ptext.$tutorial['path'].'...');\r
-                            flush();\r
-                            $tuteparser->parse($ret,$tutorial);\r
-                            phpDocumentor_out("done\n");\r
-                            flush();\r
-                        } else\r
-                        {\r
-                            phpDocumentor_out('Error '.$ptext.$tutorial['path'].' doesn\'t exist'."\n");\r
-                            flush();\r
-                        }\r
-                        default :\r
-                        break;\r
-                    }\r
-                }\r
-            }\r
-            phpDocumentor_out("done\n");\r
-            flush();\r
-            phpDocumentor_out("\n\nGeneral Parsing Stage\n\n");\r
-            flush();\r
-            foreach($filelist as $file)\r
-            {\r
-                phpDocumentor_out("Reading file $file");\r
-                flush();\r
-                $this->parse->parse($a = $this->setup->readPhpFile($file, $this->render->quietMode),$file,$base,$this->packages);\r
-    \r
-            }\r
-            $b = (time() - $this->parse_start_time);\r
-            phpDocumentor_out("done\n");\r
-            flush();\r
-            // render output\r
-            phpDocumentor_out("\nConverting From Abstract Parsed Data\n");\r
-            flush();\r
-            $this->render->output();\r
-            $a = (time() - $this->parse_start_time);\r
-            $c = ($a - $b);\r
-            phpDocumentor_out("\nParsing time: $b seconds\n");\r
-            phpDocumentor_out("\nConversion time: $c seconds\n");\r
-            phpDocumentor_out("\nTotal Documentation Time: $a seconds\n");\r
-            phpDocumentor_out("done\n");\r
-            flush();\r
-        } else\r
-        {\r
-            print "\nERROR: nothing parsed\n";\r
-            exit;\r
-        }\r
-    }\r
-    /**\r
-     * Parse configuration file phpDocumentor.ini\r
-     */\r
-    function parseIni()\r
-    {\r
-        phpDocumentor_out("Parsing configuration file phpDocumentor.ini...\n");\r
-        flush();\r
-        if ('@DATA-DIR@' != '@'.'DATA-DIR@')\r
-        {\r
-            $options = phpDocumentor_parse_ini_file(str_replace('\\','/', '@DATA-DIR@/PhpDocumentor') . PATH_DELIMITER . 'phpDocumentor.ini',true);\r
-            phpDocumentor_out("   (found in " . '@DATA-DIR@/PhpDocumentor' . PATH_DELIMITER . ")...\n");\r
-        } else {\r
-            $options = phpDocumentor_parse_ini_file(str_replace('\\','/',$GLOBALS['_phpDocumentor_install_dir']) . PATH_DELIMITER . 'phpDocumentor.ini',true);\r
-            phpDocumentor_out("   (found in " . $GLOBALS['_phpDocumentor_install_dir'] . PATH_DELIMITER . ")...\n");\r
-        }\r
-\r
-        if (!$options)\r
-        {\r
-            print "ERROR: cannot open phpDocumentor.ini in directory " . $GLOBALS['_phpDocumentor_install_dir']."\n";\r
-            print "-Is phpdoc in either the path or include_path in your php.ini file?";\r
-            exit;\r
-        }\r
-        \r
-        foreach($options as $var => $values)\r
-        {\r
-            if ($var != 'DEBUG')\r
-            {\r
-//                phpDocumentor_out("\n$var");\r
-                if ($var != '_phpDocumentor_setting' && $var != '_phpDocumentor_options' && $var != '_phpDocumentor_install_dir' ) $values = array_values($values);\r
-//                fancy_debug("\n$var",$values);\r
-                $GLOBALS[$var] = $values;\r
-            }\r
-        }\r
-        phpDocumentor_out("\ndone\n");\r
-        flush();\r
-        /** Debug Constant */\r
-        if (!defined('PHPDOCUMENTOR_DEBUG')) define("PHPDOCUMENTOR_DEBUG",$options['DEBUG']['PHPDOCUMENTOR_DEBUG']);\r
-        if (!defined('PHPDOCUMENTOR_KILL_WHITESPACE')) define("PHPDOCUMENTOR_KILL_WHITESPACE",$options['DEBUG']['PHPDOCUMENTOR_KILL_WHITESPACE']);\r
-        $GLOBALS['_phpDocumentor_cvsphpfile_exts'] = $GLOBALS['_phpDocumentor_phpfile_exts'];\r
-        foreach($GLOBALS['_phpDocumentor_cvsphpfile_exts'] as $key => $val)\r
-        {\r
-            $GLOBALS['_phpDocumentor_cvsphpfile_exts'][$key] = "$val,v";\r
-        }\r
-        // none of this stuff is used anymore\r
-        if (isset($GLOBALS['_phpDocumentor_html_allowed']))\r
-        {\r
-            $___htmltemp = array_flip($GLOBALS['_phpDocumentor_html_allowed']);\r
-            $___html1 = array();\r
-            foreach($___htmltemp as $tag => $trans)\r
-            {\r
-                $___html1['<'.$tag.'>'] = htmlentities('<'.$tag.'>');\r
-                $___html1['</'.$tag.'>'] = htmlentities('</'.$tag.'>');\r
-            }\r
-            $GLOBALS['phpDocumentor___html'] = array_flip($___html1);\r
-        }\r
-    }\r
-    \r
-    /**\r
-     * Performs character-based validation of Output Converter Template name pieces\r
-     * @param string the name piece (just ONE of either Output, Converter, or Template piece)\r
-     * @param string any extra characters to allow beyond the default character set\r
-     * @return string|bool the clean name, or FALSE if piece is deemed invalid\r
-     * @access private\r
-     */\r
-    function cleanConverterNamePiece($name, $extra_characters_to_allow = '')\r
-    {\r
-        $name = str_replace("\\", "/", $name);\r
-        // security:  ensure no opportunity exists to use "../.." pathing in this value\r
-        $name = preg_replace('/[^a-zA-Z0-9' . $extra_characters_to_allow . '_-]/', "", $name);\r
-\r
-        // absolutely positively do NOT allow two consecutive dots ".."\r
-        if (strpos($name, '..') > -1) $name = false;\r
-        return $name;\r
-    }\r
-\r
-    /**\r
-     * Figures out what output converter to use\r
-     * @param string Output Converter Template name\r
-     * @access private\r
-     * @global array\r
-     * @uses cleanConverterNamePieces\r
-     * @uses phpDocumentor_out\r
-     */    \r
-    function setupConverters($output = false)\r
-    {\r
-        global $_phpDocumentor_setting;\r
-        if ($output)\r
-        {\r
-            $_phpDocumentor_setting['output'] = $output;\r
-        }\r
-        if (isset($_phpDocumentor_setting['output']) && !empty($_phpDocumentor_setting['output']))\r
-        {\r
-            $c = explode(',',$_phpDocumentor_setting['output']);\r
-            for($i=0; $i< count($c); $i++)\r
-            {\r
-                $c[$i] = explode(':',$c[$i]);\r
-                $a = $c[$i][0];\r
-                if (isset($c[$i][0]))\r
-                {\r
-                    $a = $this->cleanConverterNamePiece($c[$i][0]);\r
-                }\r
-                else\r
-                {\r
-                    $a = false;\r
-                }\r
-                if (isset($c[$i][1]))\r
-                {\r
-                    /*\r
-                     * must allow "/" due to options like "DocBook/peardoc2"\r
-                     */\r
-                    $b = $this->cleanConverterNamePiece($c[$i][1], '\/');\r
-                }\r
-                else\r
-                {\r
-                    $b = false;\r
-                }\r
-                if (isset($c[$i][2]))\r
-                {\r
-                    /*\r
-                     * must allow "." due to options like "phpdoc.de"\r
-                     * must allow "/" due to options like "DOM/default"\r
-                     */\r
-                    $d = $this->cleanConverterNamePiece($c[$i][2], '.\/');\r
-                    if (substr($d,-1) != "/")\r
-                    {\r
-                        $d .= "/";\r
-                    }\r
-                    else \r
-                    {\r
-                        $d = 'default/';\r
-                    }\r
-                }\r
-                if (strtoupper(trim($a)) == 'HTML' && (trim($b) == 'default'))\r
-                {\r
-                    phpDocumentor_out("WARNING: HTMLdefaultConverter is deprecated, using HTMLframesConverter.\n");\r
-                    phpDocumentor_out("WARNING: template output is identical, HTMLframes is more flexible.\n");\r
-                    phpDocumentor_out("WARNING: please adjust your usage\n");\r
-                    flush();\r
-                    $b = 'frames'; // change default to frames.\r
-                }\r
-                $this->render->addConverter(strtoupper(trim($a)),trim($b),trim($d));\r
-            }\r
-        } else\r
-        {\r
-            $this->render->addConverter('HTML','frames','default/');\r
-        }\r
-        if (empty($this->render->converters)) addErrorDie(PDERROR_NO_CONVERTERS);\r
-    }\r
-}\r
-\r
-/**\r
- * Fuzzy logic to interpret the boolean args' intent\r
- * @param string the command-line option to analyze\r
- * @return boolean our best guess of the value's boolean intent\r
- */\r
-function decideOnOrOff($value_to_guess = 'NO VALUE WAS PASSED')\r
-{\r
-    $these_probably_mean_yes = array(\r
-        '',             // "--hidden" with no value \r
-        'on',           // "--hidden on"\r
-        'y', 'yes',     // "--hidden y"\r
-        'true',         // "--hidden true"\r
-        '1'             // "--hidden 1"\r
-    );\r
-    $best_guess = false;    // default to "false", "off", "no", "take a hike"\r
-\r
-    if (in_array(strtolower(trim($value_to_guess)), $these_probably_mean_yes))\r
-    {\r
-        $best_guess = true;\r
-    }\r
-    return $best_guess;\r
-}\r
-\r
-/**\r
- * Print parse information if quiet setting is off\r
- */\r
-function phpDocumentor_out($string)\r
-{\r
-    global $_phpDocumentor_setting;\r
-    if ((isset($_phpDocumentor_setting['quiet'])) ? !decideOnOrOff($_phpDocumentor_setting['quiet']) : true)\r
-    {\r
-        print $string;\r
-    }\r
-\r
-}\r
-\r
-/**\r
- * Crash in case of known, dangerous bug condition\r
- * \r
- * Checks the PHP version that is executing PhpDocumentor,\r
- * in case a known PHP/PEAR bug condition could be triggered\r
- * by the PhpDocumentor execution.\r
- * @param string $php_version the PHP version that contains the bug\r
- * @param string $php_bug_number the PHP bug number (if any)\r
- * @param string $pear_bug_number the PEAR bug number (if any)\r
- */\r
-function checkForBugCondition($php_version, $php_bug_number = 'none', $pear_bug_number = 'none')\r
-{\r
-    if (version_compare(phpversion(), $php_version) == 0)\r
-    {\r
-        addErrorDie(PDERROR_DANGEROUS_PHP_BUG_EXISTS, $php_version, $php_bug_number, $pear_bug_number);\r
-    }\r
-}\r
-?>\r