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
78
79
|
<?php
/**
* @version $Revision: 1.4 $
* @package liberty
* @subpackage plugins_data
*/
/**
* definitions
*/
define( 'PLUGIN_GUID_DATABITICON', 'databiticon' );
global $gLibertySystem;
$pluginParams = array (
'tag' => 'biticon',
'auto_activate' => TRUE,
'requires_pair' => FALSE,
'load_function' => 'data_biticon',
'title' => 'bitweaver Icon',
'help_page' => 'DataPluginBiticon',
'description' => tra( "Display any bitweaver icon" ),
'help_function' => 'data_biticon_help',
'syntax' => '{biticon ipackage= iname= iexplain}',
'path' => LIBERTY_PKG_PATH.'plugins/data.biticon.php',
'plugin_type' => DATA_PLUGIN
);
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATABITICON, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATABITICON );
/**
* data_biticon_help
*
* @access public
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
*/
function data_biticon_help() {
$help =
'<table class="data help">'
.'<tr>'
.'<th>' . tra( "Key" ) . '</th>'
.'<th>' . tra( "Type" ) . '</th>'
.'<th>' . tra( "Comments" ) . '</th>'
.'</tr>'
.'<tr class="odd">'
.'<td>ipackage</td>'
.'<td>' . tra( "key-words") . '<br />' . tra( "(required)" ) . '</td>'
.'<td>' . tra( "Package the icon is taken from. The icon style icons take the value 'icons'.") . '</td>'
.'</tr>'
.'<tr class="even">'
.'<td>iname</td>'
.'<td>' . tra( "key-words") . '<br />' . tra("(required)") . '</td>'
.'<td>' . tra( "Name of the icon to be displayed" ) . '</td>'
.'</tr>'
.'<tr class="odd">'
.'<td>ixplain</td>'
.'<td>' . tra( "string" ) . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "Explanation of the icon - visible when hovering over the icon.").'</td>'
.'</tr>'
.'</table>'
. tra( "Example: " ) . '{biticon ipackage="icons" iname="large/accessories-text-editor" iexplain="edit"}';
return $help;
}
function data_biticon( $pData, $pParams ) {
global $gBitSmarty;
// sanitise biticon parameters before they are passed to the function
$biticon['iname'] = !empty( $pParams['iname'] ) ? $pParams['iname'] : NULL;
$biticon['ipackage'] = !empty( $pParams['ipackage'] ) ? $pParams['ipackage'] : 'icons';
$biticon['iexplain'] = !empty( $pParams['iexplain'] ) ? $pParams['iexplain'] : 'icon';
require_once $gBitSmarty->_get_plugin_filepath( 'function', 'biticon' );
$ret = smarty_function_biticon( $biticon, $gBitSmarty );
$wrapper = liberty_plugins_wrapper_style( $pParams );
if( !empty( $wrapper['style'] ) ) {
$ret ='<span class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "biticon-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'</span>';
}
return $ret;
}
?>
|