示例#1
0
文件: parse.php 项目: rair/yacs
// load the skin
load_skin('scripts');
// the path to this page
$context['path_bar'] = array('scripts/' => i18n::s('Server software'));
// the title of the page
if ($script) {
    $context['page_title'] = $script;
} else {
    $context['page_title'] = i18n::s('View PHP documentation');
}
// no script has been provided
if (!$script) {
    Logger::error(i18n::s('No script has been provided.'));
    // the script has to be there
} elseif (!file_exists($translated)) {
    Logger::error(i18n::s('Script does not exist.'));
} else {
    include_once 'phpdoc.php';
    $tool = new PhpDoc();
    // parse the file
    $context['text'] .= $tool->parse($script, '');
    // generate the php documentation for this script
    //	$context['page_title'] = $tool->index[$script];
    $context['text'] .= Codes::beautify('[toc] ' . $tool->comments[$script]);
    // menu bar
    $context['page_tools'][] = Skin::build_link('scripts/browse.php?script=' . $script, i18n::s('Browse'));
    $context['page_tools'][] = Skin::build_link('scripts/fetch.php?script=' . $script, i18n::s('Fetch'));
    $context['page_tools'][] = Skin::build_link('scripts/', i18n::s('Server software'));
}
// render the skin
render_skin();
示例#2
0
文件: build.php 项目: rair/yacs
 // analyse each script
 $index = 0;
 foreach ($references as $reference) {
     // use file content
     list($module, $name) = $reference;
     if ($module) {
         $file = $module . '/' . $name;
     } else {
         $file = $name;
     }
     // look only into  php script
     if (!preg_match('/\\.php$/i', $name)) {
         continue;
     }
     // look at phpDoc blocks
     if ($text = $documentation->parse($file, $context['path_to_reference'])) {
         $context['text'] .= $text . BR . "\n";
     } elseif (isset($documentation->index[$file]) && $documentation->index[$file]) {
         $context['text'] .= $documentation->index[$file] . BR . "\n";
     } else {
         $context['text'] .= sprintf(i18n::s('*** %s has no documentation block'), $file) . BR . "\n";
     }
     // update footprints
     if (!isset($footprints[$file]) && ($footprint = Scripts::hash($context['path_to_reference'] . $file))) {
         $footprints[$file] = $footprint;
     }
     // ensure we have enough time to process next script
     Safe::set_time_limit(30);
     // avoid timeouts
     if (!($index++ % 50)) {
         Safe::set_time_limit(30);