From 9f184f796c4ae1729c8fe7c637b7fabbac1cdac8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Sun, 10 Dec 2017 10:09:00 +0100 Subject: [PATCH] make sure guaranteed placeholders are defined. fixes #1792 This adds some simple defaults for the guaranteed placeholders. This ensures plugins can safely use these placeholders even when a template did not implement them. --- lib/exe/css.php | 25 ++++++++++++++++++------- lib/tpl/dokuwiki/style.ini | 6 ++++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/exe/css.php b/lib/exe/css.php index 6bd96e349..bcccd5e57 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -84,7 +84,7 @@ function css_out(){ // Let plugins decide to either put more styles here or to remove some $media_files[$mediatype] = css_filewrapper($mediatype, $files); $CSSEvt = new Doku_Event('CSS_STYLES_INCLUDED', $media_files[$mediatype]); - + // Make it preventable. if ( $CSSEvt->advise_before() ) { $cache_files = array_merge($cache_files, array_keys($media_files[$mediatype]['files'])); @@ -92,7 +92,7 @@ function css_out(){ // unset if prevented. Nothing will be printed for this mediatype. unset($media_files[$mediatype]); } - + // finish event. $CSSEvt->advise_after(); } @@ -108,7 +108,7 @@ function css_out(){ // start output buffering ob_start(); - + // Fire CSS_STYLES_INCLUDED for one last time to let the // plugins decide whether to include the DW default styles. // This can be done by preventing the Default. @@ -124,19 +124,19 @@ function css_out(){ } $cssData = $media_files[$mediatype]; - + // Print the styles. print NL; if ( $cssData['encapsulate'] === true ) print $cssData['encapsulationPrefix'] . ' {'; print '/* START '.$cssData['mediatype'].' styles */'.NL; - + // load files foreach($cssData['files'] as $file => $location){ $display = str_replace(fullpath(DOKU_INC), '', fullpath($file)); print "\n/* XXXXXXXXX $display XXXXXXXXX */\n"; print css_loadfile($file, $location); } - + print NL; if ( $cssData['encapsulate'] === true ) print '} /* /@media '; else print '/*'; @@ -280,7 +280,18 @@ function css_styleini($tpl, $preview=false) { global $conf; $stylesheets = array(); // mode, file => base - $replacements = array(); // placeholder => value + // guaranteed placeholder => value + $replacements = array( + '__text__' => "#000", + '__background__' => "#fff", + '__text_alt__' => "#999", + '__background_alt__' => "#eee", + '__text_neu__' => "#666", + '__background_neu__' => "#ddd", + '__border__' => "#ccc", + '__highlight__' => "#ff9", + '__link__' => "#00f", + ); // load template's style.ini $incbase = tpl_incdir($tpl); diff --git a/lib/tpl/dokuwiki/style.ini b/lib/tpl/dokuwiki/style.ini index 6b2aaf560..892a6a6e5 100644 --- a/lib/tpl/dokuwiki/style.ini +++ b/lib/tpl/dokuwiki/style.ini @@ -68,12 +68,14 @@ __border__ = "#ccc" ; @ini_border ; highlighted text (e.g. search snippets) __highlight__ = "#ff9" ; @ini_highlight +; default link color +__link__ = "#2b73b7" ; @ini_link + ;-------------------------------------------------------------------------- __background_site__ = "#fbfaf9" ; @ini_background_site -; these are used for links -__link__ = "#2b73b7" ; @ini_link +; these are used for wiki links __existing__ = "#080" ; @ini_existing __missing__ = "#d30" ; @ini_missing -- GitLab