Example #1
0
<?php

/**
 * @package    EasyCreator
 * @subpackage Views
 * @author     Nikolai Plath
 * @author     Created on 30-Sep-2009
 * @license    GNU/GPL, see JROOT/LICENSE.php
 */
//-- No direct access
defined('_JEXEC') || die('=;)');
$phpDoc = new EcrPearHelperPhpdoc();
if (!$phpDoc->checkEnv()) {
    echo 'Environment check failed.. cannot continue :(';
    return;
}
$dirs = array();
$files = array();
foreach ($this->project->copies as $dir) {
    if (is_dir(JPATH_ROOT . DS . $dir['source'])) {
        $d = str_replace(JPATH_ROOT . DS, '', $dir);
        $dirs[] = $d;
    } else {
        $d = str_replace(JPATH_ROOT . DS, '', $dir);
        $files[] = $d;
    }
}
$sDirs = implode(',', $dirs);
$sFiles = implode(',', $files);
$phpDoc->targetDir = JPATH_ROOT . DS . 'documentation' . DS . $this->project->comName;
$options = array();
Example #2
0
 /**
  * Runs PHPDocumentor.
  *
  * @return void
  */
 public function phpdoc()
 {
     $input = JFactory::getApplication()->input;
     $response = array();
     $parseDirs = $input->get('parse_dirs');
     $parseFiles = $input->get('parse_files');
     $targetDir = $input->get('target_dir');
     $converter = $input->get('converter');
     $options = $input->get('options');
     $phpDoc = new EcrPearHelperPhpdoc();
     if ($converter) {
         $cs = explode(':', $converter);
         $phpDoc->outputFormat = $cs[0];
         $phpDoc->converter = $cs[1];
         $phpDoc->template = $cs[2];
     }
     $parseDirs = explode(',', $parseDirs);
     $a = array();
     foreach ($parseDirs as $n) {
         $a[] = JPATH_ROOT . DS . $n;
     }
     $parseDirs = implode(',', $a);
     $parseFiles = explode(',', $parseFiles);
     $a = array();
     foreach ($parseFiles as $n) {
         $a[] = JPATH_ROOT . DS . $n;
     }
     $parseFiles = implode(',', $a);
     $phpDoc->parseDirs = $parseDirs;
     $phpDoc->parseFiles = $parseFiles;
     $phpDoc->targetDir = JPATH_ROOT . DS . $targetDir;
     ob_start();
     $results = $phpDoc->process($options);
     $add = ob_get_contents();
     ob_end_clean();
     $response['console'] = htmlentities($results);
     if (!JFile::exists(JPATH_ROOT . DS . $targetDir . DS . 'index.html')) {
         $response['status'] = 0;
         $response['text'] = jgettext('Something went wrong...');
         echo json_encode($response);
         return;
     }
     $response['status'] = 1;
     $response['text'] = '';
     $response['text'] .= '<h1>' . jgettext('Documentation has been created') . '</h1>';
     $response['text'] .= '<a class="external" href="' . JURI::root(true) . '/' . str_replace(DS, '/', $targetDir) . '">' . jgettext('View Documentation') . '</a>' . BR;
     $response['text'] .= '<a class="external" href="' . JURI::root(true) . '/' . str_replace(DS, '/', $targetDir . '/errors.html') . '">' . jgettext('View Errors') . '</a>' . BR;
     $response['text'] .= $add;
     echo json_encode($response);
     jexit();
 }