function onBeforeInit() { foreach (Requirements::$disable_cache_busted_file_extensions_for as $class) { if (is_a($this->owner, $class)) { Requirements::$use_cache_busted_file_extensions = false; } } }
protected function issueReplacements() { foreach (Requirements::$disable_replaced_files_for as $class) { if (\Controller::curr() && is_a(\Controller::curr(), $class)) { return; } } $replaced = Requirements::replacements(); if (count($replaced)) { foreach ($replaced as $old => $new) { if (isset($this->css[$old])) { $old = $this->css[$old]; unset($this->css[$old]); $this->css[$new] = $old; } elseif (isset($this->javascript[$old])) { unset($this->javascript[$old]); $this->javascript[$new] = true; } elseif (isset($this->customScript[$old])) { unset($this->customScript[$old]); $this->customScript[$new] = true; } elseif (isset($this->customCSS[$old])) { unset($this->customCSS[$old]); $this->customCSS[$new] = true; } elseif (isset($this->customHeadTags[$old])) { unset($this->customHeadTags[$old]); $this->customHeadTags[$new] = true; } } } }
public static function get_cache_busted_file_url($file) { if ($ext = pathinfo($file, PATHINFO_EXTENSION)) { if ($ext == 'js' || $ext == 'css') { $myExt = strstr($file, 'combined.' . $ext) ? 'combined.' . $ext : $ext; $filePath = preg_replace('/\\?.*/', '', Director::baseFolder() . '/' . $file); $mTime = Requirements::get_suffix_requirements() ? "." . filemtime($filePath) : ''; $suffix = ''; if (strpos($file, '?') !== false) { $suffix = substr($file, strpos($file, '?')); } return str_replace('.' . $myExt, '', $file) . "{$mTime}.{$myExt}{$suffix}"; } } return false; }