Example #1
0
<?php

//You'll need to change the password for the database to your root password if you wish to run this locally.
//Also, you need the following rewrite rule in Apache:
//	RewriteEngine on
//	RewriteCond %{REQUEST_URI} !(index\.php|\.svg|\.png|\.jpe?g|\.ico)
//	RewriteRule ^(.+)$ /index.php?page=$1 [L,QSA]
//This required PHP 5.6.6. If you do not have it, the inheritance properties of the class constants will cause it to fail to compile.
namespace {
    document::load();
    class conf
    {
        const js_root = '_.js';
        const css_root = '_.css';
    }
    class document
    {
        /**/
        function mime($c)
        {
            $mime = !strpos($_GET['page'][$c], '.js') && !strpos($_GET['page'][$c], '.css') ? 'html' : (strpos($_GET['page'][$c], '.css') ? 'css' : 'js');
            header("Content-type: text/{$mime}");
            $dot = strpos($_GET['page'][$c], '.');
            if ($dot && $mime === 'html') {
                $_GET['page'][$c] = substr($_GET['page'][$c], 0, $dot);
            }
            return $mime;
        }
        function load()
        {
            $_GET['page'] = explode('/', $_GET['page']);