From 6e69c1ba2d33f6a576534fc6d05a66cb1554c7d0 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 30 Oct 2005 20:33:21 +0100 Subject: CSS replacement support Template authors now can use placeholders in their stylesheets which will be replaced by the central CSS dispatcher. Placeholders and their replacements are defined in a style.ini file in the Template directory. This makes changing a colorset very easy. darcs-hash:20051030193321-7ad00-bc66f405fd2e2b18cfcc5dc28feef04671eb6558.gz --- lib/exe/css.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index a9e0efab5..2bd63cbdc 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -77,6 +77,9 @@ function css_out(){ $css = ob_get_contents(); ob_end_clean(); + // apply style replacements + $css = css_applystyle($css); + // compress whitespace and comments if($conf['compress']){ $css = css_compress($css); @@ -101,6 +104,7 @@ function css_cacheok($cache,$files){ // some additional files to check $files[] = DOKU_CONF.'dokuwiki.conf'; $files[] = DOKU_CONF.'local.conf'; + $files[] = DOKU_TPLINC.'style.ini'; $files[] = __FILE__; // now walk the files @@ -112,6 +116,20 @@ function css_cacheok($cache,$files){ return true; } +/** + * Does placeholder replacements in the style according to + * the ones defined in a templates style.ini file + * + * @author Andreas Gohr + */ +function css_applystyle($css){ + if(@file_exists(DOKU_TPLINC.'style.ini')){ + $ini = parse_ini_file(DOKU_TPLINC.'style.ini'); + $css = strtr($css,$ini); + } + return $css; +} + /** * Prints classes for interwikilinks * -- cgit v1.2.3