⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.php

📁 这个类可以用来生成文件的Javascript脚本。 它可以扫描的Javascript脚本文件和提取文件标签在JavaScript意见类似与JavaDoc标签。 该文件可以生成HTML中
💻 PHP
字号:
<?php

/**
 * Converte os caracteres especiais em entidades HTML.
 *
 * @param string $string String
 * @return string
 */
function h($string)
{
    return nl2br(htmlentities($string, ENT_QUOTES));
}

/**
 * Fun玢o chamada para iniciar a cria玢o da Documenta玢o.
 *
 * @param JSPD_Project $project Projeto
 * @param string $path Diret髍io de destino
 */
function jspd_default(JSPD_Project $project, $path)
{
    // Criando o menu
    ob_start();
    include('menu.tpl.php');
    $contents = ob_get_contents();
    $contents = preg_replace('/<ul>\s*<\/ul>/', '', $contents);
    file_put_contents($path . DIRECTORY_SEPARATOR . 'index.htm', $contents);
    ob_end_clean();
    // Criando os descritores dos arquivos
    foreach ($project->getFiles() as $file) {
        ob_start();
        include('file.tpl.php');
        $contents = ob_get_contents();
        $contents = preg_replace('/<ul>\s*<\/ul>/', '', $contents);
        file_put_contents($path . DIRECTORY_SEPARATOR . $file->getId() . '.htm', $contents);
        ob_end_clean();
    }
    // Criando os descritores das classes
    foreach ($project->getClasses() as $class) {
        ob_start();
        include('class.tpl.php');
        $contents = ob_get_contents();
        $contents = preg_replace('/<ul>\s*<\/ul>/', '', $contents);
        file_put_contents($path . DIRECTORY_SEPARATOR . $class->getId() . '.htm', $contents);
        ob_end_clean();
    }
    copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'default.css', $path . DIRECTORY_SEPARATOR . 'default.css');
}

/**
 * Cria os links de tipos baseando-se nas classes do Projeto.
 *
 * @param JSPD_Project $project Projeto
 * @param string $type Tipo
 * @return string
 */
function jspd_default_link_type(JSPD_Project $project, $type)
{
    $type = explode('|', $type);
    $type = array_map('trim', $type);
    $n    = count($type);
    for ($i = 0; $i < $n; $i++) {
        $t = $type[$i];
        if ($t == '') {
            $t = 'Unknown';
        } elseif ($class = $project->getClass($t)) {
            $t = "<a href=\"{$class->getId()}.htm\">$t</a>";
        }
        $type[$i] = "<span class=\"italic\">$t</span>";
    }
    return implode('|', $type);
}

/**
 * Cria a string de par鈓etros de uma fun玢o/m閠odo.
 *
 * @param JSPD_Project $project Projeto
 * @param JSPD_Function $func Fun玢o/M閠odo
 * @return string
 */
function jspd_default_func_params(JSPD_Project $project, JSPD_Function $func)
{
    $params = array();
    foreach ($func->getParams() as $param) {
        $str      = jspd_default_link_type($project, $param->getType()) . " {$param->getName()}";
        if ($param->isOptional()) {
            $str = "<span class=\"italic\">[$str]</span>";
        }
        $params[] = $str;
    }
    return implode(', ', $params);
}

/**
 * Retorna a string de rodap

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -