blob: bd70e98ad5c289530676ef4a77151b8deed6fb40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<?php
namespace Bitweaver\Plugins;
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
* @link https://www.bitweaver.org/wiki/function_booticon function_booticon
*/
/**
* Turn collected information into an html image
*
* @param array $pParams parameter hash
* @var boolean $pParams['url'] set to TRUE if you only want the url and nothing else
* @var string $pParams['iexplain'] Explanation of what the icon represents
* @var string $pParams['iforce'] takes following optins: icon, icon_text, text - will override system settings
* @var string $pFile Path to icon file
* @var string iforce override site-wide setting how to display icons (can be set to 'icon', 'text' or 'icon_text')
* @access public
* @return string Full <img> on success
*/
function smarty_function_biticon( $pParams ) {
global $gBitSystem;
if( empty( $pParams['iforce'] )) {
$pParams['iforce'] = '';
}
$outstr = '';
if( isset( $pParams['href'] ) ) {
$outstr .= '<a href="'.$pParams['href'].'" class="icon"';
if( isset( $pParams['iexplain'] ) ) {
$outstr .= ' title="'.htmlentities( $pParams['iexplain'] ).'"';
}
$outstr .= '>';
}
$outstr .= '<span class="';
if( isset( $pParams["iname"] ) ) {
$outstr .= $pParams['iname'];
}
if( isset( $pParams["iclass"] ) ) {
$outstr .= ' '.$pParams["iclass"].'';
}
if( isset( $pParams["class"] ) ) {
$outstr .= ' '.$pParams["class"].'';
}
$outstr .= '"';
if( isset( $pParams["id"] ) ) {
$outstr .= ' id="'.$pParams['id'].'"';
}
if( isset( $pParams['iexplain'] ) ) {
$outstr .= ' title="'.htmlentities( $pParams['iexplain'] ).'"';
}
foreach( array_keys( $pParams ) as $key ) {
if( strpos( $key, 'on' ) === 0 ) {
$outstr .= ' '.$key.'="'.$pParams[$key].'"';
}
}
$outstr .= '></span>';
if( !empty( $pParams['ilocation'] ) ) {
if( $pParams['ilocation'] == 'menu' && isset( $pParams['iexplain'] ) ) {
$outstr .= ' '.$pParams['iexplain'];
}
}
if( isset( $pParams["href"] ) ) {
$outstr .= '</a>';
}
return $outstr;
}
|