diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index d0f24d26f67d9059e83d06033a9f8013bcc56af3..d62fdfff62536d242be8f2669a1aa739acf4d5e8 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -568,12 +568,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['more'] = ''; $link['name'] = $this->_getLinkTitle($name, $wikiUri, $isImage); - if ( !$isImage ) { - $link['class'] = 'interwiki'; - } else { - $link['class'] = 'media'; - } - //get interwiki URL if ( isset($this->interwiki[$wikiName]) ) { $url = $this->interwiki[$wikiName]; @@ -582,14 +576,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $url = 'http://www.google.com/search?q={URL}&btnI=lucky'; $wikiName = 'go'; } - - if(!$isImage){ - //if ico exists set additional style - if(@file_exists(DOKU_INC.'lib/images/interwiki/'.$wikiName.'.png')){ - $link['style']='background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$wikiName.'.png)'; - }elseif(@file_exists(DOKU_INC.'lib/images/interwiki/'.$wikiName.'.gif')){ - $link['style']='background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$wikiName.'.gif)'; - } + + if ( !$isImage ) { + $link['class'] = "interwiki iw_$wikiName"; + } else { + $link['class'] = 'media'; } //do we stay at the same server? Use local target diff --git a/lib/exe/css.php b/lib/exe/css.php index 7b6523b414b6a8dda77ba75e7135c80c2b212a67..a9e0efab53f06a726f58f0235e50ca234c43b3d9 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -7,10 +7,11 @@ */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); -define('NOSESSION',true); // we do not use a session or authentication here (better caching) +if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching) require_once(DOKU_INC.'inc/init.php'); require_once(DOKU_INC.'inc/pageutils.php'); require_once(DOKU_INC.'inc/io.php'); +require_once(DOKU_INC.'inc/confutils.php'); // Main (don't run when UNIT test) if(!defined('SIMPLE_TEST')){ @@ -64,6 +65,9 @@ function css_out(){ // start output buffering and build the stylesheet ob_start(); + // print the default classes for Interwikilinks + css_interwiki(); + // load files foreach($files as $file => $location){ print css_loadfile($file, $location); @@ -108,6 +112,41 @@ function css_cacheok($cache,$files){ return true; } +/** + * Prints classes for interwikilinks + * + * Interwiki links have two classes: 'interwiki' and 'iw_$name>' where + * $name is the identifier given in the config. All Interwiki links get + * an default style with a default icon. If a special icon is available + * for an interwiki URL it is set in it's own class. Both classes can be + * overwritten in the template or userstyles. + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +function css_interwiki(){ + + // default style + echo 'a.interwiki {'; + echo ' background: transparent url('.DOKU_BASE.'lib/images/interwiki.png) 0px 1px no-repeat;'; + echo ' padding-left: 16px;'; + echo '}'; + + // additional styles when icon available + $iwlinks = getInterwiki(); + foreach(array_keys($iwlinks) as $iw){ + if(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.png')){ + echo "a.iw_$iw {"; + echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.png)'; + echo '}'; + }elseif(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.gif')){ + echo "a.iw_$iw {"; + echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.gif)'; + echo '}'; + } + } + +} + /** * Loads a given file and fixes relative URLs with the * given location prefix diff --git a/lib/exe/js.php b/lib/exe/js.php index 9708dbc0d8a7f2092b7c7631932783935f07c528..b8b8c6401b1f51fbefe9af9f124a9906ca9da15d 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -7,7 +7,7 @@ */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); -define('NOSESSION',true); // we do not use a session or authentication here (better caching) +if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching) require_once(DOKU_INC.'inc/init.php'); require_once(DOKU_INC.'inc/pageutils.php'); require_once(DOKU_INC.'inc/io.php'); diff --git a/lib/tpl/default/images/interwiki.png b/lib/images/interwiki.png similarity index 100% rename from lib/tpl/default/images/interwiki.png rename to lib/images/interwiki.png diff --git a/lib/tpl/default/design.css b/lib/tpl/default/design.css index 7b84ea614f53b39935a25a040751c1370a727cc6..f68043fa9d4dc7304fe56170b09d6c0f228691ab 100644 --- a/lib/tpl/default/design.css +++ b/lib/tpl/default/design.css @@ -214,10 +214,8 @@ a.windows:hover { text-decoration:underline; } -/* interwiki link */ +/* interwiki link (icon are set by dokuwiki) */ a.interwiki{ - background: transparent url(images/interwiki.png) 0px 1px no-repeat; - padding-left: 16px; color:#436976; text-decoration:none; }