]> 4ch.mooo.com Git - test.git/blob - lib/lib_css.php
modified: lib/lib_common.php
[test.git] / lib / lib_css.php
1 <?php
2 /**
3  * Yotsubanome CSS Library
4  *
5  * CSS data base loader for main program
6  *
7  * @package@
8  * @version@
9  * @date@
10  */
11
12 /* css data */
13 // http://www.magmagateau.com/fuukaba/ is the source of the code below
14 $style_load = false;
15 $style_bar = '';
16
17 if(file_exists(DATA_DIR.CSV_SS)){ // Load FuuR4 CSS data
18         $style_data = DATA_DIR.CSV_SS;
19         $style_bar .= '[';
20         $lines = explode("\n", file_get_contents($style_data));
21         foreach($lines as $null => $line){
22                 if($line != ''){
23                         list($style_name, $style_short, $style_path, $style_rel) = explode (',', $line);
24                         $style_path = CSS_DIR.$style_path;
25                         if(file_exists($style_path)){
26                                 if($style_rel) $style_rel = 'stylesheet';
27                                 else $style_rel = 'alternate stylesheet';
28                                 $style_load .= '<link rel="'.$style_rel.'" type="text/css" href="'.$style_path.'" title="'.$style_name.'" />'."\n";
29                                 $style_js = format_js_var($style_name);
30                                 $style_title = str_replace('[what]', $style_name, _T('style_tooltip'));
31                                 $style_bar .= ' <a href="javascript:set_stylesheet('.$style_js.')" title="'.$style_title.'">'.$style_short.'</a> |';
32                         }
33                 }
34         }
35         $style_bar .= ']';
36         // Tidy up trailing seperators and empty brackets
37         $style_bar = str_replace('|]', ']', $style_bar);
38         $style_bar = str_replace('[] ', '', $style_bar);
39         $style_bar = str_replace('[]', '', $style_bar);
40 }
41
42 // Load stylesheet setting from config.php
43 // if either of the datafiles are missing or empty
44 if(str_replace('[]', '', $style_bar) == '') $style_load .= '<link rel="stylesheet" type="text/css" href="'.CSS_DIR.CSSFILE.'" />';
45
46 // style sheet js loader
47 $jsdonk = 'var style_cookie = "';
48 $jsdonk .= ($style_bar) ? 'yo_style' : '';
49 $jsdonk .= '";';
50 ////++++
51 // CSS data is loaded And we proceed with head()
52 ?>