source: t29-www/lib/loader.php @ 910

Last change on this file since 910 was 516, checked in by sven, 10 years ago

Bug #51 gefixt (http://labs.technikum29.de/ticket/51).
Jetzt sollten neue Pagestyles gleich beim Erstellen erkannt werden.

File size: 1.9 KB
Line 
1<?php
2/**
3 * t29 ressource loading system.
4 *
5 * Entry point for loading javascript and css style sheet files in a bundled and
6 * compressed manner, including caching. This file only checks up the caches and
7 * contains the main configuration. See ressourceloader.php for all constructing
8 * code.
9 *
10 **/
11
12$lib = dirname(__FILE__);
13$webroot = realpath("$lib/../");  # file path to root of t29 web installation
14
15require_once "$lib/host.php";
16$host = t29Host::detect();
17
18if(!isset($_GET['type'])) {
19        print "<html><pre>The t29v6 Ressource loader.\n";
20        print "Provide ?type=js or ?type=css.\n";
21        print '<a href="https://labs.technikum29.de/browser/technikum29%20Website/lib/loader.php">Read my sourcecode</a>';
22        exit;
23}
24
25$type = $_GET['type'];
26$conf = $host->get_ressources($type, $webroot, isset($_GET['debug']));  //$conf_for_type($type, isset($_GET['debug']));
27if($conf == null)
28        die("Illegal type. Valid types are: ". implode($types));
29extract($conf); // for saving long human reading times :D
30
31require "$lib/cache.php";
32$js_cache = new t29Cache();
33$js_cache->test_files = $modules;
34$js_cache->set_cache_file($webroot, $cache_file);
35
36header("Content-Type: $content_types");
37if(!$debug) $js_cache->try_cache_and_exit();
38
39# so we are still in the game
40require "$lib/ressourceloader.php";
41$loader = new $class($conf);
42// TODO: there is a known bug with the filter function issue: Since t29Host variable web prefixes the
43//       filter function for CSS also does path rewriting which doesn't work when it is in debug mode.
44//       Anyway a page in debug mode also imports all untouched CSS files, anyway
45if(!$debug)
46        $js_cache->start_cache(array(
47                'shutdown_func' => null, // nothing to do afterwards for the cache
48                'filter_func'   => array($loader, 'compression_filter'), // compress if not debugging
49                'write_cache'   => true, // write the cache if not debugging
50        ));
51$loader->run();
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License