<commit_before><?
header("Content-Type: text/css");
$co = Request::get();
$v = View::getInstance();
$au = $co->getAuxiliaryData();
if (isset($au->theme) && isset($au->file)) {
	$pt = PageTheme::getByHandle($au->theme);
	if (is_object($pt)) {
		if (file_exists($pt->getThemeDirectory() . '/' . $au->file)) {
			if ($_REQUEST['mode'] == 'preview') {
				$val = Cache::get('preview_theme_style', $pt->getThemeID(), false, true);
				if (is_array($val)) {
					$values = $pt->mergeStylesFromPost($val);
					$pt->outputStyleSheet($au->file, $values);
					exit;
				}
			}
			$stat = filemtime($pt->getThemeDirectory() . '/' . $au->file);
			$style = Cache::get(str_replace('-','_', $au->theme), $au->file, $stat);
			if ($style == '') {
				$style = $pt->parseStyleSheet($au->file);
				Cache::set(str_replace('-','_', $au->theme), $au->file, $style, 10800, true);
			}
		
			//if we're doing a cache refresh, we need to print the css still 
			$noCache = ($_SERVER['HTTP_PRAGMA'] == 'no-cache'); 
			
			//see if we have a cache time to check 
			$moded = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false; 
			
			//if we have are cache refreshing || the browser cache has expired 
			if ($noCache || $moded || $stat > $moded) { 
				header('Last-Modified: '.gmdate('D, d M Y H:i:s', $stat).' GMT'); 
				echo $style; 
			} else { 
				header('HTTP/1.1 304 Not Modified'); 
			} 
		}
	}
}<commit_msg>making css parser dynamically cache properly<commit_after><?
$co = Request::get();
$v = View::getInstance();
$au = $co->getAuxiliaryData();
if (isset($au->theme) && isset($au->file)) {
	$pt = PageTheme::getByHandle($au->theme);
	if (is_object($pt)) {
		if (file_exists($pt->getThemeDirectory() . '/' . $au->file)) {

			if ($_REQUEST['mode'] == 'preview') {
				$val = Cache::get('preview_theme_style', $pt->getThemeID(), false, true);
				if (is_array($val)) {
					$values = $pt->mergeStylesFromPost($val);
					$pt->outputStyleSheet($au->file, $values);
					exit;
				}
			}
			$stat = filemtime($pt->getThemeDirectory() . '/' . $au->file);

			$style = Cache::get(str_replace('-','_', $au->theme), $au->file, $stat);
			if ($style == '') {
				$style = $pt->parseStyleSheet($au->file);
				Cache::set(str_replace('-','_', $au->theme), $au->file, $style, 10800, true);
			}

			header("Date: ". date("D, j M Y G:i:s", $stat) ." GMT");
			header("Content-Type: text/css");
			header("Expires: ". gmdate("D, j M Y H:i:s", time() + DAY) ." GMT");
			header("Cache-Control: max-age=86400, must-revalidate"); // HTTP/1.1
			header("Pragma: cache_asset");        // HTTP/1.0	

			echo $style; 
		}
	}
}
{'fraction_non_alphanumeric': 0.23460521344918775, 'fraction_numerical': 0.009066868152625614, 'mean_word_length': 3.6619718309859155, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1454179', 'n_tokens_mistral': 1129, 'n_tokens_neox': 977, 'n_words': 195}