mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 11:58:24 +01:00
use minify on javascript files: for now minify does NOT support query parameters, nor php files generating javascript, therefore these are excluded
This commit is contained in:
parent
82c73c423e
commit
6996efe50b
@ -1257,14 +1257,33 @@ abstract class egw_framework
|
|||||||
*/
|
*/
|
||||||
static protected function get_script_links()
|
static protected function get_script_links()
|
||||||
{
|
{
|
||||||
$links = "\n";
|
$debug_minify = (bool)$GLOBALS['egw_info']['server']['debug_minify'];
|
||||||
$files = self::$js_include_mgr->get_included_files();
|
$links = "\n";
|
||||||
foreach($files as $path)
|
$files = '';
|
||||||
|
$max_modified = 0;
|
||||||
|
foreach(self::$js_include_mgr->get_included_files() as $path)
|
||||||
{
|
{
|
||||||
$query = '';
|
$query = '';
|
||||||
list($path,$query) = explode('?',$path,2);
|
list($path,$query) = explode('?',$path,2);
|
||||||
$path .= '?'. filectime(EGW_SERVER_ROOT.$path).($query ? '&'.$query : '');
|
if (($mod = filemtime(EGW_SERVER_ROOT.$path)) > $max_modified) $max_modified = $mod;
|
||||||
$links .= '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url']. $path.'">'."</script>\n";
|
|
||||||
|
// for now minify does NOT support query parameters, nor php files generating javascript
|
||||||
|
if ($debug_minify || $query || substr($path, -3) != '.js')
|
||||||
|
{
|
||||||
|
$path .= '?'. $mod.($query ? '&'.$query : '');
|
||||||
|
$links .= '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url']. $path.'">'."</script>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$files .= ($files ? ',' : '').substr($path,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$debug_minify && $files)
|
||||||
|
{
|
||||||
|
$base_path = $GLOBALS['egw_info']['server']['webserver_url'];
|
||||||
|
if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH);
|
||||||
|
$files = '/phpgwapi/inc/min/?b='.substr($base_path, 1).'&f='.$files . '&'.$max_modified;
|
||||||
|
$links .= '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url']. $files.'">'."</script>\n";
|
||||||
}
|
}
|
||||||
return $links."\n";
|
return $links."\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user