Mikhail I. Izmestev wrote: > Michael Klier wrote: > >> would it make sense to always prepend DOKU_BASE for script tags added via >> TPL_METAHEADER_OUTPUT directly in the function which adds them? >> >> >> > This is not only for script tags, but also href attribute of link tags. > Always to prepend DOKU_BASE is not correct, src attribute can be set to > external url like "http://another.host/some_script.js"; or > "/not/dokuwiki/space/another_style.css". It's necessary to handle these > situations for prepending DOKU_BASE into _tpl_metaheaders_action function. > This patch modify buildAttributes function what allows to prepend DOKU_BASE for src and href attributes.
--- dw/inc/common.php 2009-02-14 16:13:25.000000000 +0400 +++ dokuwiki/inc/common.php 2009-04-07 01:38:03.000000000 +0500 @@ -252,6 +252,14 @@ if($key{0} == '_') continue; if($val === '' && $skipempty) continue; + switch($key) { + case "src": + case "href": + if ( $val{0} != '/' && !preg_match('#^([a-z0-9\-\.+]+?)://#i',$val) ) + $val = DOKU_BASE.$val; + break; + } + $url .= $key.'="'; $url .= htmlspecialchars ($val); $url .= '" ';