diff options
author | Urban Müller | 2013-10-23 16:43:36 +0000 |
---|---|---|
committer | Urban Müller | 2013-10-23 16:43:36 +0000 |
commit | 47cdae9bdf926e856a328a4657f6f6691b9d34b2 (patch) | |
tree | e03303bc1fc1fafeb2ea37cd1fd56f6a26b91027 /itjs.class | |
parent | a26cb579cd87560204aa0348486d139c62871154 (diff) | |
download | itools-47cdae9bdf926e856a328a4657f6f6691b9d34b2.tar.gz itools-47cdae9bdf926e856a328a4657f6f6691b9d34b2.tar.bz2 itools-47cdae9bdf926e856a328a4657f6f6691b9d34b2.zip |
use source to prevent different crcs for different browsers
Diffstat (limited to 'itjs.class')
-rw-r--r-- | itjs.class | 19 |
1 files changed, 4 insertions, 15 deletions
@@ -149,15 +149,15 @@ static function filenames($filelist) } /** - * Return (interpreted) files that will be sent to client + * Return (php-interpreted by default) files that will be sent to client */ -static function filecontents($filenames) +static function filecontents($filenames, $execphp = true) { foreach ($filenames as $filename) { ob_start(); # Needs to capture inside loop to guarantee file order if (!(it::match('W3C_CSS_Validator', $_SERVER['HTTP_USER_AGENT']) && it::match('jquery-ui\.css', $filename))) - $result .= it::replace(array('^1$' => ""), @include($filename), array('utf8' => false)); + $result .= it::replace(array('^1$' => ""), $execphp ? @include($filename) : file_get_contents($filename), array('utf8' => false)); $result .= ob_get_clean(); } @@ -191,19 +191,8 @@ static function strip($code) static function checksum($fnlist) { $key = "itjs_" . md5(join("", it::map('"$v" . filemtime("$v")', is_array($fnlist) ? $fnlist : itjs::filenames($fnlist)))); - if (!($result = it_cache::get($key))) - { - $origheaders = headers_list(); - $result = it_cache::put($key, substr(md5(itjs::filecontents(is_array($fnlist) ? $fnlist : itjs::filenames($fnlist), false)), 0, 8)); - if (!headers_sent() && headers_list() != $origheaders) - { - header_remove(); - foreach ($origheaders as $origheader) - header($origheader); # included filecontents might have modified Content-Type - } - } - return $result; + return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents(is_array($fnlist) ? $fnlist : itjs::filenames($fnlist), false)), 0, 8)); } } |