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__));
|
|
|
|
|
|
|
|
// load config
|
|
|
|
require MINIFY_MIN_DIR . '/config.php';
|
|
|
|
|
|
|
|
// setup include path
|
|
|
|
set_include_path($min_libPath . PATH_SEPARATOR . get_include_path());
|
|
|
|
|
2008-09-18 01:56:29 +00:00
|
|
|
require 'Minify.php';
|
|
|
|
|
|
|
|
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;
|
2009-01-26 00:44:43 +00:00
|
|
|
} elseif (0 === stripos(PHP_OS, 'win')) {
|
|
|
|
Minify::setDocRoot(); // IIS may need help
|
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) {
|
2010-05-16 01:27:33 +00:00
|
|
|
if (! empty($_COOKIE['minDebug'])) {
|
|
|
|
foreach (preg_split('/\\s+/', $_COOKIE['minDebug']) as $debugUri) {
|
|
|
|
if (false !== strpos($_SERVER['REQUEST_URI'], $debugUri)) {
|
|
|
|
$min_serveOptions['debug'] = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-05-10 07:44:40 +00:00
|
|
|
}
|
|
|
|
// allow GET to override
|
|
|
|
if (isset($_GET['debug'])) {
|
|
|
|
$min_serveOptions['debug'] = true;
|
|
|
|
}
|
2009-01-26 00:44:43 +00:00
|
|
|
}
|
2009-01-28 20:02:25 +00:00
|
|
|
|
|
|
|
if ($min_errorLogger) {
|
|
|
|
require_once 'Minify/Logger.php';
|
|
|
|
if (true === $min_errorLogger) {
|
|
|
|
require_once 'FirePHP.php';
|
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
|
|
|
|
$min_serveOptions['minApp']['groups'] = (require MINIFY_MIN_DIR . '/groupsConfig.php');
|
|
|
|
}
|
|
|
|
if (isset($_GET['f']) || isset($_GET['g'])) {
|
|
|
|
// serve!
|
2010-09-30 04:31:58 +00:00
|
|
|
|
|
|
|
if (! isset($min_serveController)) {
|
|
|
|
require 'Minify/Controller/MinApp.php';
|
|
|
|
$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();
|
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
|
|
|
}
|