Esempio n. 1
0
 function generate()
 {
     if (!file_exists($this->output)) {
         mkdir($this->output);
     }
     if (!is_dir($this->output)) {
         throw new \Exception("'" . $this->output . "' is not a directory");
     }
     // set up template locations
     PageRenderer::addTemplatesLocation(__DIR__ . "/../templates");
     foreach ($this->options['templates'] as $template) {
         PageRenderer::addTemplatesLocation($template);
     }
     PageRenderer::addStylesheet("default.css");
     // TODO delete all files within it?
     $this->generateFile("index", $this->database);
     foreach ($this->database->getNamespaces() as $namespace) {
         $this->generateFile("namespace", $namespace, array('namespace' => $namespace));
         foreach ($namespace->getClasses() as $class) {
             $this->generateFile("class", $class, array('namespace' => $namespace, 'class' => $class));
         }
         foreach ($namespace->getInterfaces() as $interface) {
             $this->generateFile("interface", $interface, array('namespace' => $namespace, 'interface' => $interface));
         }
     }
     // copy over CSS
     copy(__DIR__ . "/../templates/default.css", $this->output . "default.css");
 }
Esempio n. 2
0
 public function render($arguments)
 {
     PageRenderer::addTemplatesLocation(__DIR__ . "/../templates");
     Permissions::need("exceptions");
     PageRenderer::header(array("title" => t("Exception list"), "id" => "page_exception_list"));
     $limit = isset($arguments['limit']) ? $arguments['limit'] : 10;
     $class = isset($arguments['limit']) ? $arguments['limit'] : null;
     $important = isset($arguments['important']) ? $arguments['important'] : null;
     $ignored = isset($arguments['ignored']) ? $arguments['ignored'] : null;
     $q = db()->prepare("SELECT * FROM uncaught_exceptions ORDER BY id desc LIMIT " . (int) $limit);
     $q->execute();
     $exceptions = $q->fetchAll();
     PageRenderer::requireTemplate("exception_list", array("exceptions" => $exceptions, "url" => url_for($this->getPath(), array("limit" => $limit, "class" => $class, "important" => $important, "ignored" => $ignored))));
     PageRenderer::footer();
 }
Esempio n. 3
0
<?php

// router.php
require __DIR__ . "/../inc/global.php";
$path = require_get("path", "index");
use Pages\PageRenderer;
use Openclerk\Router;
PageRenderer::addTemplatesLocation(__DIR__ . "/../templates");
PageRenderer::addTemplatesLocation(__DIR__ . "/../config/templates");
/**
 * Include compiled header code, this was a hack to work around
 * Grunt/build/deploy issues. TODO clean this up and remove this workaround
 */
function include_head_compiled()
{
    echo "<!-- compiled head -->";
    $head_compiled = __DIR__ . "/head-compiled.html";
    if (file_exists($head_compiled)) {
        require $head_compiled;
    } else {
        // fix relative paths
        $input = file_get_contents(__DIR__ . "/../layout/head.html");
        $input = str_replace("src=\"", "src=\"" . htmlspecialchars(calculate_relative_path()), $input);
        echo $input;
    }
    echo "<!-- /compiled head -->";
}
try {
    \Openclerk\Router::process($path);
} catch (\Openclerk\RouterException $e) {
    header("HTTP/1.0 404 Not Found");
Esempio n. 4
0
<?php

require __DIR__ . "/../vendor/autoload.php";
require __DIR__ . "/functions.php";
// set up config
Openclerk\Config::merge(array("site_name" => "genealogy", "absolute_url" => is_localhost() ? "http://localhost/genealogy/" : "http://example.com/", "display_errors" => is_localhost()));
// set up routes
\Openclerk\Router::addRoutes(array(":page" => "pages/:page.php"));
// set up pages
\Pages\PageRenderer::addTemplatesLocation(__DIR__ . "/../site/templates");
\Pages\PageRenderer::addStylesheet(\Openclerk\Router::urlFor("css/default.css"));
\Pages\PageRenderer::addJavascript("https://code.jquery.com/jquery-2.1.1.min.js");
\Pages\PageRenderer::addJavascript(\Openclerk\Router::urlFor("js/default.js"));
require __DIR__ . "/tree.php";