diff options
author | VOC | 2015-11-13 19:48:45 +0100 |
---|---|---|
committer | VOC | 2015-11-13 19:48:45 +0100 |
commit | 92f4fa13749566f6c4378f2c9e80774e8320b825 (patch) | |
tree | f17c6da85da6edba9c7be10138687518ee534d50 /lib | |
parent | 32fd126b3fa937389efd1457e9d05daff9f3b347 (diff) | |
parent | 29af764323dc474c14e05985eeabd3a06ef19c86 (diff) |
Merge branch 'mandators'
Diffstat (limited to '')
-rw-r--r-- | lib/helper.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/helper.php b/lib/helper.php index c6fd9a9..0d4d868 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -18,14 +18,14 @@ function baseurl() if(startswith('//', $base)) $base = proto().':'.$base; - return $base; + return forceslash(forceslash($base).@$GLOBALS['MANDATOR']); } $base = ssl() ? 'https://' : 'http://'; $base .= $_SERVER['HTTP_HOST']; $base .= forceslash(dirname($_SERVER['SCRIPT_NAME'])); - return $base; + return forceslash(forceslash($base).@$GLOBALS['MANDATOR']); } function forceslash($url) @@ -41,3 +41,23 @@ function startswith($needle, $haystack) { return substr($haystack, 0, strlen($needle)) == $needle; } + +function handle_lesscss_request($lessfile, $relative_path) +{ + $dir = forceslash(sys_get_temp_dir()); + + $css_file = Less_Cache::Get([ + $lessfile => $relative_path, + ], [ + 'sourceMap' => true, + 'compress' => true, + 'relativeUrls' => true, + + 'cache_dir' => $dir, + ]); + + $css = file_get_contents($dir.$css_file); + header('Content-Type: text/css'); + header('Content-Length: '.strlen($css)); + print($css); +} |