summaryrefslogtreecommitdiff
path: root/lib/exe/css.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-10-30 20:33:21 +0100
committerAndreas Gohr <andi@splitbrain.org>2005-10-30 20:33:21 +0100
commit6e69c1ba2d33f6a576534fc6d05a66cb1554c7d0 (patch)
tree21f7f84f2d3964d66684b070d77ef9b403b3da50 /lib/exe/css.php
parent1c2d1019f48fa6b2dbc154f7534341ad0869a5d7 (diff)
downloadrpg-6e69c1ba2d33f6a576534fc6d05a66cb1554c7d0.tar.gz
rpg-6e69c1ba2d33f6a576534fc6d05a66cb1554c7d0.tar.bz2
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
Diffstat (limited to 'lib/exe/css.php')
-rw-r--r--lib/exe/css.php18
1 files changed, 18 insertions, 0 deletions
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
@@ -113,6 +117,20 @@ function css_cacheok($cache,$files){
}
/**
+ * Does placeholder replacements in the style according to
+ * the ones defined in a templates style.ini file
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+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
*
* Interwiki links have two classes: 'interwiki' and 'iw_$name>' where