blob: 0fb6393c00b5fdcbe421ca4cd1ff5506ff625f29 (
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
|
<?php
namespace Bitweaver\Plugins;
use Bitweaver\KernelTools;
use Smarty\BlockHandler\BlockHandlerInterface;
use Smarty\Template;
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {box} block plugin
*
* Type: block
* Name: box
* Input:
* - title (optional) box title
* - class (optional) overrides the default class 'box'
* - biticon values (optional) see function.biticon.php for details
* - idiv (optional) name of class of div that surrounds icon (if not set, no div is created)
* @uses smarty_function_escape_special_chars()
* @todo somehow make the variable that is contained within $iselect global --> this will allow importing of outside variables not set in $_REQUEST
*/
class BlockBox implements BlockHandlerInterface {
public function handle( $params, $content, Template $template, &$repeat): string {
global $gBitSmarty;
if( empty( $content )) {
return '';
}
$atts = '';
foreach( $params as $key => $val ) {
switch( $key ) {
case 'title':
$gBitSmarty->assign( $key, KernelTools::tra( $val ) );
break;
case 'class':
case 'iclass':
case 'ipackage':
case 'iname':
case 'iexplain':
case 'idiv':
$gBitSmarty->assign( $key,$val );
break;
default:
$atts .= $key.'="'.$val.'" ';
break;
}
}
$gBitSmarty->assign( 'content',$content );
$gBitSmarty->assign( 'atts',$atts );
return $gBitSmarty->fetch( 'bitpackage:kernel/box.tpl' );
}
public function isCacheable(): bool {
return true;
}
}
|