phpDocumentor phpDocumentor
[ class tree: phpDocumentor ] [ index: phpDocumentor ] [ all elements ]

Source for file Setup.inc.php

Documentation is available at Setup.inc.php

  1. <?php
  2. /**
  3.  * This was all in {@link phpdoc.inc}, and now encapsulates the complexity
  4.  * 
  5.  * phpDocumentor :: automatic documentation generator
  6.  * 
  7.  * PHP versions 4 and 5
  8.  *
  9.  * Copyright (c) 2002-2006 Gregory Beaver
  10.  * 
  11.  * LICENSE:
  12.  * 
  13.  * This library is free software; you can redistribute it
  14.  * and/or modify it under the terms of the GNU Lesser General
  15.  * Public License as published by the Free Software Foundation;
  16.  * either version 2.1 of the License, or (at your option) any
  17.  * later version.
  18.  * 
  19.  * This library is distributed in the hope that it will be useful,
  20.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  22.  * Lesser General Public License for more details.
  23.  * 
  24.  * You should have received a copy of the GNU Lesser General Public
  25.  * License along with this library; if not, write to the Free Software
  26.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27.  *
  28.  * @category   documentation
  29.  * @package    phpDocumentor
  30.  * @author     Gregory Beaver <[email protected]>
  31.  * @copyright  2002-2006 Gregory Beaver
  32.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  33.  * @version    CVS: $Id: Setup.inc.php,v 1.13 2006/10/23 03:45:08 cellog Exp $
  34.  * @link       http://www.phpdoc.org
  35.  * @link       http://pear.php.net/PhpDocumentor
  36.  * @since      1.2
  37.  */
  38. /** common settings */
  39. include_once("phpDocumentor/common.inc.php");
  40.  
  41. include_once("phpDocumentor/Io.inc");
  42. include_once("phpDocumentor/Publisher.inc");
  43. include_once("phpDocumentor/Classes.inc");
  44. include_once("phpDocumentor/ProceduralPages.inc");
  45. include_once("phpDocumentor/IntermediateParser.inc");
  46. include_once("phpDocumentor/WordParser.inc");
  47. include_once("phpDocumentor/EventStack.inc");
  48. include_once("phpDocumentor/ParserData.inc");
  49. include_once("phpDocumentor/InlineTags.inc");
  50. include_once("phpDocumentor/DocBlockTags.inc");
  51. include_once("phpDocumentor/DescHTML.inc");
  52. include_once("phpDocumentor/ParserDocBlock.inc");
  53. include_once("phpDocumentor/ParserElements.inc");
  54. include_once("phpDocumentor/Parser.inc");
  55. include_once("phpDocumentor/phpDocumentorTWordParser.inc");
  56. include_once("phpDocumentor/phpDocumentorTParser.inc");
  57. include_once("phpDocumentor/HighlightParser.inc");
  58. include_once("phpDocumentor/TutorialHighlightParser.inc");
  59. include_once("phpDocumentor/ParserDescCleanup.inc");
  60. include_once("phpDocumentor/PackagePageElements.inc");
  61. include_once("phpDocumentor/XMLpackagePageParser.inc");
  62. include_once("phpDocumentor/LinkClasses.inc");
  63. include_once("phpDocumentor/Converter.inc");
  64. include_once("phpDocumentor/Errors.inc");
  65. if (isset($_GET))
  66. {
  67. /**
  68.  * $interface is either 'web' or is not set at all
  69.  * @global array $interface 
  70.  */
  71.     if (isset($_GET['interface'])) $interface $_GET['interface'];
  72. /**
  73.  * $_phpDocumentor_setting is either the value from the web interface, or is set up by {@link Io::parseArgv()}
  74.  * @global array $_phpDocumentor_setting 
  75.  */
  76.     if (isset($_GET['setting'])) $_phpDocumentor_setting $_GET['setting'];
  77. }
  78.  
  79. /**
  80.  * default package name, set using -dn --defaultpackagename
  81.  * @global string $GLOBALS['phpDocumentor_DefaultPackageName'] 
  82.  * @name $phpDocumentor_DefaultPackageName
  83.  */
  84. $GLOBALS['phpDocumentor_DefaultPackageName''default';
  85.  
  86. /**
  87.  * default package name, set using -dn --defaultcategoryname
  88.  * @global string $GLOBALS['phpDocumentor_DefaultCategoryName'] 
  89.  * @name $phpDocumentor_DefaultCategoryName
  90.  */
  91. $GLOBALS['phpDocumentor_DefaultCategoryName''default';
  92.  
  93. /**
  94.  * @package phpDocumentor
  95.  */
  96. {
  97.     /**
  98.      * The main parser
  99.      * @var Parser|phpDocumentorTParser
  100.      */
  101.     var $parse;
  102.     /**
  103.      * Used to parse command-line options
  104.      * @var Io 
  105.      */
  106.     var $setup;
  107.     /**
  108.      * Used to organize output from the Parser before Conversion
  109.      * @var phpDocumentor_IntermediateParser 
  110.      */
  111.     var $render = false;
  112.     /**
  113.      * Packages to create documentation for
  114.      * @var string 
  115.      */
  116.     var $packages = false;
  117.     /**
  118.      * contents of --filename commandline
  119.      * @tutorial phpDocumentor.howto.pkg#using.command-line.filename
  120.      * @var string 
  121.      */
  122.     var $files = '';
  123.     /**
  124.      * contents of --directory commandline
  125.      * @tutorial phpDocumentor.howto.pkg#using.command-line.directory
  126.      * @var string 
  127.      */
  128.     var $dirs = '';
  129.     /**
  130.      * contents of --hidden commandline
  131.      * @tutorial phpDocumentor.howto.pkg#using.command-line.hidden
  132.      * @var boolean 
  133.      */
  134.     var $hidden = false;
  135.     /**
  136.      * time that parsing was started, used for informative timing of output
  137.      * @access private
  138.      */
  139.     var $parse_start_time;
  140.     /**
  141.      * contents of --ignore commandline
  142.      * @tutorial phpDocumentor.howto.pkg#using.command-line.ignore
  143.      * @var string 
  144.      */
  145.     var $ignore_files = array();
  146.     /**
  147.      * Checks PHP version, makes sure it is 4.2.0+, and chooses the
  148.      * phpDocumentorTParser if version is 4.3.0+
  149.      * @uses parseIni()
  150.      */
  151.     function phpDocumentor_setup()
  152.     {
  153.         global $_phpDocumentor_cvsphpfile_exts$_phpDocumentor_setting;
  154.         if (!function_exists('is_a'))
  155.         {
  156.             print "phpDocumentor requires PHP version 4.2.0 or greater to function";
  157.             exit;
  158.         }
  159.  
  160.         $this->setup = new Io;
  161.         if (!isset($interface&& !isset($_GET['interface']&& !isset($_phpDocumentor_setting))
  162.         {
  163.             // Parse the argv settings
  164.             $_phpDocumentor_setting $this->setup->parseArgv();
  165.         }
  166.         if (isset($_phpDocumentor_setting['useconfig']&&
  167.              !empty($_phpDocumentor_setting['useconfig'])) {
  168.             $this->readConfigFile($_phpDocumentor_setting['useconfig']);
  169.         }
  170.  
  171.         // set runtime to a large value since this can take quite a while
  172.         // we can only set_time_limit when not in safe_mode bug #912064
  173.         if (!ini_get('safe_mode'))
  174.         {
  175.             set_time_limit(0);    // unlimited runtime
  176.         else
  177.         {
  178.             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")
  179.         }
  180.         $x str_replace('M'''ini_get('memory_limit'));
  181.         if ($x 256{
  182.             ini_set("memory_limit","256M");
  183.         }
  184.  
  185.         $phpver phpversion();
  186.         $phpdocver PHPDOCUMENTOR_VER;
  187.         if (isset($_GET['interface'])) {
  188.             $phpver "<b>$phpver</b>";
  189.             $phpdocver "<b>$phpdocver</b>";
  190.         }
  191.         phpDocumentor_out("PHP Version $phpver\n");
  192.         phpDocumentor_out("phpDocumentor version $phpdocver\n\n");
  193.  
  194.         $this->parseIni();
  195.  
  196.         if (tokenizer_ext)
  197.         {
  198.             phpDocumentor_out("using tokenizer Parser\n");
  199.             $this->parse = new phpDocumentorTParser;
  200.         else
  201.         {
  202.             phpDocumentor_out("using default (slower) Parser - get PHP 4.3.0+
  203. and load the tokenizer extension for faster parsing (your version is ".phpversion()."\n");
  204.             $this->parse = new Parser;
  205.         }
  206.     }
  207.     
  208.     /**
  209.      * Get phpDocumentor settings from a user configuration file
  210.      * @param string user configuration file
  211.      */
  212.     function readConfigFile($file)
  213.     {
  214.         global $_phpDocumentor_setting$_phpDocumentor_options;
  215.         // security
  216.         $file str_replace(array('..','.ini','\\'),array('','','/'),$file);
  217.         if (is_file($file '.ini'))
  218.         {
  219.             $_phpDocumentor_setting phpDocumentor_parse_ini_file($file.'.ini');
  220.         else
  221.         {
  222.             if ('@DATA-DIR@' != '@'.'DATA-DIR@')
  223.             {
  224.                 $configdir str_replace('\\','/''@DATA-DIR@/PhpDocumentor'PATH_DELIMITER 'user' PATH_DELIMITER;
  225.             else {
  226.                 $configdir str_replace('\\','/',$GLOBALS['_phpDocumentor_install_dir']PATH_DELIMITER 'user' PATH_DELIMITER;
  227.             }
  228.             if (isset($_phpDocumentor_options['userdir'])) $configdir $_phpDocumentor_options['userdir'];
  229.             if (substr($configdir,-1!= '/')
  230.             {
  231.                 $configdir .= '/';
  232.             }
  233.             $_phpDocumentor_setting phpDocumentor_parse_ini_file$configdir $file '.ini');
  234.             if (empty($_phpDocumentor_setting['defaultpackagename']))
  235.             {
  236.                 $_phpDocumentor_setting['defaultpackagename''default';
  237.             }
  238.         }
  239.         // don't want a loop condition!
  240.         unset($_phpDocumentor_setting['useconfig']);
  241.     }
  242.     
  243.     /**
  244.      * Get phpDocumentor settings from command-line or web interface
  245.      */
  246.     function readCommandLineSettings()
  247.     {
  248.         global $_phpDocumentor_setting,$interface,$_phpDocumentor_RIC_files;
  249.         // subscribe $render class to $parse class events
  250.         if (!isset($_phpDocumentor_setting['junk'])) $_phpDocumentor_setting['junk''';
  251.         if (!isset($_phpDocumentor_setting['title'])) $_phpDocumentor_setting['title''Generated Documentation';
  252.         $temp_title $_phpDocumentor_setting['title'];
  253.         $this->render = new phpDocumentor_IntermediateParser($temp_title);
  254.         if (isset($_phpDocumentor_setting['help']|| $_phpDocumentor_setting['junk'== "-h" || $_phpDocumentor_setting['junk'== "--help")
  255.         {
  256.             echo $this->setup->displayHelpMsg();
  257.             die();
  258.         }
  259.         
  260.         if (isset($_phpDocumentor_setting['hidden'])) $this->hidden = true;
  261.         
  262.         // set to parse elements marked private with @access private
  263.         if (isset($_phpDocumentor_setting['parseprivate']&& $_phpDocumentor_setting['parseprivate'== 'on')
  264.         {
  265.             $this->render->setParsePrivate(true);
  266.         }
  267.         
  268.         if (isset($_phpDocumentor_setting['ignoretags']))
  269.         {
  270.             $ignoretags explode(','$_phpDocumentor_setting['ignoretags']);
  271.             $ignoretags array_map('trim'$ignoretags);
  272.             $tags array();
  273.             foreach($ignoretags as $tag)
  274.             {
  275.                 if (!in_array($tag,array('@global''@access''@package''@ignore''@name''@param''@return''@staticvar''@var')))
  276.                     $tags[$tag;
  277.             }
  278.             $_phpDocumentor_setting['ignoretags'$tags;
  279.         }
  280.         
  281.         if (isset($_phpDocumentor_setting['readmeinstallchangelog']))
  282.         {
  283.             $_phpDocumentor_setting['readmeinstallchangelog'explode(',',str_replace(' ','',$_phpDocumentor_setting['readmeinstallchangelog']));
  284.             $rics array();
  285.             foreach($_phpDocumentor_setting['readmeinstallchangelog'as $ric)
  286.             {
  287.                 $rics[strtoupper(trim($ric));
  288.             }
  289.             $_phpDocumentor_RIC_files $rics;
  290.         }
  291.         
  292.         if (isset($_phpDocumentor_setting['javadocdesc']&& $_phpDocumentor_setting['javadocdesc'== 'on')
  293.         {
  294.             $this->parse->eventHandlers[PARSER_EVENT_DOCBLOCK'JavaDochandleDocblock';
  295.         }
  296.         if (tokenizer_ext)
  297.         {
  298.             if (isset($_phpDocumentor_setting['sourcecode']&& $_phpDocumentor_setting['sourcecode'== 'on')
  299.             {
  300.                 $_phpDocumentor_setting['sourcecode'true;
  301.             else
  302.             {
  303.                 $_phpDocumentor_setting['sourcecode'false;
  304.             }
  305.         else
  306.         {
  307.             if (isset($_phpDocumentor_setting['sourcecode']&& $_phpDocumentor_setting['sourcecode'== 'on')
  308.             {
  309.                 addWarning(PDERROR_SOURCECODE_IGNORED);
  310.             }
  311.             $_phpDocumentor_setting['sourcecode'false;
  312.         }
  313.         if (isset($_phpDocumentor_setting['converterparams']))
  314.         {
  315.             $_phpDocumentor_setting['converterparams'explode($_phpDocumentor_setting['converterparams']);
  316.             foreach($_phpDocumentor_setting['converterparams'as $i => $p)
  317.             {
  318.                 $_phpDocumentor_setting['converterparams'][$itrim($p);
  319.             }
  320.         }
  321.         if (isset($_phpDocumentor_setting['customtags']&& !empty($_phpDocumentor_setting['customtags']))
  322.         {
  323.             $c explode(',',$_phpDocumentor_setting['customtags']);
  324.             for($i=0;$i<count($c)$i++)
  325.             {
  326.                 $GLOBALS['_phpDocumentor_tags_allowed'][trim($c[$i]);
  327.             }
  328.         }
  329.         if (isset($_phpDocumentor_setting['pear']))
  330.         {
  331.             if ($_phpDocumentor_setting['pear'=== 'off'$_phpDocumentor_setting['pear'false;
  332.             if ($_phpDocumentor_setting['pear'=== 'on'$_phpDocumentor_setting['pear'true;
  333.         }
  334.         if (!isset($_phpDocumentor_setting['pear'])) $_phpDocumentor_setting['pear'false;
  335.         // set to change the default package name from "default" to whatever you want
  336.         if (isset($_phpDocumentor_setting['defaultpackagename']))
  337.         {
  338.             $GLOBALS['phpDocumentor_DefaultPackageName'trim($_phpDocumentor_setting['defaultpackagename']);
  339.         }
  340.         // set to change the default category name from "default" to whatever you want
  341.         if (isset($_phpDocumentor_setting['defaultcategoryname']))
  342.         {
  343.             $GLOBALS['phpDocumentor_DefaultCategoryName'trim($_phpDocumentor_setting['defaultcategoryname']);
  344.         }
  345.         
  346.         // set the mode (quiet or verbose)
  347.         if isset($_phpDocumentor_setting['quiet']|| strcasecmp($_phpDocumentor_setting['junk']"-q"== || strcasecmp($_phpDocumentor_setting['junk']"--quiet"== 0
  348.         {
  349.             if (isset($_phpDocumentor_setting['quiet']&& $_phpDocumentor_setting['quiet'!= 'on');
  350.             else
  351.             $this->render->setQuietMode(true);
  352.         }
  353.         
  354.         // Setup the different classes
  355.         if (isset($_phpDocumentor_setting['templatebase']))
  356.         {
  357.             $this->render->setTemplateBase(trim($_phpDocumentor_setting['templatebase']));
  358.         }
  359.         if (isset($_phpDocumentor_setting['target']&& !empty($_phpDocumentor_setting['target']))
  360.         {
  361.             $this->render->setTargetDir(trim($_phpDocumentor_setting['target']));
  362.         }
  363.         else
  364.         {
  365.             echo "a target directory must be specified\n try phpdoc -h\n";
  366.             die();
  367.         }
  368.         if (!empty($_phpDocumentor_setting['packageoutput']))
  369.         {
  370.             $this->packages = explode(",",trim($_phpDocumentor_setting['packageoutput']));
  371.             foreach($this->packages as $p => $v)
  372.             {
  373.                 $this->packages[$ptrim($v);
  374.             }
  375.         }
  376.         if (!empty($_phpDocumentor_setting['filename'])) {
  377.             $this->files = trim($_phpDocumentor_setting['filename']);
  378.         }
  379.         if (!empty($_phpDocumentor_setting['directory'])) {
  380.             $this->dirs = trim($_phpDocumentor_setting['directory']);
  381.         }
  382.     }
  383.     
  384.     function checkIgnoreTag($tagname$inline false)
  385.     {
  386.         global $_phpDocumentor_setting;
  387.         $tagname '@'.$tagname;
  388.         if (!isset($_phpDocumentor_setting['ignoretags'])) return false;
  389.         if ($inline$tagname '{'.$tagname.'}';
  390.         return in_array($tagname$_phpDocumentor_setting['ignoretags']);
  391.     }
  392.     
  393.     function setJavadocDesc()
  394.     {
  395.            $this->parse->eventHandlers[PARSER_EVENT_DOCBLOCK'JavaDochandleDocblock';
  396.     }
  397.     
  398.     function setParsePrivate()
  399.     {
  400.         $this->render->setParsePrivate(true);
  401.     }
  402.     
  403.     function setQuietMode()
  404.     {
  405.         $this->render->setQuietMode(true);
  406.     }
  407.     
  408.     function setTargetDir($target)
  409.     {
  410.         $this->render->setTargetDir($target);
  411.     }
  412.     
  413.     function setTemplateBase($dir)
  414.     {
  415.         $this->render->setTemplateBase($dir);
  416.     }
  417.     
  418.     function setPackageOutput($po)
  419.     {
  420.         $this->packages = explode(",",$po);
  421.         array_map('trim'$this->packages);
  422.     }
  423.     
  424.     function setTitle($ti)
  425.     {
  426.         $this->render = new phpDocumentor_IntermediateParser($ti);
  427.     }
  428.     
  429.     function setFilesToParse($files)
  430.     {
  431.         $this->files = $files;
  432.     }
  433.     
  434.     function setDirectoriesToParse($dirs)
  435.     {
  436.         $this->dirs = $dirs;
  437.     }
  438.     
  439.     function parseHiddenFiles()
  440.     {
  441.         $this->hidden = true;
  442.     }
  443.     
  444.     function setIgnore($ig)
  445.     {
  446.         if (strstr($ig,","))
  447.         {
  448.             $this->ignore_files = explode(",",$ig);
  449.         else {
  450.             if (!empty($ig))
  451.             $this->ignore_files = array($ig);
  452.         }
  453.         $this->ignore_files = array_map('trim'$this->ignore_files);
  454.     }
  455.     
  456.     function createDocs($title false)
  457.     {
  458.         $this->parse_start_time time();
  459.         global $_phpDocumentor_setting;
  460.         if (!$this->render)
  461.         {
  462.             $this->render = new phpDocumentor_IntermediateParser($title);
  463.         }
  464.         // setup ignore  list
  465.         $this->ignore_files =array();
  466.         if(isset($_phpDocumentor_setting['ignore']))
  467.         {
  468.             $this->setIgnore($_phpDocumentor_setting['ignore']);
  469.         }
  470.         $this->parse->subscribe("*",$this->render);
  471.         // parse the directory
  472.         if (!empty($this->files))
  473.         {
  474.             $files explode(",",$this->files);
  475.             foreach($files as $file)
  476.             {
  477.                 $file trim($file);
  478.                 $test $this->setup->getAllFiles($file);
  479.                 if ($test)
  480.                 {
  481.                     foreach($test as $file)
  482.                     {
  483.                         $file trim($file);
  484.                         $dir realpath(dirname($file));
  485.                         $dir strtr($dir"\\""/");
  486.                         $dir str_replace('//','/',$dir);
  487.                         // strip trailing directory seperator
  488.                         if (substr($dir,-1== "/" || substr($dir,-1== "\\")
  489.                         {
  490.                             $dir substr($dir,0,-1);
  491.                         }
  492.                         $file strtr(realpath($file)"\\""/");
  493.                         $file str_replace('//','/',$file);
  494.  
  495.                         if (!$this->setup->checkIgnore(basename($file),dirname($file),$this->ignore_files))
  496.                         {
  497.                             $filelist[str_replace('\\','/',$file);
  498.                         else {
  499.                             phpDocumentor_out("File $file Ignored\n");
  500.                             flush();
  501.                         }
  502.                     }
  503.                 else
  504.                 {
  505.                     $dir dirname(realpath($file));
  506.                     $dir strtr($dir"\\""/");
  507.                     $dir str_replace('//','/',$dir);
  508.                     // strip trailing directory seperator
  509.                     if (substr($dir,-1== "/" || substr($dir,-1== "\\")
  510.                     {
  511.                         $dir substr($dir,0,-1);
  512.                     }
  513.                     $base count(explode("/",$dir));
  514.                     $file strtr(realpath($file)"\\""/");
  515.                     $file str_replace('//','/',$file);
  516.                     flush();
  517.  
  518.                     if (!$this->setup->checkIgnore(basename($file),dirname($file),$this->ignore_files))
  519.                     {
  520.                         $filelist[str_replace('\\','/',$file);
  521.                     else {
  522.                         phpDocumentor_out("File $file Ignored\n");
  523.                         flush();
  524.                     }
  525.                 }
  526.             }
  527.         }
  528.         if (!empty($this->dirs))
  529.         {
  530.             $dirs explode(",",$this->dirs);
  531.             foreach($dirs as $dir)
  532.             {
  533.                 $olddir $dir;
  534.                 $dir realpath($dir);
  535.                 if (!$dir{
  536.                     phpDocumentor_out('ERROR: "' $olddir '" does not exist, skipping');
  537.                     continue;
  538.                 }
  539.                 $dir trim($dir);
  540.                 $dir strtr($dir"\\""/");
  541.                 $dir str_replace('//','/',$dir);
  542.                 // strip trailing directory seperator
  543.                 if (substr($dir,-1== "/" || substr($dir,-1== "\\")
  544.                 {
  545.                     $dir substr($dir,0,-1);
  546.                 }
  547.                 $files $this->setup->dirList($dir,$this->hidden);
  548.                 if (is_array($files))
  549.                 {
  550.                     foreach($files as $file)
  551.                     {
  552.                         // Make sure the file isn't a hidden file
  553.                         $file strtr($file"\\""/");
  554.                         if (substr(basename($file),0,1!= ".")
  555.                         {
  556.                             if (!$this->setup->checkIgnore(basename($file),str_replace('\\','/',dirname($file)),$this->ignore_files))
  557.                             {
  558.                                 $filelist[str_replace('\\','/',$file);
  559.                             else {
  560.                                 phpDocumentor_out("File $file Ignored\n");
  561.                                 flush();
  562.                             }
  563.                         }
  564.                     }
  565.                 }
  566.             }
  567.         }
  568.         if (isset($filelist))
  569.         {
  570.             if (PHPDOCUMENTOR_WINDOWS)
  571.             {
  572.                 // case insensitive array_unique
  573.                 usort($filelist,'strnatcasecmp');
  574.                 reset($filelist);
  575.                 
  576.                 $newarray array();
  577.                 $i 0;
  578.                 
  579.                 $element current($filelist);
  580.                 for ($n=0;$n<sizeof($filelist);$n++)
  581.                 {
  582.                     if (strtolower(next($filelist)) != strtolower($element))
  583.                     {
  584.                         $newarray[$i$element;
  585.                         $element current($filelist);
  586.                         $i++;
  587.                     }
  588.                 }
  589.                 $filelist $newarray
  590.             else $filelist array_unique($filelist);
  591.  
  592.             $base count(explode("/",$source_base $this->setup->getBase($filelist)));
  593.             define("PHPDOCUMENTOR_BASE",$source_base);
  594.             list($filelist,$ric$this->setup->getReadmeInstallChangelog($source_base$filelist);
  595.             phpDocumentor_out("\n\nGrabbing README/INSTALL/CHANGELOG\n");
  596.             flush();
  597.             foreach($ric as $file)
  598.             {
  599.                 phpDocumentor_out(basename($file).'...');
  600.                 flush();
  601.                 $fp fopen($file,'r');
  602.                 $contents fread($fp,filesize($file));
  603.                 $this->render->HandleEvent(PHPDOCUMENTOR_EVENT_README_INSTALL_CHANGELOGarray(basename($file),$contents));
  604.                 fclose($fp);
  605.             }
  606.             phpDocumentor_out("\ndone\n");
  607.             flush();
  608.             list($filelist,$tutorials$this->setup->getTutorials($filelist);
  609.             phpDocumentor_out("\n\nTutorial/Extended Documentation Parsing Stage\n\n");
  610.             flush();
  611.             if (count($tutorials))
  612.             {
  613.                 $tuteparser new XMLPackagePageParser;
  614.                 $tuteparser->subscribe('*',$this->render);
  615.                 foreach($tutorials as $tutorial)
  616.                 {
  617.                     switch($tutorial['tutetype'])
  618.                     {
  619.                         case 'pkg' :
  620.                         case 'cls' :
  621.                         case 'proc' :
  622.                         switch($tutorial['tutetype'])
  623.                         {
  624.                             case 'pkg' :
  625.                                 $ptext 'Package-level Docs ';
  626.                                 if (!empty($tutorial['subpackage']))
  627.                                 $ptext 'Sub-Package Docs ';
  628.                             break;
  629.                             case 'cls' :
  630.                                 $ptext 'Class-level Docs ';
  631.                             break;
  632.                             case 'proc' :
  633.                                 $ptext 'Procedural-level Docs ';
  634.                             break;
  635.                         }
  636.                         $fp @fopen($tutorial['path'],"r");
  637.                         if ($fp)
  638.                         {
  639.                             $ret fread($fp,filesize($tutorial['path']));
  640.                             // fix 1151650
  641.                             if (stristr($ret"utf-8"!== "")
  642.                             {
  643.                                 $ret utf8_decode($ret);
  644.                             }
  645.                             fclose($fp);
  646.                             unset($fp);
  647.                             phpDocumentor_out('Parsing '.$ptext.$tutorial['path'].'...');
  648.                             flush();
  649.                             $tuteparser->parse($ret,$tutorial);
  650.                             phpDocumentor_out("done\n");
  651.                             flush();
  652.                         else
  653.                         {
  654.                             phpDocumentor_out('Error '.$ptext.$tutorial['path'].' doesn\'t exist'."\n");
  655.                             flush();
  656.                         }
  657.                         default :
  658.                         break;
  659.                     }
  660.                 }
  661.             }
  662.             phpDocumentor_out("done\n");
  663.             flush();
  664.             phpDocumentor_out("\n\nGeneral Parsing Stage\n\n");
  665.             flush();
  666.             foreach($filelist as $file)
  667.             {
  668.                 phpDocumentor_out("Reading file $file");
  669.                 flush();
  670.                 $this->parse->parse($a $this->setup->readPhpFile($file$this->render->quietMode),$file,$base,$this->packages);
  671.     
  672.             }
  673.             $b (time($this->parse_start_time);
  674.             phpDocumentor_out("done\n");
  675.             flush();
  676.             // render output
  677.             phpDocumentor_out("\nConverting From Abstract Parsed Data\n");
  678.             flush();
  679.             $this->render->output();
  680.             $a (time($this->parse_start_time);
  681.             $c ($a $b);
  682.             phpDocumentor_out("\nParsing time$b seconds\n");
  683.             phpDocumentor_out("\nConversion time$c seconds\n");
  684.             phpDocumentor_out("\nTotal Documentation Time$a seconds\n");
  685.             phpDocumentor_out("done\n");
  686.             flush();
  687.         else
  688.         {
  689.             print "ERROR: nothing parsed";
  690.             exit;
  691.         }
  692.     }
  693.     /**
  694.      * Parse configuration file phpDocumentor.ini
  695.      */
  696.     function parseIni()
  697.     {
  698.         phpDocumentor_out("Parsing configuration file phpDocumentor.ini...");
  699.         flush();
  700.         if ('@DATA-DIR@' != '@'.'DATA-DIR@')
  701.         {
  702.             $options phpDocumentor_parse_ini_file(str_replace('\\','/''@DATA-DIR@/PhpDocumentor'PATH_DELIMITER 'phpDocumentor.ini',true);
  703.         else {
  704.             $options phpDocumentor_parse_ini_file(str_replace('\\','/',$GLOBALS['_phpDocumentor_install_dir']PATH_DELIMITER 'phpDocumentor.ini',true);
  705.         }
  706.  
  707.         if (!$options)
  708.         {
  709.             print "ERROR: cannot open phpDocumentor.ini in directory " $GLOBALS['_phpDocumentor_install_dir']."\n";
  710.             print "-Is phpdoc in either the path or include_path in your php.ini file?";
  711.             exit;
  712.         }
  713.         
  714.         foreach($options as $var => $values)
  715.         {
  716.             if ($var != 'DEBUG')
  717.             {
  718. //                phpDocumentor_out("\n$var");
  719.                 if ($var != '_phpDocumentor_setting' && $var != '_phpDocumentor_options' && $var != '_phpDocumentor_install_dir' $values array_values($values);
  720. //                fancy_debug("\n$var",$values);
  721.                 $GLOBALS[$var$values;
  722.             }
  723.         }
  724.         phpDocumentor_out("\ndone\n");
  725.         flush();
  726.         /** Debug Constant */
  727.         define("PHPDOCUMENTOR_DEBUG",$options['DEBUG']['PHPDOCUMENTOR_DEBUG']);
  728.         define("PHPDOCUMENTOR_KILL_WHITESPACE",$options['DEBUG']['PHPDOCUMENTOR_KILL_WHITESPACE']);
  729.         $GLOBALS['_phpDocumentor_cvsphpfile_exts'$GLOBALS['_phpDocumentor_phpfile_exts'];
  730.         foreach($GLOBALS['_phpDocumentor_cvsphpfile_exts'as $key => $val)
  731.         {
  732.             $GLOBALS['_phpDocumentor_cvsphpfile_exts'][$key"$val,v";
  733.         }
  734.         // none of this stuff is used anymore
  735.         if (isset($GLOBALS['_phpDocumentor_html_allowed']))
  736.         {
  737.             $___htmltemp array_flip($GLOBALS['_phpDocumentor_html_allowed']);
  738.             $___html1 array();
  739.             foreach($___htmltemp as $tag => $trans)
  740.             {
  741.                 $___html1['<'.$tag.'>'htmlentities('<'.$tag.'>');
  742.                 $___html1['</'.$tag.'>'htmlentities('</'.$tag.'>');
  743.             }
  744.             $GLOBALS['phpDocumentor___html'array_flip($___html1);
  745.         }
  746.     }
  747.     
  748.     function setupConverters($output false)
  749.     {
  750.         global $_phpDocumentor_setting;
  751.         if ($output)
  752.         {
  753.             $_phpDocumentor_setting['output'$output;
  754.         }
  755.         if (isset($_phpDocumentor_setting['output']&& !empty($_phpDocumentor_setting['output']))
  756.         {
  757.             $c explode(',',$_phpDocumentor_setting['output']);
  758.             for($i=0$icount($c)$i++)
  759.             {
  760.                 $c[$iexplode(':',$c[$i]);
  761.                 $a $c[$i][0];
  762.                 $b false;
  763.                 $d 'default/';
  764.                 if (count($c[$i]1)
  765.                 {
  766.                     $a $c[$i][0];
  767.                     $b $c[$i][1];
  768.                     if (isset($c[$i][2]))
  769.                     {
  770.                         $d $c[$i][2];
  771.                         $d str_replace("\\","/",$d);
  772.                         if (substr($d,-1!= "/")
  773.                         {
  774.                             $d .= "/";
  775.                         }
  776.                     }
  777.                     else $d 'default/';
  778.                 }
  779.                 if (strtoupper(trim($a)) == 'HTML' && (trim($b== 'default'))
  780.                 {
  781.                     phpDocumentor_out("WARNING: HTMLdefaultConverter is deprecated, using HTMLframesConverter.\n");
  782.                     phpDocumentor_out("WARNING: template output is identical, HTMLframes is more flexible.\n");
  783.                     phpDocumentor_out("WARNING: please adjust your usage\n");
  784.                     flush();
  785.                     $b 'frames'// change default to frames.
  786.                 }
  787.                 $this->render->addConverter(strtoupper(trim($a)),trim($b),trim($d));
  788.             }
  789.         else
  790.         {
  791.             $this->render->addConverter('HTML','frames','default/');
  792.         }
  793.         if (empty($this->render->converters)) addErrorDie(PDERROR_NO_CONVERTERS);
  794.     }
  795. }
  796.  
  797. /**
  798.  * Print parse information if quiet setting is off
  799.  */
  800. function phpDocumentor_out($string)
  801. {
  802.     global $_phpDocumentor_setting;
  803.     if (!isset($_phpDocumentor_setting['quiet']|| !$_phpDocumentor_setting['quiet'])
  804.     {
  805.         print $string;
  806.     }
  807.  
  808. }
  809. ?>

Documentation generated on Tue, 24 Oct 2006 09:26:04 -0500 by phpDocumentor 1.3.1