index.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. define('MINIFY_MIN_DIR', dirname(__FILE__));
  10. // set config path defaults
  11. $min_configPaths = array(
  12. 'base' => MINIFY_MIN_DIR . '/config.php',
  13. 'test' => MINIFY_MIN_DIR . '/config-test.php',
  14. 'groups' => MINIFY_MIN_DIR . '/groupsConfig.php'
  15. );
  16. // check for custom config paths
  17. if (!empty($min_customConfigPaths) && is_array($min_customConfigPaths)) {
  18. $min_configPaths = array_merge($min_configPaths, $min_customConfigPaths);
  19. }
  20. // load config
  21. require $min_configPaths['base'];
  22. if (isset($_GET['test'])) {
  23. include $min_configPaths['test'];
  24. }
  25. require "$min_libPath/Minify/Loader.php";
  26. Minify_Loader::register();
  27. Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
  28. Minify::setCache(
  29. isset($min_cachePath) ? $min_cachePath : ''
  30. ,$min_cacheFileLocking
  31. );
  32. if ($min_documentRoot) {
  33. $_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
  34. Minify::$isDocRootSet = true;
  35. }
  36. $min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
  37. // auto-add targets to allowDirs
  38. foreach ($min_symlinks as $uri => $target) {
  39. $min_serveOptions['minApp']['allowDirs'][] = $target;
  40. }
  41. if ($min_allowDebugFlag) {
  42. $min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($_COOKIE, $_GET, $_SERVER['REQUEST_URI']);
  43. }
  44. if ($min_errorLogger) {
  45. if (true === $min_errorLogger) {
  46. $min_errorLogger = FirePHP::getInstance(true);
  47. }
  48. Minify_Logger::setLogger($min_errorLogger);
  49. }
  50. // check for URI versioning
  51. if (preg_match('/&\\d/', $_SERVER['QUERY_STRING']) || isset($_GET['v'])) {
  52. $min_serveOptions['maxAge'] = 31536000;
  53. }
  54. // need groups config?
  55. if (isset($_GET['g'])) {
  56. // well need groups config
  57. $min_serveOptions['minApp']['groups'] = (require $min_configPaths['groups']);
  58. }
  59. // serve or redirect
  60. if (isset($_GET['f']) || isset($_GET['g'])) {
  61. if (! isset($min_serveController)) {
  62. $min_serveController = new Minify_Controller_MinApp();
  63. }
  64. Minify::serve($min_serveController, $min_serveOptions);
  65. } elseif ($min_enableBuilder) {
  66. header('Location: builder/');
  67. exit;
  68. } else {
  69. header('Location: /');
  70. exit;
  71. }