/** * Checks PHP version, makes sure it is 4.2.0+, and chooses the * phpDocumentorTParser if version is 4.3.0+ * @uses parseIni() */ function phpDocumentor_setup() { global $_phpDocumentor_cvsphpfile_exts, $_phpDocumentor_setting; if (!function_exists('is_a')) { print "phpDocumentor requires PHP version 4.2.0 or greater to function"; exit; } $this->setup = new Io(); if (!isset($interface) && !isset($_GET['interface']) && !isset($_phpDocumentor_setting)) { // Parse the argv settings $_phpDocumentor_setting = $this->setup->parseArgv(); } if (isset($_phpDocumentor_setting['useconfig']) && !empty($_phpDocumentor_setting['useconfig'])) { $this->readConfigFile($_phpDocumentor_setting['useconfig']); } // set runtime to a large value since this can take quite a while // we can only set_time_limit when not in safe_mode bug #912064 if (!ini_get('safe_mode')) { set_time_limit(0); // unlimited runtime } else { 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"); } $phpver = phpversion(); $phpdocver = PHPDOCUMENTOR_VER; if (isset($_GET['interface'])) { $phpver = "<b>{$phpver}</b>"; $phpdocver = "<b>{$phpdocver}</b>"; } phpDocumentor_out("PHP Version {$phpver}\n"); phpDocumentor_out("phpDocumentor version {$phpdocver}\n\n"); $this->parseIni(); $this->setMemoryLimit(); /* * NOTE: * It is possible for the tokenizer extension to be loaded, * but actually be broken in the OS, and therefore not working... * the conditional below will NOT recognize this scenario. * You can separately run the {@link tokenizer_test.php} to * verify that the tokenizer library is working correctly * from the OS perspective. */ if (tokenizer_ext) { phpDocumentor_out("using tokenizer Parser\n"); $this->parse = new phpDocumentorTParser(); } else { phpDocumentor_out("No Tokenizer support detected, so using default (slower) Parser..." . PHP_EOL); if (version_compare(phpversion(), '4.3.0', '<')) { phpDocumentor_out(" for faster parsing, recompile PHP with --enable-tokenizer." . PHP_EOL); } else { phpDocumentor_out(" for faster parsing, recompile PHP without --disable-tokenizer." . PHP_EOL); } phpDocumentor_out("WARNING: this Parser is only PHP4-capable... it cannot parse PHP5 code." . PHP_EOL); $this->parse = new Parser(); } }
/** * Checks PHP version, makes sure it is 4.2.0+, and chooses the * phpDocumentorTParser if version is 4.3.0+ * @uses parseIni() */ function phpDocumentor_setup() { global $_phpDocumentor_cvsphpfile_exts, $_phpDocumentor_setting; if (!function_exists('is_a')) { print "phpDocumentor requires PHP version 4.2.0 or greater to function"; exit; } $this->setup = new Io(); if (!isset($interface) && !isset($_GET['interface']) && !isset($_phpDocumentor_setting)) { // Parse the argv settings $_phpDocumentor_setting = $this->setup->parseArgv(); } if (isset($_phpDocumentor_setting['useconfig']) && !empty($_phpDocumentor_setting['useconfig'])) { $this->readConfigFile($_phpDocumentor_setting['useconfig']); } // set runtime to a large value since this can take quite a while // we can only set_time_limit when not in safe_mode bug #912064 if (!ini_get('safe_mode')) { set_time_limit(0); // unlimited runtime } else { 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"); } $x = str_replace('M', '', ini_get('memory_limit')); if ($x < 256) { ini_set("memory_limit", "256M"); } $phpver = phpversion(); $phpdocver = PHPDOCUMENTOR_VER; if (isset($_GET['interface'])) { $phpver = "<b>{$phpver}</b>"; $phpdocver = "<b>{$phpdocver}</b>"; } phpDocumentor_out("PHP Version {$phpver}\n"); phpDocumentor_out("phpDocumentor version {$phpdocver}\n\n"); $this->parseIni(); if (tokenizer_ext) { phpDocumentor_out("using tokenizer Parser\n"); $this->parse = new phpDocumentorTParser(); } else { phpDocumentor_out("using default (slower) Parser - get PHP 4.3.0+\nand load the tokenizer extension for faster parsing (your version is " . phpversion() . "\n"); $this->parse = new Parser(); } }
/** * Checks PHP version, makes sure it is 4.2.0+, and chooses the * phpDocumentorTParser if version is 4.3.0+ * @uses parseIni() */ function phpDocumentor_setup() { global $_phpDocumentor_cvsphpfile_exts, $_phpDocumentor_setting; if (!function_exists('is_a')) { print "phpDocumentor requires PHP version 4.2.0 or greater to function"; exit; } $this->setup = new Io(); if (!isset($interface) && !isset($_GET['interface']) && !isset($_phpDocumentor_setting)) { // Parse the argv settings $_phpDocumentor_setting = $this->setup->parseArgv(); } if (isset($_phpDocumentor_setting['useconfig']) && !empty($_phpDocumentor_setting['useconfig'])) { $this->readConfigFile($_phpDocumentor_setting['useconfig']); } // set runtime to a large value since this can take quite a while // we can only set_time_limit when not in safe_mode bug #912064 if (!ini_get('safe_mode')) { set_time_limit(0); // unlimited runtime } else { 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"); } $phpver = phpversion(); $phpdocver = PHPDOCUMENTOR_VER; if (isset($_GET['interface'])) { $phpver = "<b>{$phpver}</b>"; $phpdocver = "<b>{$phpdocver}</b>"; } phpDocumentor_out("PHP Version {$phpver}\n"); phpDocumentor_out("phpDocumentor version {$phpdocver}\n\n"); $this->parseIni(); $this->setMemoryLimit(); if (tokenizer_ext) { phpDocumentor_out("using tokenizer Parser\n"); $this->parse = new phpDocumentorTParser(); } else { phpDocumentor_out("No Tokenizer support detected, so using default (slower) Parser..." . PHP_EOL); if (version_compare(phpversion(), '4.3.0', '<')) { phpDocumentor_out(" for faster parsing, recompile PHP with --enable-tokenizer." . PHP_EOL); } else { phpDocumentor_out(" for faster parsing, recompile PHP without --disable-tokenizer." . PHP_EOL); } $this->parse = new Parser(); } }
/** * Get phpDocumentor settings from command-line or web interface */ function readCommandLineSettings() { global $_phpDocumentor_setting, $interface, $_phpDocumentor_RIC_files; // subscribe $render class to $parse class events if (!isset($interface) && !isset($_GET['interface']) && !isset($_phpDocumentor_setting)) { // Parse the argv settings $_phpDocumentor_setting = $this->setup->parseArgv(); } if (isset($_phpDocumentor_setting['useconfig']) && !empty($_phpDocumentor_setting['useconfig'])) { return $this->readConfigFile($_phpDocumentor_setting['useconfig']); } if (!isset($_phpDocumentor_setting['junk'])) { $_phpDocumentor_setting['junk'] = ''; } if (!isset($_phpDocumentor_setting['title'])) { $_phpDocumentor_setting['title'] = 'Generated Documentation'; } $temp_title = $_phpDocumentor_setting['title']; $this->render = new phpDocumentor_IntermediateParser($temp_title); if (isset($_phpDocumentor_setting['help']) || $_phpDocumentor_setting['junk'] == "-h" || $_phpDocumentor_setting['junk'] == "--help") { echo $this->setup->displayHelpMsg(); die; } if (isset($_phpDocumentor_setting['hidden'])) { $this->hidden = true; } // set to parse elements marked private with @access private if (isset($_phpDocumentor_setting['parseprivate']) && $_phpDocumentor_setting['parseprivate'] == 'on') { $this->render->setParsePrivate(true); } if (isset($_phpDocumentor_setting['ignoretags'])) { $_phpDocumentor_setting['ignoretags'] = explode(',', str_replace(' ', '', $_phpDocumentor_setting['ignoretags'])); $tags = array(); foreach ($_phpDocumentor_setting['ignoretags'] as $tag) { if (!in_array($tag, array('@global', '@access', '@package', '@ignore', '@name', '@param', '@return', '@staticvar', '@var'))) { $tags[] = $tag; } } $_phpDocumentor_setting['ignore-tags'] = $tags; } if (isset($_phpDocumentor_setting['readmeinstallchangelog'])) { $_phpDocumentor_setting['readmeinstallchangelog'] = explode(',', str_replace(' ', '', $_phpDocumentor_setting['readmeinstallchangelog'])); $rics = array(); foreach ($_phpDocumentor_setting['readmeinstallchangelog'] as $ric) { $rics[] = strtoupper(trim($ric)); } $_phpDocumentor_RIC_files = $rics; } if (isset($_phpDocumentor_setting['javadocdesc']) && $_phpDocumentor_setting['javadocdesc'] == 'on') { $this->parse->eventHandlers[PARSER_EVENT_DOCBLOCK] = 'JavaDochandleDocblock'; } if (tokenizer_ext) { if (isset($_phpDocumentor_setting['sourcecode']) && $_phpDocumentor_setting['sourcecode'] == 'on') { $_phpDocumentor_setting['sourcecode'] = true; } else { $_phpDocumentor_setting['sourcecode'] = false; } } else { if (isset($_phpDocumentor_setting['sourcecode']) && $_phpDocumentor_setting['sourcecode'] == 'on') { addWarning(PDERROR_SOURCECODE_IGNORED); } $_phpDocumentor_setting['sourcecode'] = false; } if (isset($_phpDocumentor_setting['converterparams'])) { $_phpDocumentor_setting['converterparams'] = explode($_phpDocumentor_setting['converterparams']); foreach ($_phpDocumentor_setting['converterparams'] as $i => $p) { $_phpDocumentor_setting['converterparams'][$i] = trim($p); } } if (isset($_phpDocumentor_setting['customtags']) && !empty($_phpDocumentor_setting['customtags'])) { $c = explode(',', $_phpDocumentor_setting['customtags']); for ($i = 0; $i < count($c); $i++) { $GLOBALS['_phpDocumentor_tags_allowed'][] = trim($c[$i]); } } if (isset($_phpDocumentor_setting['pear'])) { if ($_phpDocumentor_setting['pear'] === 'off') { $_phpDocumentor_setting['pear'] = false; } if ($_phpDocumentor_setting['pear'] === 'on') { $_phpDocumentor_setting['pear'] = true; } } if (!isset($_phpDocumentor_setting['pear'])) { $_phpDocumentor_setting['pear'] = false; } // set to change the default package name from "default" to whatever you want if (isset($_phpDocumentor_setting['defaultpackagename'])) { $GLOBALS['phpDocumentor_DefaultPackageName'] = trim($_phpDocumentor_setting['defaultpackagename']); } // set to change the default category name from "default" to whatever you want if (isset($_phpDocumentor_setting['defaultcategoryname'])) { $GLOBALS['phpDocumentor_DefaultCategoryName'] = trim($_phpDocumentor_setting['defaultcategoryname']); } // set the mode (quiet or verbose) if (isset($_phpDocumentor_setting['quiet']) || strcasecmp($_phpDocumentor_setting['junk'], "-q") == 0 || strcasecmp($_phpDocumentor_setting['junk'], "--quiet") == 0) { if (isset($_phpDocumentor_setting['quiet']) && $_phpDocumentor_setting['quiet'] != 'on') { } else { $this->render->setQuietMode(true); } } // Setup the different classes if (isset($_phpDocumentor_setting['templatebase'])) { $this->render->setTemplateBase($_phpDocumentor_setting['templatebase']); } if (isset($_phpDocumentor_setting['target']) && !empty($_phpDocumentor_setting['target'])) { $this->render->setTargetDir($_phpDocumentor_setting['target']); } else { echo "a target directory must be specified\n try phpdoc -h\n"; die; } if (!empty($_phpDocumentor_setting['packageoutput'])) { $this->packages = explode(",", $_phpDocumentor_setting['packageoutput']); foreach ($this->packages as $p => $v) { $this->packages[$p] = trim($v); } } if (!empty($_phpDocumentor_setting['filename'])) { $this->files = $_phpDocumentor_setting['filename']; } if (!empty($_phpDocumentor_setting['directory'])) { $this->dirs = $_phpDocumentor_setting['directory']; } }