aboutsummaryrefslogtreecommitdiff
path: root/lib/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php24
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);
+}