Changeset 516 in t29-www for lib/loader.php


Ignore:
Timestamp:
Feb 19, 2014, 12:39:35 PM (5 years ago)
Author:
sven
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/loader.php

    r357 r516  
    99 *
    1010 **/
    11  
    12 if(!defined('T29_GRAB_LOADER_DEFS')) {
    13         $lib = dirname(__FILE__);
    14         $webroot = realpath("$lib/../");  # file path to root of t29 web installation
    1511
    16         if(!isset($_GET['type'])) {
    17                 print "<html><pre>The t29v6 Ressource loader.\n";
    18                 print "Provide ?type=js or ?type=css.\n";
    19                 print '<a href="https://labs.technikum29.de/browser/technikum29%20Website/lib/loader.php">Read my sourcecode</a>';
    20                 exit;
    21         }
    22 }
     12$lib = dirname(__FILE__);
     13$webroot = realpath("$lib/../");  # file path to root of t29 web installation
    2314
    24 $types = array('js', 'css'); // mapping position (numeric key) => $conf array position
    25 $conf = array(
    26         'cache_file' => array('compressed.js', 'style.css'),
    27         'module_dir' => array("$webroot/shared/js-v6/modules", "$webroot/shared/css-v6/modules"),
    28         'page_dir' => array("$webroot/shared/js-v6/pagescripts", "$webroot/shared/css-v6/pagestyles"),
    29         'glob_pattern' => array('*.js', '*.css'),
    30         'content_types' => array('application/javascript', 'text/css'),
    31         'class' => array('t29JavaScriptRessourceLoader', 't29StyleSheetRessourceLoader'),
    32         'modules' => function($conf){ return glob($conf['module_dir'] . '/' . $conf['glob_pattern']); },
    33 );
    34 $conf_for_type = function($type, $debug_flag=false) use ($conf, $types) {
    35         $typepos = array_search($type, $types);
    36         if($typepos === FALSE) return null;
    37         array_walk($conf, function(&$val, $key) use($typepos) { if(is_array($val)) $val = $val[$typepos]; });
    38         $conf['type'] = $type;
    39         $conf['modules'] = call_user_func($conf['modules'], $conf);
    40         $conf['debug'] = $debug_flag; // skip cache and just concat everything
    41         return $conf;
    42 };
     15require_once "$lib/host.php";
     16$host = t29Host::detect();
    4317
    44 if(defined('T29_GRAB_LOADER_DEFS')) {
    45         return; // just grab the vars in the local scope
     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;
    4623}
    4724
    4825$type = $_GET['type'];
    49 $conf = $conf_for_type($type, isset($_GET['debug']));
     26$conf = $host->get_ressources($type, $webroot, isset($_GET['debug']));  //$conf_for_type($type, isset($_GET['debug']));
    5027if($conf == null)
    5128        die("Illegal type. Valid types are: ". implode($types));
Note: See TracChangeset for help on using the changeset viewer.
© 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