1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-13 09:34:54 +02:00

Allow full custom path including filename

This commit is contained in:
Sam Bauers
2014-02-05 00:46:08 +11:00
parent ae70500a2d
commit b34d964e88

View File

@@ -9,35 +9,37 @@
define('MINIFY_MIN_DIR', dirname(__FILE__)); define('MINIFY_MIN_DIR', dirname(__FILE__));
// set config directory defaults // set config path defaults
$min_configDirs = array( $min_configPaths = array(
'config.php' => MINIFY_MIN_DIR, 'standard' => MINIFY_MIN_DIR . '/config.php',
'config-test.php' => MINIFY_MIN_DIR, 'test' => MINIFY_MIN_DIR . '/config-test.php',
'groupsConfig.php' => MINIFY_MIN_DIR 'groups' => MINIFY_MIN_DIR . '/groupsConfig.php'
); );
// check for custom config directory // check for custom config paths
if (defined('MINIFY_CUSTOM_CONFIG_DIR')) { if (!empty($min_customConfigPaths)) {
// check for each config in the custom directory // check for each config in the custom path
foreach ($min_configDirs as $file => $dir) { foreach ($min_configPaths as $key => $path) {
$path = MINIFY_CUSTOM_CONFIG_DIR . '/' . $file; if (!empty($min_customConfigPaths[$key])) {
if (!file_exists($path)) {
continue; continue;
} }
if (!is_readable($path)) { if (!file_exists($min_customConfigPaths[$key])) {
continue; continue;
} }
// reassign the directory for this config to custom if (!is_readable($min_customConfigPaths[$key])) {
$min_configDirs[$file] = MINIFY_CUSTOM_CONFIG_DIR; continue;
} }
unset($file, $dir, $path); // reassign the path for this config to custom
$min_configPaths[$key] = $min_customConfigPaths[$key];
}
unset($key, $path);
} }
// load config // load config
require $min_configDirs['config.php'] . '/config.php'; require $min_configPaths['config.php'] . '/config.php';
if (isset($_GET['test'])) { if (isset($_GET['test'])) {
include $min_configDirs['config-test.php'] . '/config-test.php'; include $min_configPaths['config-test.php'] . '/config-test.php';
} }
require "$min_libPath/Minify/Loader.php"; require "$min_libPath/Minify/Loader.php";
@@ -77,7 +79,7 @@ if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) {
} }
if (isset($_GET['g'])) { if (isset($_GET['g'])) {
// well need groups config // well need groups config
$min_serveOptions['minApp']['groups'] = (require $min_configDirs['groupsConfig.php'] . '/groupsConfig.php'); $min_serveOptions['minApp']['groups'] = (require $min_configPaths['groupsConfig.php'] . '/groupsConfig.php');
} }
if (isset($_GET['f']) || isset($_GET['g'])) { if (isset($_GET['f']) || isset($_GET['g'])) {
// serve! // serve!