-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcompiler.style.php
31 lines (29 loc) · 1.33 KB
/
compiler.style.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
<?php
function smarty_compiler_style($params, $smarty){
$strCode = '<?php ';
if (isset($params['id'])) {
$strResourceApiPath = preg_replace('/[\\/\\\\]+/', '/', dirname(__FILE__) . '/FISResource.class.php');
$strCode .= 'if(!class_exists(\'FISResource\', false)){require_once(\'' . $strResourceApiPath . '\');}';
$strCode .= 'FISResource::$cp = ' . $params['id'].';';
}
$strCode .= 'ob_start();?>';
return $strCode;
}
function smarty_compiler_styleclose($params, $smarty){
$strResourceApiPath = preg_replace('/[\\/\\\\]+/', '/', dirname(__FILE__) . '/FISResource.class.php');
$strCode = '<?php ';
$strCode .= '$style=ob_get_clean();';
$strCode .= 'if($style!==false){';
$strCode .= 'if(!class_exists(\'FISResource\', false)){require_once(\'' . $strResourceApiPath . '\');}';
$strCode .= 'if(FISResource::$cp){';
$strCode .= 'if (!in_array(FISResource::$cp, FISResource::$arrEmbeded)){';
$strCode .= 'FISResource::addStylePool($style);';
$strCode .= 'FISResource::$arrEmbeded[] = FISResource::$cp;';
$strCode .= '}';
$strCode .= '} else {';
$strCode .= 'FISResource::addStylePool($style);';
$strCode .= '}';
$strCode .= '}';
$strCode .= 'FISResource::$cp = false;?>';
return $strCode;
}