2008-08-29 22:56:34 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Front controller for default Minify implementation
|
|
|
|
*
|
|
|
|
* DO NOT EDIT! Configure this utility via config.php and groupsConfig.php
|
|
|
|
*
|
|
|
|
* @package Minify
|
|
|
|
*/
|
|
|
|
|
|
|
|
define('MINIFY_MIN_DIR', dirname(__FILE__));
|
|
|
|
|
2014-02-05 00:46:08 +11:00
|
|
|
// set config path defaults
|
|
|
|
$min_configPaths = array(
|
|
|
|
'standard' => MINIFY_MIN_DIR . '/config.php',
|
|
|
|
'test' => MINIFY_MIN_DIR . '/config-test.php',
|
|
|
|
'groups' => MINIFY_MIN_DIR . '/groupsConfig.php'
|
2014-02-04 12:37:40 +11:00
|
|
|
);
|
|
|
|
|
2014-02-05 00:46:08 +11:00
|
|
|
// check for custom config paths
|
|
|
|
if (!empty($min_customConfigPaths)) {
|
|
|
|
// check for each config in the custom path
|
|
|
|
foreach ($min_configPaths as $key => $path) {
|
|
|
|
if (!empty($min_customConfigPaths[$key])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!file_exists($min_customConfigPaths[$key])) {
|
2014-02-04 12:37:40 +11:00
|
|
|
continue;
|
|
|
|
}
|
2014-02-05 00:46:08 +11:00
|
|
|
if (!is_readable($min_customConfigPaths[$key])) {
|
2014-02-04 12:37:40 +11:00
|
|
|
continue;
|
|
|
|
}
|
2014-02-05 00:46:08 +11:00
|
|
|
// reassign the path for this config to custom
|
|
|
|
$min_configPaths[$key] = $min_customConfigPaths[$key];
|
2014-02-04 12:37:40 +11:00
|
|
|
}
|
2014-02-05 00:46:08 +11:00
|
|
|
unset($key, $path);
|
2014-02-03 18:19:00 +11:00
|
|
|
}
|
|
|
|
|
2008-08-29 22:56:34 +00:00
|
|
|
// load config
|
2014-02-05 00:57:18 +11:00
|
|
|
require $min_configPaths['standard'];
|
2008-08-29 22:56:34 +00:00
|
|
|
|
2012-03-15 14:00:50 -04:00
|
|
|
if (isset($_GET['test'])) {
|
2014-02-05 00:57:18 +11:00
|
|
|
include $min_configPaths['test'];
|
2012-03-15 14:00:50 -04:00
|
|
|
}
|
|
|
|
|
2012-09-30 17:51:34 -04:00
|
|
|
require "$min_libPath/Minify/Loader.php";
|
|
|
|
Minify_Loader::register();
|
2008-09-18 01:56:29 +00:00
|
|
|
|
|
|
|
Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
|
|
|
|
Minify::setCache(
|
2009-06-30 19:44:55 +00:00
|
|
|
isset($min_cachePath) ? $min_cachePath : ''
|
2008-09-18 01:56:29 +00:00
|
|
|
,$min_cacheFileLocking
|
|
|
|
);
|
2008-08-24 00:30:30 +00:00
|
|
|
|
2009-01-26 00:44:43 +00:00
|
|
|
if ($min_documentRoot) {
|
2009-03-04 16:28:14 +00:00
|
|
|
$_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
|
2011-09-03 20:39:25 -04:00
|
|
|
Minify::$isDocRootSet = true;
|
2008-09-03 19:42:41 +00:00
|
|
|
}
|
2009-01-26 00:44:43 +00:00
|
|
|
|
2009-03-06 02:43:12 +00:00
|
|
|
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
|
Work on: Issue 125, Issue 126, Issue 132, Issue 134, Issue 138, Issue 139, Issue 147, Issue 149, Issue 151, Issue 162, Issue 166
2010-05-09 16:43:47 +00:00
|
|
|
// auto-add targets to allowDirs
|
|
|
|
foreach ($min_symlinks as $uri => $target) {
|
|
|
|
$min_serveOptions['minApp']['allowDirs'][] = $target;
|
|
|
|
}
|
2009-01-28 20:02:25 +00:00
|
|
|
|
2010-05-10 07:44:40 +00:00
|
|
|
if ($min_allowDebugFlag) {
|
2011-09-03 20:18:57 -04:00
|
|
|
$min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($_COOKIE, $_GET, $_SERVER['REQUEST_URI']);
|
2009-01-26 00:44:43 +00:00
|
|
|
}
|
2009-01-28 20:02:25 +00:00
|
|
|
|
|
|
|
if ($min_errorLogger) {
|
|
|
|
if (true === $min_errorLogger) {
|
2010-09-30 04:31:58 +00:00
|
|
|
$min_errorLogger = FirePHP::getInstance(true);
|
2009-01-28 20:02:25 +00:00
|
|
|
}
|
2010-09-30 04:31:58 +00:00
|
|
|
Minify_Logger::setLogger($min_errorLogger);
|
2008-09-05 04:22:57 +00:00
|
|
|
}
|
2009-01-28 20:02:25 +00:00
|
|
|
|
2008-10-28 00:25:40 +00:00
|
|
|
// check for URI versioning
|
|
|
|
if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) {
|
|
|
|
$min_serveOptions['maxAge'] = 31536000;
|
|
|
|
}
|
2008-08-29 22:56:34 +00:00
|
|
|
if (isset($_GET['g'])) {
|
2008-09-18 01:56:29 +00:00
|
|
|
// well need groups config
|
2014-02-05 00:57:18 +11:00
|
|
|
$min_serveOptions['minApp']['groups'] = (require $min_configPaths['groups']);
|
2008-09-18 01:56:29 +00:00
|
|
|
}
|
|
|
|
if (isset($_GET['f']) || isset($_GET['g'])) {
|
|
|
|
// serve!
|
2010-09-30 04:31:58 +00:00
|
|
|
|
|
|
|
if (! isset($min_serveController)) {
|
|
|
|
$min_serveController = new Minify_Controller_MinApp();
|
|
|
|
}
|
|
|
|
Minify::serve($min_serveController, $min_serveOptions);
|
2008-09-18 01:56:29 +00:00
|
|
|
|
2008-09-05 04:22:57 +00:00
|
|
|
} elseif ($min_enableBuilder) {
|
2008-09-03 05:13:52 +00:00
|
|
|
header('Location: builder/');
|
|
|
|
exit();
|
|
|
|
} else {
|
2008-09-05 04:22:57 +00:00
|
|
|
header("Location: /");
|
2008-09-03 05:13:52 +00:00
|
|
|
exit();
|
2014-02-03 18:19:00 +11:00
|
|
|
}
|