Exemplo n.º 1
0
set_exception_handler("handleException");
require_once "./Mini.php";
if (!isset($_GET["module"])) {
    throw new MiniException("No module specified");
}
if (!isset($_GET["type"])) {
    throw new MiniException("No type specified");
}
$modules = array();
$mini = new Mini(MINI_CONFIG);
$type = $_GET["type"];
if ($type !== "css" && $type !== "js") {
    throw new MiniException("Invalid type: {$type}");
}
if ($_GET["module"] === "all") {
    $modules = $mini->get_modules();
} else {
    $modules[] = $mini->get_module($_GET["module"]);
}
header("Content-Type: " . ($type === "css" ? "text/css" : "text/javascript"));
foreach ($modules as $module) {
    if ($_GET["type"] === "css") {
        $module->echo_css(!isset($_GET["nominify"]));
    } else {
        if ($_GET["type"] === "js") {
            $module->echo_js(!isset($_GET["nominify"]));
        }
    }
}
function handleException(Exception $ex)
{