1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8//this script may only be included - so its better to die if called directly. 9if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) { 10 header('location: index.php'); 11 exit; 12} 13 14class TikiHelpLib 15{ 16 /* 17 function TikiHelpLib() 18 { 19 20 } 21 */ 22 /* end of class */ 23} 24 25 26/** 27 * Returns a single html-formatted crumb 28 * @param crumb a breadcrumb instance, or 29 * @param url, desc: a doc page and associated (already translated) help description 30 */ 31/* static */ 32function help_doclink($params) 33{ 34 global $prefs; 35 36 extract($params); 37 // Param = zone 38 $ret = ''; 39 if (! isset($url)) { 40 $url = ''; 41 } 42 if (empty($url) && empty($desc) && empty($crumb)) { 43 return; 44 } 45 46 if (! empty($crumb)) { 47 $url = $crumb->helpUrl; 48 $desc = $crumb->helpDescription; 49 } 50 51 // always display help buttons with descriptions, but only display help links when option is enabled. 52 if (($prefs['feature_help'] == 'y' and $url) or ($desc && empty($crumb))) { 53 if (! isset($desc)) { 54 $desc = tra('Help link'); 55 } 56 57 $smarty = TikiLib::lib('smarty'); 58 $smarty->loadPlugin('smarty_function_icon'); 59 60 $ret = '<a title="' . $url . '|' . htmlentities($desc, ENT_COMPAT, 'UTF-8') . '" href="' 61 . $prefs['helpurl'] . $url . '" target="tikihelp" class="tikihelp btn btn-link">' 62 . smarty_function_icon(['name' => 'help'], $smarty->getEmptyInternalTemplate()) 63 . '</a>'; 64 } 65 66 return $ret; 67} 68