1<?php 2/** 3 * Additional template functionalities 4 * 5 * @author Mirko Zinn <mail@derzinn.de> 6 * @package Minimalism template 7 **/ 8 9error_reporting(0); 10if (!defined('DOKU_INC')) die(); 11 12function min_crumbs($str) { 13 switch ($str) { 14 case 'trace': 15 tpl_breadcrumbs(); 16 break; 17 case 'youarehere': 18 tpl_youarehere(); 19 break; 20 default: 21 echo ' '; 22 } 23} 24 25function min_links($str) { 26 if (strlen($str) > 0) { 27 $get = array('(c)', '%YEAR%'); 28 $put = array('©', date('Y')); 29 $str = str_replace($get, $put, $str); 30 preg_match_all('/\[\[([\w\d\s.:~\/\|äöü]+)\]\]/ui', $str, $items); 31 if (count($items[1]) > 0) { 32 for ($i = 0, $c = count($items[1]); $i < $c; $i++) { 33 $items[2][$i] = min_link_builder($items[1][$i]); 34 } 35 $str = str_replace($items[0], $items[2], $str); 36 } 37 echo $str; 38 } 39} 40 41function min_link_builder($str) { 42 global $ID, $conf; 43 ob_start(); 44 if (trim(strlen($str)) > 0) { 45 $item = stristr($str, '|') !== false ? explode('|', $str) : array(null, $str); 46 $link = $item[0] !== null ? trim(preg_replace('/^:?/', '', $item[0])) : $str; 47 $title = trim($item[1]); 48 $extern = !stristr($item[0], 'http') ? false : true; 49 if (strlen($link) > 0 && strlen($title) > 0) { 50 if ($extern) { 51 if (trim(strlen($conf['target']['extern'])) > 0) { 52 $target = ' target="'.$conf['target']['extern'].'"'; 53 } else { 54 $target = null; 55 } 56 tpl_link($link, $title, 'title="'.$link.'"'.$target); 57 } else { 58 if (trim(strlen($conf['target']['wiki'])) > 0) { 59 $target = ' target="'.$conf['target']['wiki'].'"'; 60 } else { 61 $target = null; 62 } 63 $style = $link == $ID ? ' class="active"' : null; 64 tpl_link(wl($link), $title, 'title="'.$link.'"'.$target.$style); 65 } 66 } 67 } 68 $str = ob_get_contents(); 69 ob_end_clean(); 70 return $str; 71} 72 73?>