-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathget_css.php
36 lines (33 loc) · 1.29 KB
/
get_css.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/*
Different browsers interpret relative paths in css variables differently.
If your variable is eg
--my-background: url(../path/to/image);
Chrome interprets that as relative to the file in which it is referenced.
Safari interprets it as relative to the file in which it is defined.
Consistency would be helpful but co-operation is a dream we long gave up on, apparently.
RompR might be installed in any number of ways, so using /full/path/to/image doesn't
work either, since that would ignore the /rompr/ part of the URL, and we can't assume
everybody has installed it like that.
So what we're doing here is jumping through some hoops so that all of our CSS is pulled
relative to the root of the website, by reading it all in using php.
*/
require_once ("includes/vars.php");
header('Content-Type: text/css');
$css = glob('css/*.css');
foreach ($css as $file) {
logger::log('GET-CSS', $file);
readfile($file);
print "\n";
}
if (file_exists('skins/'.prefs::skin().'/skin.css')) {
logger::log('GET-CSS', 'skins/'.prefs::skin().'/skin.css');
readfile('skins/'.prefs::skin().'/skin.css');
print "\n";
}
if (file_exists('skins/'.prefs::skin().'/controlbuttons.css')) {
logger::log('GET-CSS', 'skins/'.prefs::skin().'/controlbuttons.css');
readfile('skins/'.prefs::skin().'/controlbuttons.css');
print "\n";
}
?>