function getMinifyGroupsConfig() { $minifyConfig = array(); $key = $_GET['g']; // // Check for specific file request // if (strpos($key, MIN_FILE_PREFIX) === 0) { // file path relative to either templates or the theme (check theme first) $path = substr($key, strlen(MIN_FILE_PREFIX)); $config = array('include' => 'all', 'files' => array(THEME_DIR . $path, SITE_APP_DIR . $path, APP_DIR . $path)); return array($key => buildFileList($config)); } // // Page request // $pageOnly = isset($_GET['pageOnly']) && $_GET['pageOnly']; // if this is a copied module also pull in files from that module $configModule = isset($_GET['config']) ? $_GET['config'] : ''; list($ext, $module, $page, $pagetype, $platform, $pathHash) = explode('-', $key); $cache = new DiskCache(CACHE_DIR . '/minify', Kurogo::getOptionalSiteVar('MINIFY_CACHE_TIMEOUT', 30), true); $cacheName = "group_{$key}"; if ($configModule) { $cacheName .= "-{$configModule}"; } if ($pageOnly) { $cacheName .= "-pageOnly"; } if ($cache->isFresh($cacheName)) { $minifyConfig = $cache->read($cacheName); } else { $dirs = array(APP_DIR, SITE_APP_DIR, THEME_DIR); if ($pageOnly || ($pagetype == 'tablet' || $platform == 'computer') && in_array($module, array('info', 'admin'))) { // Info module does not inherit from common files $subDirs = array('/modules/' . $module); } else { $subDirs = array('/common', '/modules/' . $module); } if ($configModule) { $subDirs[] = '/modules/' . $configModule; } $checkFiles = array('css' => getCSSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly), 'js' => getJSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly)); //error_log(print_r($checkFiles, true)); $minifyConfig[$key] = buildFileList($checkFiles[$ext]); //error_log(__FUNCTION__."($pagetype-$platform) scanned filesystem for $key"); $cache->write($minifyConfig, $cacheName); } // Add minify source object for the theme config.ini if ($ext == 'css') { $themeVarsFile = realpath_exists(THEME_DIR . '/config.ini'); if ($themeVarsFile) { $minifyConfig[$key][] = new Minify_Source(array('id' => 'themeConfigModTimeChecker', 'getContentFunc' => 'minifyThemeConfigModTimeCheckerContent', 'minifier' => '', 'contentType' => Minify::TYPE_CSS, 'lastModified' => filemtime($themeVarsFile))); } } //error_log(__FUNCTION__."($pagetype-$platform) returning: ".print_r($minifyConfig, true)); return $minifyConfig; }
function getMinifyGroupsConfig() { $minifyConfig = array(); $key = $_GET['g']; // // Check for specific file request // if (strpos($key, MIN_FILE_PREFIX) === 0) { // file path relative to either templates or the theme (check theme first) $path = substr($key, strlen(MIN_FILE_PREFIX)); $config = array( 'include' => 'all', 'files' => array( THEME_DIR.$path, SITE_APP_DIR.$path, APP_DIR.$path, ), ); return array($key => buildFileList($config)); } // // Page request // $pageOnly = isset($_GET['pageOnly']) && $_GET['pageOnly']; // if this is a copied module also pull in files from that module $configModule = isset($_GET['config']) ? $_GET['config'] : ''; list($ext, $module, $page, $pagetype, $platform, $pathHash) = explode('-', $key); $cache = new DiskCache(CACHE_DIR.'/minify', 30, true); $cacheName = "group_$key"; if ($cache->isFresh($cacheName)) { $minifyConfig = $cache->read($cacheName); } else { // CSS includes all in order. JS prefers theme $cssDirs = array( APP_DIR, SITE_APP_DIR, THEME_DIR, ); $jsDirs = array( THEME_DIR, SITE_APP_DIR, APP_DIR, ); if ($pageOnly || ($platform=='computer' && in_array($module, array('info', 'admin')))) { // Info module does not inherit from common files $subDirs = array( '/modules/'.$module ); } else { $subDirs = array( '/common', '/modules/'.$module, ); } if ($configModule) { $subDirs[] = '/modules/' . $configModule; } $checkFiles = array( 'css' => getCSSFileConfigForDirs( $page, $pagetype, $platform, $cssDirs, $subDirs, $pageOnly), 'js' => getJSFileConfigForDirs ( $page, $pagetype, $platform, $jsDirs, $subDirs, $pageOnly), ); //error_log(print_r($checkFiles, true)); $minifyConfig[$key] = buildFileList($checkFiles[$ext]); //error_log(__FUNCTION__."($pagetype-$platform) scanned filesystem for $key"); $cache->write($minifyConfig, $cacheName); } //error_log(__FUNCTION__."($pagetype-$platform) returning: ".print_r($minifyConfig, true)); return $minifyConfig; }