foreach ($matches[1] as $match) {
if(substr($match, -3) !== '.js') continue;
if(file_exists(MODX_BASE_PATH . $match)) {
$replace[$match] = $match . '?v=' . filemtime(MODX_BASE_PATH . $match);
}
}
}
preg_match_all('/<link.*?\s+href=(?:\'|")([^\'">]+)(?:\'|")/', $content, $matches);
if(isset($matches[1])) {
foreach ($matches[1] as $match) {
if(substr($match, -4) !== '.css') continue;
if(file_exists(MODX_BASE_PATH . $match)) {
$replace[$match] = $match . '?v=' . filemtime(MODX_BASE_PATH . $match);
}
}
}
if($replace) {
evo()->documentContent = str_replace(array_keys($replace), array_values($replace), $content);
}
Чой то бесплатно..
не совсем 🙃
Обсуждают сегодня