summaryrefslogtreecommitdiff
path: root/lib/exe/css.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/exe/css.php')
-rw-r--r--lib/exe/css.php40
1 files changed, 34 insertions, 6 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php
index 8899ff193..1e662c64a 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -49,14 +49,16 @@ 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) {
+ foreach($styleini['stylesheets'] as $file => $mode) {
$tplstyles[$mode][$tplinc.$file] = $tpldir;
}
}
@@ -72,6 +74,7 @@ function css_out(){
$cache_files = getConfigFiles('main');
$cache_files[] = $tplinc.'style.ini';
+ $cache_files[] = $tplinc.'style.local.ini';
$cache_files[] = __FILE__;
foreach($mediatypes as $mediatype) {
@@ -119,8 +122,10 @@ function css_out(){
// print the default classes for interwiki links and file downloads
if ($mediatype == 'screen') {
+ print '@media screen {';
css_interwiki();
css_filetypes();
+ print '}';
}
// load files
@@ -173,14 +178,37 @@ 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);
- $css = strtr($css,$ini['replacements']);
+ $styleini = css_styleini($tplinc);
+
+ if($styleini){
+ $css = strtr($css,$styleini['replacements']);
}
return $css;
}
/**
+ * Get contents of merged style.ini and style.local.ini as an array.
+ *
+ * @author Anika Henke <anika@selfthinker.org>
+ */
+function css_styleini($tplinc) {
+ $styleini = array();
+
+ foreach (array($tplinc.'style.ini', $tplinc.'style.local.ini') as $ini) {
+ $tmp = (@file_exists($ini)) ? parse_ini_file($ini, true) : array();
+
+ foreach($tmp as $key => $value) {
+ if(array_key_exists($key, $styleini) && is_array($value)) {
+ $styleini[$key] = array_merge($styleini[$key], $tmp[$key]);
+ } else {
+ $styleini[$key] = $value;
+ }
+ }
+ }
+ return $styleini;
+}
+
+/**
* Prints classes for interwikilinks
*
* Interwiki links have two classes: 'interwiki' and 'iw_$name>' where