Showing
1 changed file
with
90 additions
and
87 deletions
1 | -<?php | ||
2 | -/** | ||
3 | - * Front controller for default Minify implementation | ||
4 | - * | ||
5 | - * DO NOT EDIT! Configure this utility via config.php and groupsConfig.php | ||
6 | - * | ||
7 | - * @package Minify | ||
8 | - */ | ||
9 | - | ||
10 | -define('MINIFY_MIN_DIR', dirname(__FILE__)); | ||
11 | - | ||
12 | -// set config path defaults | ||
13 | -$min_configPaths = array( | ||
14 | - 'base' => MINIFY_MIN_DIR . '/config.php', | ||
15 | - 'test' => MINIFY_MIN_DIR . '/config-test.php', | ||
16 | - 'groups' => MINIFY_MIN_DIR . '/groupsConfig.php' | ||
17 | -); | ||
18 | - | ||
19 | -// check for custom config paths | ||
20 | -if (!empty($min_customConfigPaths) && is_array($min_customConfigPaths)) { | ||
21 | - $min_configPaths = array_merge($min_configPaths, $min_customConfigPaths); | ||
22 | -} | ||
23 | - | ||
24 | -// load config | ||
25 | -require $min_configPaths['base']; | ||
26 | - | ||
27 | -if (isset($_GET['test'])) { | ||
28 | - include $min_configPaths['test']; | ||
29 | -} | ||
30 | - | ||
31 | -require "$min_libPath/Minify/Loader.php"; | ||
32 | -Minify_Loader::register(); | ||
33 | - | ||
34 | -Minify::$uploaderHoursBehind = $min_uploaderHoursBehind; | ||
35 | -Minify::setCache( | ||
36 | - isset($min_cachePath) ? $min_cachePath : '' | ||
37 | - ,$min_cacheFileLocking | ||
38 | -); | ||
39 | - | ||
40 | -if ($min_documentRoot) { | ||
41 | - $_SERVER['DOCUMENT_ROOT'] = $min_documentRoot; | ||
42 | - Minify::$isDocRootSet = true; | ||
43 | -} | ||
44 | - | ||
45 | -$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks; | ||
46 | -// auto-add targets to allowDirs | ||
47 | -foreach ($min_symlinks as $uri => $target) { | ||
48 | - $min_serveOptions['minApp']['allowDirs'][] = $target; | ||
49 | -} | ||
50 | - | ||
51 | -if ($min_allowDebugFlag) { | ||
52 | - $min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($_COOKIE, $_GET, $_SERVER['REQUEST_URI']); | ||
53 | -} | ||
54 | - | ||
55 | -if ($min_errorLogger) { | ||
56 | - if (true === $min_errorLogger) { | ||
57 | - $min_errorLogger = FirePHP::getInstance(true); | ||
58 | - } | ||
59 | - Minify_Logger::setLogger($min_errorLogger); | ||
60 | -} | ||
61 | - | ||
62 | -// check for URI versioning | ||
63 | -if (preg_match('/&\\d/', $_SERVER['QUERY_STRING']) || isset($_GET['v'])) { | ||
64 | - $min_serveOptions['maxAge'] = 31536000; | ||
65 | -} | ||
66 | - | ||
67 | -// need groups config? | ||
68 | -if (isset($_GET['g']) && isset($_GET['site'])) { | ||
69 | - // well need groups config | ||
70 | - $min_serveOptions['minApp']['groups'] = (require MINIFY_MIN_DIR . '/groupConfig/'.$_GET['site'].'.php'); | ||
71 | - $min_configPaths['groups'] = MINIFY_MIN_DIR . '/groupConfig/'.$_GET['site'].'.php'; | ||
72 | -} | ||
73 | - | ||
74 | -// serve or redirect | ||
75 | -if (isset($_GET['f']) || isset($_GET['g'])) { | ||
76 | - if (! isset($min_serveController)) { | ||
77 | - $min_serveController = new Minify_Controller_MinApp(); | ||
78 | - } | ||
79 | - Minify::serve($min_serveController, $min_serveOptions); | ||
80 | - | ||
81 | -} elseif ($min_enableBuilder) { | ||
82 | - header('Location: builder/'); | ||
83 | - exit; | ||
84 | -} else { | ||
85 | - header('Location: /'); | ||
86 | - exit; | ||
87 | -} | 1 | +<?php |
2 | +/** | ||
3 | + * Front controller for default Minify implementation | ||
4 | + * | ||
5 | + * DO NOT EDIT! Configure this utility via config.php and groupsConfig.php | ||
6 | + * | ||
7 | + * @package Minify | ||
8 | + */ | ||
9 | + | ||
10 | +define('MINIFY_MIN_DIR', dirname(__FILE__)); | ||
11 | + | ||
12 | +// set config path defaults | ||
13 | +$min_configPaths = array( | ||
14 | + 'base' => MINIFY_MIN_DIR . '/config.php', | ||
15 | + 'test' => MINIFY_MIN_DIR . '/config-test.php', | ||
16 | + 'groups' => MINIFY_MIN_DIR . '/groupsConfig.php' | ||
17 | +); | ||
18 | + | ||
19 | +// check for custom config paths | ||
20 | +if (!empty($min_customConfigPaths) && is_array($min_customConfigPaths)) { | ||
21 | + $min_configPaths = array_merge($min_configPaths, $min_customConfigPaths); | ||
22 | +} | ||
23 | + | ||
24 | +// load config | ||
25 | +require $min_configPaths['base']; | ||
26 | + | ||
27 | +if (isset($_GET['test'])) { | ||
28 | + include $min_configPaths['test']; | ||
29 | +} | ||
30 | + | ||
31 | +require "$min_libPath/Minify/Loader.php"; | ||
32 | +Minify_Loader::register(); | ||
33 | + | ||
34 | +Minify::$uploaderHoursBehind = $min_uploaderHoursBehind; | ||
35 | +Minify::setCache( | ||
36 | + isset($min_cachePath) ? $min_cachePath : '' | ||
37 | + ,$min_cacheFileLocking | ||
38 | +); | ||
39 | + | ||
40 | +if ($min_documentRoot) { | ||
41 | + $_SERVER['DOCUMENT_ROOT'] = $min_documentRoot; | ||
42 | + Minify::$isDocRootSet = true; | ||
43 | +} | ||
44 | + | ||
45 | +$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks; | ||
46 | +// auto-add targets to allowDirs | ||
47 | +foreach ($min_symlinks as $uri => $target) { | ||
48 | + $min_serveOptions['minApp']['allowDirs'][] = $target; | ||
49 | +} | ||
50 | + | ||
51 | +if ($min_allowDebugFlag) { | ||
52 | + $min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($_COOKIE, $_GET, $_SERVER['REQUEST_URI']); | ||
53 | +} | ||
54 | + | ||
55 | +if ($min_errorLogger) { | ||
56 | + if (true === $min_errorLogger) { | ||
57 | + $min_errorLogger = FirePHP::getInstance(true); | ||
58 | + } | ||
59 | + Minify_Logger::setLogger($min_errorLogger); | ||
60 | +} | ||
61 | + | ||
62 | +// check for URI versioning | ||
63 | +if (preg_match('/&\\d/', $_SERVER['QUERY_STRING']) || isset($_GET['v'])) { | ||
64 | + $min_serveOptions['maxAge'] = 31536000; | ||
65 | +} | ||
66 | + | ||
67 | +// need groups config? | ||
68 | +if (isset($_GET['g']) && isset($_GET['site'])) { | ||
69 | + if(!file_exists(MINIFY_MIN_DIR . '/groupConfig/'.$_GET['site'].'.php')) { | ||
70 | + $_GET['site'] = 'www'; | ||
71 | + } | ||
72 | + // well need groups config | ||
73 | + $min_serveOptions['minApp']['groups'] = (require MINIFY_MIN_DIR . '/groupConfig/'.$_GET['site'].'.php'); | ||
74 | + $min_configPaths['groups'] = MINIFY_MIN_DIR . '/groupConfig/'.$_GET['site'].'.php'; | ||
75 | +} | ||
76 | + | ||
77 | +// serve or redirect | ||
78 | +if (isset($_GET['f']) || isset($_GET['g'])) { | ||
79 | + if (! isset($min_serveController)) { | ||
80 | + $min_serveController = new Minify_Controller_MinApp(); | ||
81 | + } | ||
82 | + Minify::serve($min_serveController, $min_serveOptions); | ||
83 | + | ||
84 | +} elseif ($min_enableBuilder) { | ||
85 | + header('Location: builder/'); | ||
86 | + exit; | ||
87 | +} else { | ||
88 | + header('Location: /'); | ||
89 | + exit; | ||
90 | +} |
-
Please register or login to post a comment