summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--itjs.class11
1 files changed, 4 insertions, 7 deletions
diff --git a/itjs.class b/itjs.class
index 0a57465..22fd646 100644
--- a/itjs.class
+++ b/itjs.class
@@ -146,7 +146,7 @@ static function filenames($filelist)
/**
* Return (php-interpreted by default) files that will be sent to client. Files must exist.
*/
-static function filecontents($filenames, $execphp = true)
+static function filecontents($filenames)
{
foreach ($filenames as $filename)
{
@@ -155,9 +155,9 @@ static function filecontents($filenames, $execphp = true)
{
$origget = $_GET;
list($filename, $paramstr) = explode("?", $filename);
- if ($paramstr && $execphp)
+ if ($paramstr)
parse_str($paramstr, $_GET);
- $result .= it::replace(array('^1$' => ""), $execphp ? include($filename) : file_get_contents($filename), array('utf8' => false));
+ $result .= it::replace(array('^1$' => ""), it::match('\.(js|css)$', $filename) ? include($filename) : file_get_contents($filename), array('utf8' => false));
$_GET = $origget;
}
$result .= ob_get_clean();
@@ -198,15 +198,12 @@ static function checksum($fnlist, $p = array())
foreach (is_array($fnlist) ? $fnlist : itjs::filenames($fnlist) as $filename)
$filenames[] = !file_exists($filename) && file_exists($t = it::replace(array('^/www/[^/]*' => "/www/lib.search.ch"), $filename)) ? $t : $filename;
- if (preg_grep('/jquery(build)\.js/', $filenames)) # jquery files may be included invisibly
- $filenames = array_merge($filenames, array("/www/lib.search.ch/var/jquery-ui/dist/minified/core.min.js", "/www/lib.search.ch/var/jquery/dist/jquery.min.js"));
-
$key = "itjs_" . md5(join("", it::map('"$v" . @filemtime("$v")', $filenames)));
if ($filenames && $p['short_expire'] && (time() - max(@array_map('filemtime', $filenames)) < 60))
return "-"; # trigger short expire, our file may not yet be up to date on other slaves
else if ($filenames)
- return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents($filenames, false)), 0, 10), array('ttl' => 60));
+ return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents($filenames)), 0, 10), array('ttl' => 60));
}
/**