1
0
mirror of https://github.com/mrclay/minify.git synced 2025-02-24 08:52:50 +01:00
minify/min/index.php

99 lines
2.6 KiB
PHP
Raw Normal View History

<?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__));
// 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'
);
// 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])) {
continue;
}
if (!is_readable($min_customConfigPaths[$key])) {
continue;
}
// reassign the path for this config to custom
$min_configPaths[$key] = $min_customConfigPaths[$key];
}
unset($key, $path);
}
// load config
2014-02-05 00:57:18 +11:00
require $min_configPaths['standard'];
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
}
require "$min_libPath/Minify/Loader.php";
Minify_Loader::register();
Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
Minify::setCache(
isset($min_cachePath) ? $min_cachePath : ''
,$min_cacheFileLocking
);
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;
}
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
// auto-add targets to allowDirs
foreach ($min_symlinks as $uri => $target) {
$min_serveOptions['minApp']['allowDirs'][] = $target;
}
if ($min_allowDebugFlag) {
2011-09-03 20:18:57 -04:00
$min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($_COOKIE, $_GET, $_SERVER['REQUEST_URI']);
}
if ($min_errorLogger) {
if (true === $min_errorLogger) {
$min_errorLogger = FirePHP::getInstance(true);
}
Minify_Logger::setLogger($min_errorLogger);
}
// check for URI versioning
if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) {
$min_serveOptions['maxAge'] = 31536000;
}
if (isset($_GET['g'])) {
// well need groups config
2014-02-05 00:57:18 +11:00
$min_serveOptions['minApp']['groups'] = (require $min_configPaths['groups']);
}
if (isset($_GET['f']) || isset($_GET['g'])) {
// serve!
if (! isset($min_serveController)) {
$min_serveController = new Minify_Controller_MinApp();
}
Minify::serve($min_serveController, $min_serveOptions);
} elseif ($min_enableBuilder) {
header('Location: builder/');
exit();
} else {
header("Location: /");
exit();
}