diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-11-04 20:19:52 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-11-04 20:19:52 +0100 |
commit | 383dc9895eac5f1b8ee2a938bfff4a1482228817 (patch) | |
tree | a6af696a4ecd6259628f2885e23eadb637603b30 /lib/exe/css.php | |
parent | ecd445c000e4e54bf7228890848222312cffd3e3 (diff) | |
parent | 2005b6b650f2523cb58a005961a55a6f099c70c3 (diff) | |
download | rpg-383dc9895eac5f1b8ee2a938bfff4a1482228817.tar.gz rpg-383dc9895eac5f1b8ee2a938bfff4a1482228817.tar.bz2 |
Merge branch 'master' into future
* master: (45 commits)
TarLib code cleanup
TarLib: fixed appending in non-dynamic mode
fixed third method of adding files in TarLib
fix lone zero block in TarLib created archives
fix use of constructor in TarLib
Slovak language update
Korean language update
Latvian language update
removed redundant variables in tpl_include_page() (because of 3ff8773b)
added cut off points for mobile devices as parameters to style.ini
Corrected typo: ruke -> rule
Persian language update
Spanish language update
russian language update
Kazach language update
correctly check hash parameter in media dispatcher FS#2648
avoid broken browser_uid on IE
Removed acronyms for "Perl" and "PERL" as Perl is not an acronym. See http://learn.perl.org/faq/perlfaq1.html#Whats-the-difference-between-perl-and-Perl-
Made striplangs.php executable
release preparations
...
Diffstat (limited to 'lib/exe/css.php')
-rw-r--r-- | lib/exe/css.php | 40 |
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 |