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 * copied to core (available since Detritus)
16 */
17function white_toolsevent($toolsname, $items, $view='main') {
18    $data = array(
19        'view'  => $view,
20        'items' => $items
21    );
22
23    $hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY';
24    $evt = new Doku_Event($hook, $data);
25    if($evt->advise_before()){
26        $actions = array('export_pdf');
27        foreach($evt->data['items'] as $k => $html) {
28            if (in_array($k, $actions)) {
29                $html = str_replace(' '.$k, ' plugin_'.$k, $html);
30            }
31            echo $html;
32        }
33    }
34    $evt->advise_after();
35}
36
37function white_breadcrumbs() {
38    global $lang;
39    global $conf;
40
41    //check if enabled
42    if(!$conf['breadcrumbs']) return false;
43
44    $crumbs = breadcrumbs(); //setup crumb trace
45
46    $crumbs_sep = ' <span class="bcsep">'.$sep.'</span> ';
47
48    //render crumbs, highlight the last one
49    print '<h3>'.$lang['breadcrumb'].'</h3>';
50    $last = count($crumbs);
51    $i    = 0;
52    print '<ul>';
53    foreach($crumbs as $id => $name) {
54        $i++;
55        print '<li>';
56        if($i == $last) print '<span class="curid">';
57        tpl_link(wl($id), hsc($name), 'class="breadcrumbs" title="'.$id.'"');
58        if($i == $last) print '</span>';
59        print '</li>';
60    }
61    print '</ul>';
62    return true;
63}
64
65function white_pageinfo($ret = false) {
66    global $conf;
67    global $lang;
68    global $INFO;
69    global $ID;
70
71    // return if we are not allowed to view the page
72    if(!auth_quickaclcheck($ID)) {
73        return false;
74    }
75    $date = dformat($INFO['lastmod']);
76
77    // print it
78    if($INFO['exists']) {
79        $out = '';
80        $out .= $lang['lastmod'];
81        $out .= ' ';
82        $out .= $date;
83        if($ret) {
84            return $out;
85        } else {
86            echo $out;
87            return true;
88        }
89    }
90    return false;
91}
92