private function parseJS()
{
$jsFiles = array();
$jsFilesGrouped = array();
$existingJSFiles = $this->getJSFiles();
// if there aren't any JS-files added we don't need to do something
if (!empty($existingJSFiles)) {
// some files should be cached, even if we don't want cached (mostly libraries)
$ignoreCache = array('/src/Frontend/Core/Js/Jquery/jquery.js', '/src/Frontend/Core/Js/Jquery/jquery.ui.js');
foreach ($existingJSFiles as $file) {
$priorityGroup = $file['priority_group'];
// some files shouldn't be uncacheable
if (in_array($file['file'], $ignoreCache) || $file['add_timestamp'] === false) {
$file = array('file' => $file['file']);
} else {
// add last modified time
$modifiedTime = mb_strpos($file['file'], '?') !== false ? '&m=' . LAST_MODIFIED_TIME : '?m=' . LAST_MODIFIED_TIME;
$file = array('file' => $file['file'] . $modifiedTime);
}
$jsFilesGrouped[$priorityGroup][] = $file;
}
ksort($jsFilesGrouped);
foreach ($jsFilesGrouped as $jsFile) {
$jsFiles = array_merge($jsFiles, $jsFile);
}
}
$this->tpl->addGlobal('jsFiles', $jsFiles);
}