Example #1
0
    $dom->head->append('link', null, ['rel' => 'stylesheet', 'href' => 'stylesheets/styles/import.css', 'media' => 'all']);
    $dom->body->append('header')->append('h1', 'HTTP-OS');
    $dom->body->append('a', 'Home', ['href' => $url]);
    $details = $dom->body->append('main')->append('details');
    $details('summary', 'Included files');
    $footer = $dom->body->append('footer');
    \shgysk8zer0\Core\ArrayObject::from(['mark-github' => 'https://github.com/SuperUser/HTTP-OS', 'issue-opened' => 'https://github.com/SuperUser/HTTP-OS/issues', 'mail' => 'mailto:shgysk8zer0@gmail.com', 'Facebook' => '#', 'twitter' => 'https://twitter.com/shgysk8zer0', 'Google_plus' => 'https://plus/google.com/+ChrisZuber'])->map(function ($link, $icon) use($footer) {
        $footer('a', null, ['href' => $link, 'target' => '_blank'])->append('svg', null, ['width' => 50, 'height' => 50])->append('use', null, ['xlink:href' => "combined.svg#{$icon}"]);
    });
    // $svg = $footer('a', null, [
    // 	'href' => 'https://github.com/SuperUser/HTTP-OS',
    // 	'target' => '_blank'
    // 	])->append('svg', null, ['height' => 50, 'width' => 50]);
    // $svg('use', null, ['xlink:href' => 'combined.svg#mark-github']);
    // List all included files
    \shgysk8zer0\Core\ArrayObject::from(get_included_files())->reduce(function (\DOMElement $list, $file) {
        $list('li', $file);
        return $list;
    }, $details('ol'));
    // Log loading time and exit
    $console->info("Loaded in {$timer} seconds.");
    $console->log($dom);
    exit($dom);
} elseif (in_array('application/json', explode(',', $headers->accept))) {
    $headers->content_type = 'application/json';
    $resp = new \shgysk8zer0\Core\JSON_Response();
    $resp->notify('HTTP-OS', 'Hello World');
    exit($resp);
} else {
    http_response_code(\shgysk8zer0\Core_API\Abstracts\HTTPStatusCodes::NOT_ACCEPTABLE);
}