diff options
author | Anika Henke <anika@selfthinker.org> | 2012-10-07 15:30:38 +0100 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2012-10-07 15:30:38 +0100 |
commit | 0e6f9f08b1c948f45d1867346a4502021afa55bc (patch) | |
tree | 0c80d4ee3f48fabab4ecedd2d448baea5d97e2e7 /lib/exe/css.php | |
parent | 3046a46462b44f28b1e5b1b25240a8ac4a859020 (diff) | |
download | rpg-0e6f9f08b1c948f45d1867346a4502021afa55bc.tar.gz rpg-0e6f9f08b1c948f45d1867346a4502021afa55bc.tar.bz2 |
added support for local style.ini files
Diffstat (limited to 'lib/exe/css.php')
-rw-r--r-- | lib/exe/css.php | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php index 8899ff193..dd69c94cf 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -49,14 +49,17 @@ function css_out(){ $tpldir = tpl_basedir(); } + // used style.ini file + $styleini = css_styleini($tplinc); + // The generated script depends on some dynamic options $cache = new cache('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$type,'.css'); // load template styles $tplstyles = array(); - if(@file_exists($tplinc.'style.ini')){ - $ini = parse_ini_file($tplinc.'style.ini',true); - foreach($ini['stylesheets'] as $file => $mode){ + if ($styleini) { + $ini = parse_ini_file($styleini, true); + foreach($ini['stylesheets'] as $file => $mode) { $tplstyles[$mode][$tplinc.$file] = $tpldir; } } @@ -71,7 +74,8 @@ function css_out(){ $files = array(); $cache_files = getConfigFiles('main'); - $cache_files[] = $tplinc.'style.ini'; + if ($styleini) + $cache_files[] = $styleini; $cache_files[] = __FILE__; foreach($mediatypes as $mediatype) { @@ -173,14 +177,27 @@ function css_out(){ * @author Andreas Gohr <andi@splitbrain.org> */ function css_applystyle($css,$tplinc){ - if(@file_exists($tplinc.'style.ini')){ - $ini = parse_ini_file($tplinc.'style.ini',true); + $styleini = css_styleini($tplinc); + + if($styleini){ + $ini = parse_ini_file($styleini,true); $css = strtr($css,$ini['replacements']); } return $css; } /** + * If either exist, get the template's style.local.ini or style.ini file. + */ +function css_styleini($tplinc) { + if(@file_exists($tplinc.'style.local.ini')) + return $tplinc.'style.local.ini'; + if(@file_exists($tplinc.'style.ini')) + return $tplinc.'style.ini'; + return ''; +} + +/** * Prints classes for interwikilinks * * Interwiki links have two classes: 'interwiki' and 'iw_$name>' where |