-
Notifications
You must be signed in to change notification settings - Fork 11
/
compiler.html.php
35 lines (31 loc) · 1.25 KB
/
compiler.html.php
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
<?php
function smarty_compiler_html($arrParams, $smarty){
$strResourceApiPath = preg_replace('/[\\/\\\\]+/', '/', dirname(__FILE__) . '/lib/FISPagelet.class.php');
$strFramework = $arrParams['framework'];
$strMode = isset($arrParams['mode']) ? $arrParams['mode'] : 'null';
unset($arrParams['framework']);
unset($arrParams['mode']);
$strAttr = '';
$strCode = '<?php ';
$strCode .= 'if(!class_exists(\'FISPagelet\', false)){require_once(\'' . $strResourceApiPath . '\');}';
if (isset($strFramework)) {
$strCode .= 'FISResource::setFramework(FISResource::load('.$strFramework.', $_smarty_tpl->smarty));';
}
$strCode .= 'FISPagelet::init('.$strMode.');';
$strCode .= ' ?>';
foreach ($arrParams as $_key => $_value) {
if (is_numeric($_key)) {
$strAttr .= ' <?php echo ' . $_value .';?>';
} else {
$strAttr .= ' ' . $_key . '="<?php echo ' . $_value . ';?>"';
}
}
return $strCode . "<html{$strAttr}>";
}
function smarty_compiler_htmlclose($arrParams, $smarty){
$strCode = '<?php ';
$strCode .= '$_smarty_tpl->registerFilter(\'output\', array(\'FISPagelet\', \'renderResponse\'));';
$strCode .= '?>';
$strCode .= '</html>';
return $strCode;
}