public static function get_css_path($files) { if (!empty($files)) { if (is_array($files)) { $cache_file_location = '/cache/css/css-cache-' . md5(implode(';', $files)) . '.css'; } else { $files = str_replace('{THEME}', AppContext::get_current_user()->get_theme(), $files); $cache_file_location = '/cache/css/css-cache-' . md5($files) . '.css'; $files = explode(';', $files); } $css_cache = new CSSCacheManager(); $css_cache->set_files($files); $css_cache->set_cache_file_location(PATH_TO_ROOT . $cache_file_location); $css_cache->execute(CSSCacheConfig::load()->get_optimization_level()); return TPL_PATH_TO_ROOT . $cache_file_location; } }
protected function get_modules_css_files_html_code() { $css_cache_config = CSSCacheConfig::load(); $css_files = array_merge(ModulesCssFilesService::get_css_files_always_displayed(), ModulesCssFilesService::get_css_files_running_module_displayed()); if ($css_cache_config->is_enabled()) { $html_code = '<link rel="stylesheet" href="' . CSSCacheManager::get_css_path($css_files) . '" type="text/css" media="screen, print" />'; } else { $html_code = ''; foreach ($css_files as $file) { $html_code .= '<link rel="stylesheet" href="' . Url::to_rel($file) . '" type="text/css" media="screen, print" />'; } } return $html_code; }