Exemple #1
0
 /**
  * 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($_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;
     }
     // set to parse hidden files
     $this->hidden = isset($_phpDocumentor_setting['hidden']) ? decideOnOrOff($_phpDocumentor_setting['hidden']) : false;
     // set to parse through symlinks
     $this->ignoresymlinks = isset($_phpDocumentor_setting['ignoresymlinks']) ? decideOnOrOff($_phpDocumentor_setting['ignoresymlinks']) : false;
     // set to parse elements marked private with @access private
     $this->render->setParsePrivate(isset($_phpDocumentor_setting['parseprivate']) ? decideOnOrOff($_phpDocumentor_setting['parseprivate']) : false);
     // set to print warnings when undocumented elements are spotted
     $this->render->setUndocumentedElementWarningsMode(isset($_phpDocumentor_setting['undocumentedelements']) ? decideOnOrOff($_phpDocumentor_setting['undocumentedelements']) : false);
     if (isset($_phpDocumentor_setting['ignoretags'])) {
         $ignoretags = explode(',', $_phpDocumentor_setting['ignoretags']);
         $ignoretags = array_map('trim', $ignoretags);
         $tags = array();
         foreach ($ignoretags as $tag) {
             if (!in_array($tag, array('@global', '@access', '@package', '@ignore', '@name', '@param', '@return', '@staticvar', '@var'))) {
                 $tags[] = $tag;
             }
         }
         $_phpDocumentor_setting['ignoretags'] = $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)
     $this->render->setQuietMode(isset($_phpDocumentor_setting['quiet']) ? decideOnOrOff($_phpDocumentor_setting['quiet']) : false);
     // Setup the different classes
     if (isset($_phpDocumentor_setting['templatebase'])) {
         $GLOBALS['_phpDocumentor_template_base'] = trim($_phpDocumentor_setting['templatebase']);
         $this->render->setTemplateBase($GLOBALS['_phpDocumentor_template_base']);
     }
     if (isset($_phpDocumentor_setting['target']) && !empty($_phpDocumentor_setting['target'])) {
         $this->render->setTargetDir(trim($_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(",", trim($_phpDocumentor_setting['packageoutput']));
         foreach ($this->packages as $p => $v) {
             $this->packages[$p] = trim($v);
         }
     }
     if (!empty($_phpDocumentor_setting['filename'])) {
         $this->files = trim($_phpDocumentor_setting['filename']);
     }
     if (!empty($_phpDocumentor_setting['directory'])) {
         $this->dirs = trim($_phpDocumentor_setting['directory']);
     }
 }
 /**
  * Shows correct behavior for handling an odd "ash nazg durbatuluk" value
  * @since 1.3.2
  */
 public function testUnexpectedGreatLiterature()
 {
     $this->assertFalse(decideOnOrOff("ash nazg durbatuluk"));
 }