xref: /template/writr/tpl_functions.php (revision ec13a77cd8a5049e4b82a9ea3e69cc0e36797997)
1<?php
2/**
3 * Template Functions
4 *
5 * This file provides template specific custom functions that are
6 * not provided by the DokuWiki core.
7 * It is common practice to start each function with an underscore
8 * to make sure it won't interfere with future core functions.
9 */
10
11// must be run from within DokuWiki
12if (!defined('DOKU_INC')) die();
13
14/**
15 * Get the logo of the wiki
16 *
17 * @return string
18 */
19if (!function_exists('tpl_getLogo')) {
20    function tpl_getLogo()
21    {
22        global $ID,$conf;
23
24        $return = '';
25        $logoSize = array();
26        $logoImages = array();
27        if(tpl_getConf('doLogoChangesByNamespace')){
28            $namespace = "";
29            $namespaces = array();
30            foreach(explode(':',getNS($ID)) as $ns){
31                $namespace .= "$ns:";
32                $namespaces[] = $namespace;
33            }
34            foreach(array_reverse($namespaces)  as $namespace){
35                $logoImages[] = ":".trim($namespace,":").":logo.png";
36            }
37        }
38        $logoImages[] = ':logo.png';
39        $logoImages[] = ':wiki:logo.png';
40        $logoImages[] = 'images/logo.png';
41        $logo = tpl_getMediaFile($logoImages, false, $logoSize);
42
43        $return .= '<a class="site-logo"  href="'.wl().'" title="'.$conf['title'].'" rel="home" accesskey="h" title="[H]">';
44        $return .= '<img src="'.$logo.'" '.$logoSize[3].' alt="" class="no-grav header-image" />';
45        $return .= '</a>';
46
47        return $return;
48    }
49}
50