SPR-787 use proper fallbacks for main logo as well

This commit is contained in:
Andreas Gohr 2017-02-21 13:32:57 +01:00
commit 3a6eaa0b7a
2 changed files with 38 additions and 8 deletions

View file

@ -118,4 +118,41 @@ class Template {
// return the full tag
return '<' . $tag . ' ' . buildAttributes($attributes) . ' />';
}
/**
* Embed the main logo
*
* Tries a few different locations
*/
public function mainLogo() {
global $conf;
$desktop = self::getResizedImgTag(
'img',
array(
'class' => 'mobile-hide',
'src' => array(tpl_getConf('logo'), 'wiki:logo-wide.png', 'wiki:logo.png'),
'alt' => tpl_getLang('adjunct_start_logo_text') . $conf['title'],
),
0, 0
);
$mobile = self::getResizedImgTag(
'img',
array(
'class' => 'mobile-only',
'src' => array('wiki:logo-32x32.png', 'wiki:favicon.png', 'wiki:logo-square.png', 'wiki:logo.png', tpl_getConf('logo')),
'alt' => tpl_getLang('adjunct_start_logo_text') . $conf['title'],
),
32, 32
);
// homepage logo should not link to itself (BITV accessibility requirement)
if(strcmp(wl(), $_SERVER['REQUEST_URI']) === 0) {
echo $desktop;
echo $mobile;
} else {
tpl_link(wl(), $desktop, 'accesskey="h" title="[H]"');
tpl_link(wl(), $mobile, 'accesskey="h" title="[H]"');
}
}
}

View file

@ -4,13 +4,6 @@
echo '<div class="menu-togglelink mobile-only"><a href=\'#\'>MOB</a></div>';
echo '<div class="logo">';
/* homepage logo should not link to itself (BITV accessibility requirement) */
if (strcmp(wl(), $_SERVER['REQUEST_URI']) === 0 ){
echo '<img class="mobile-hide" src="'.ml(tpl_getConf('logo')).'" alt="'.tpl_getLang('adjunct_start_logo_text').$conf['title'].'" />';
echo '<img class="mobile-only" src="'.tpl_getMediaFile(array(':wiki:favicon-32x32.png', 'images/fav/favicon-32x32.png')).'" alt="'.tpl_getLang('adjunct_start_logo_text').$conf['title'].'" />';
\dokuwiki\template\sprintdoc\Template::getInstance()->mainLogo();
} else{
tpl_link( wl(),'<img class="mobile-hide" src="'.ml(tpl_getConf('logo')).'" alt="'.$conf['title'].tpl_getLang('adjunct_linked_logo_text').'" />','accesskey="h" title="[H]"' );
tpl_link( wl(),'<img class="mobile-only" src="'.tpl_getMediaFile(array(':wiki:favicon-32x32.png', 'images/fav/favicon-32x32.png')).'" alt="'.$conf['title'].tpl_getLang('adjunct_linked_logo_text').'" />','accesskey="h" title="[H]"' );
}
echo "<hr class=\"structure\" /></div>";