summaryrefslogtreecommitdiff
path: root/inc/template.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/template.php')
-rw-r--r--inc/template.php92
1 files changed, 70 insertions, 22 deletions
diff --git a/inc/template.php b/inc/template.php
index a87650b84..ca1c8d9d5 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -291,12 +291,10 @@ function tpl_metaheaders($alt = true) {
$head = array();
// prepare seed for js and css
- $tseed = 0;
+ $tseed = $updateVersion;
$depends = getConfigFiles('main');
- foreach($depends as $f) {
- $time = @filemtime($f);
- if($time > $tseed) $tseed = $time;
- }
+ foreach($depends as $f) $tseed .= @filemtime($f);
+ $tseed = md5($tseed);
// the usual stuff
$head['meta'][] = array('name'=> 'generator', 'content'=> 'DokuWiki');
@@ -470,7 +468,7 @@ function tpl_link($url, $name, $more = '', $return = false) {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function tpl_pagelink($id, $name = null) {
- print html_wikilink($id, $name);
+ print '<bdi>'.html_wikilink($id, $name).'</bdi>';
return true;
}
@@ -543,6 +541,7 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals
* @var string $accesskey
* @var string $id
* @var string $method
+ * @var bool $nofollow
* @var array $params
*/
extract($data);
@@ -557,10 +556,11 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals
$akey = 'accesskey="'.$accesskey.'" ';
$addTitle = ' ['.strtoupper($accesskey).']';
}
+ $rel = $nofollow ? 'rel="nofollow" ' : '';
$out = tpl_link(
$linktarget, $pre.(($inner) ? $inner : $caption).$suf,
'class="action '.$type.'" '.
- $akey.'rel="nofollow" '.
+ $akey.$rel.
'title="'.hsc($caption).$addTitle.'"', 1
);
}
@@ -597,6 +597,7 @@ function tpl_get_action($type) {
global $INFO;
global $REV;
global $ACT;
+ global $conf;
// check disabled actions and fix the badly named ones
if($type == 'history') $type = 'revisions';
@@ -606,6 +607,7 @@ function tpl_get_action($type) {
$id = $ID;
$method = 'get';
$params = array('do' => $type);
+ $nofollow = true;
switch($type) {
case 'edit':
// most complicated type - we need to decide on current action
@@ -643,6 +645,10 @@ function tpl_get_action($type) {
break;
case 'index':
$accesskey = 'x';
+ // allow searchbots to get to the sitemap from the homepage (when dokuwiki isn't providing a sitemap.xml)
+ if ($conf['start'] == $ID && !$conf['sitemap']) {
+ $nofollow = false;
+ }
break;
case 'top':
$accesskey = 't';
@@ -713,7 +719,7 @@ function tpl_get_action($type) {
return '[unknown %s type]';
break;
}
- return compact('accesskey', 'type', 'id', 'method', 'params');
+ return compact('accesskey', 'type', 'id', 'method', 'params', 'nofollow');
}
/**
@@ -766,7 +772,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) {
// don't print the search form if search action has been disabled
if(!actionOK('search')) return false;
- print '<form action="'.wl().'" accept-charset="utf-8" class="search" id="dw__search" method="get"><div class="no">';
+ print '<form action="'.wl().'" accept-charset="utf-8" class="search" id="dw__search" method="get" role="search"><div class="no">';
print '<input type="hidden" name="do" value="search" />';
print '<input type="text" ';
if($ACT == 'search') print 'value="'.htmlspecialchars($QUERY).'" ';
@@ -794,13 +800,7 @@ function tpl_breadcrumbs($sep = '•') {
$crumbs = breadcrumbs(); //setup crumb trace
- //reverse crumborder in right-to-left mode, add RLM character to fix heb/eng display mixups
- if($lang['direction'] == 'rtl') {
- $crumbs = array_reverse($crumbs, true);
- $crumbs_sep = ' &#8207;<span class="bcsep">'.$sep.'</span>&#8207; ';
- } else {
- $crumbs_sep = ' <span class="bcsep">'.$sep.'</span> ';
- }
+ $crumbs_sep = ' <span class="bcsep">'.$sep.'</span> ';
//render crumbs, highlight the last one
print '<span class="bchead">'.$lang['breadcrumb'].':</span>';
@@ -810,7 +810,9 @@ function tpl_breadcrumbs($sep = '•') {
$i++;
echo $crumbs_sep;
if($i == $last) print '<span class="curid">';
+ print '<bdi>';
tpl_link(wl($id), hsc($name), 'class="breadcrumbs" title="'.$id.'"');
+ print '</bdi>';
if($i == $last) print '</span>';
}
return true;
@@ -883,7 +885,7 @@ function tpl_userinfo() {
global $lang;
global $INFO;
if(isset($_SERVER['REMOTE_USER'])) {
- print $lang['loggedinas'].': '.hsc($INFO['userinfo']['name']).' ('.hsc($_SERVER['REMOTE_USER']).')';
+ print $lang['loggedinas'].': <bdi>'.hsc($INFO['userinfo']['name']).'</bdi> (<bdi>'.hsc($_SERVER['REMOTE_USER']).'</bdi>)';
return true;
}
return false;
@@ -922,14 +924,14 @@ function tpl_pageinfo($ret = false) {
// print it
if($INFO['exists']) {
$out = '';
- $out .= $fn;
+ $out .= '<bdi>'.$fn.'</bdi>';
$out .= ' · ';
$out .= $lang['lastmod'];
$out .= ': ';
$out .= $date;
if($INFO['editor']) {
$out .= ' '.$lang['by'].' ';
- $out .= editorinfo($INFO['editor']);
+ $out .= '<bdi>'.editorinfo($INFO['editor']).'</bdi>';
} else {
$out .= ' ('.$lang['external_edit'].')';
}
@@ -937,7 +939,7 @@ function tpl_pageinfo($ret = false) {
$out .= ' · ';
$out .= $lang['lockedby'];
$out .= ': ';
- $out .= editorinfo($INFO['locked']);
+ $out .= '<bdi>'.editorinfo($INFO['locked']).'</bdi>';
}
if($ret) {
return $out;
@@ -1187,6 +1189,34 @@ function tpl_getLang($id) {
}
/**
+ * Retrieve a language dependent file and pass to xhtml renderer for display
+ * template equivalent of p_locale_xhtml()
+ *
+ * @param string $id id of language dependent wiki page
+ * @return string parsed contents of the wiki page in xhtml format
+ */
+function tpl_locale_xhtml($id) {
+ return p_cached_output(tpl_localeFN($id));
+}
+
+/**
+ * Prepends appropriate path for a language dependent filename
+ */
+function tpl_localeFN($id) {
+ $path = tpl_incdir().'lang/';
+ global $conf;
+ $file = DOKU_CONF.'/template_lang/'.$conf['template'].'/'.$conf['lang'].'/'.$id.'.txt';
+ if (!@file_exists($file)){
+ $file = $path.$conf['lang'].'/'.$id.'.txt';
+ if(!@file_exists($file)){
+ //fall back to english
+ $file = $path.'en/'.$id.'.txt';
+ }
+ }
+ return $file;
+}
+
+/**
* prints the "main content" in the mediamanger popup
*
* Depending on the user's actions this may be a list of
@@ -1463,8 +1493,8 @@ function tpl_license($img = 'badge', $imgonly = false, $return = false, $wrap =
}
if(!$imgonly) {
$out .= $lang['license'].' ';
- $out .= '<a href="'.$lic['url'].'" rel="license" class="urlextern"'.$target;
- $out .= '>'.$lic['name'].'</a>';
+ $out .= '<bdi><a href="'.$lic['url'].'" rel="license" class="urlextern"'.$target;
+ $out .= '>'.$lic['name'].'</a></bdi>';
}
if($wrap) $out .= '</div>';
@@ -1748,5 +1778,23 @@ function tpl_media() {
echo '</div>'.NL;
}
+/**
+ * Return useful layout classes
+ *
+ * @author Anika Henke <anika@selfthinker.org>
+ */
+function tpl_classes() {
+ global $ACT, $conf, $ID, $INFO;
+ $classes = array(
+ 'dokuwiki',
+ 'mode_'.$ACT,
+ 'tpl_'.$conf['template'],
+ $_SERVER['REMOTE_USER'] ? 'loggedIn' : '',
+ $INFO['exists'] ? '' : 'notFound',
+ ($ID == $conf['start']) ? 'home' : '',
+ );
+ return join(' ', $classes);
+}
+
//Setup VIM: ex: et ts=4 :