index.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 (!empty($min_concatOnly)) {
  45. $min_serveOptions['concatOnly'] = true;
  46. }
  47. if ($min_errorLogger) {
  48. if (true === $min_errorLogger) {
  49. $min_errorLogger = FirePHP::getInstance(true);
  50. }
  51. Minify_Logger::setLogger($min_errorLogger);
  52. }
  53. // check for URI versioning
  54. if (preg_match('/&\\d/', $_SERVER['QUERY_STRING']) || isset($_GET['v'])) {
  55. $min_serveOptions['maxAge'] = 31536000;
  56. }
  57. // need groups config?
  58. if (isset($_GET['g'])) {
  59. // well need groups config
  60. $min_serveOptions['minApp']['groups'] = (require $min_configPaths['groups']);
  61. }
  62. // serve or redirect
  63. if (isset($_GET['f']) || isset($_GET['g'])) {
  64. if (! isset($min_serveController)) {
  65. $min_serveController = new Minify_Controller_MinApp();
  66. }
  67. Minify::serve($min_serveController, $min_serveOptions);
  68. } elseif ($min_enableBuilder) {
  69. header('Location: builder/');
  70. exit;
  71. } else {
  72. header('Location: /');
  73. exit;
  74. }