- changed {php} tag handling

- removed support of Smarty::instance()
- removed support of PHP resource type
- improved execution speed of {foreach} tags
- fixed bug in {section} tag
This commit is contained in:
Uwe.Tews
2009-09-29 16:23:35 +00:00
parent 4faa5eff33
commit 1af2723de9
11 changed files with 1241 additions and 1453 deletions

View File

@@ -0,0 +1,39 @@
<?php
/**
* Smarty plugin to execute PHP code
*
* @package Smarty
* @subpackage PluginsBlock
* @author Uwe Tews
*/
/**
* Smarty {php}{/php} block plugin
*
* @param string $content contents of the block
* @param object $smarty Smarty object
* @param boolean $ &$repeat repeat flag
* @param object $template template object
* @return string content re-formatted
*/
function smarty_block_php($params, $content, $smarty, &$repeat, $template)
{
// get security settings
if ($template->security && isset($smarty->security_handler)) {
$sec_obj = $smarty->security_policy;
} else {
$sec_obj = $smarty;
}
if (is_null($content)) {
if ($sec_obj->php_handling != SMARTY_PHP_ALLOW) {
trigger_error("{php} is deprecated, set php_handling = SMARTY_PHP_ALLOW to enable",E_USER_WARNING);
}
return;
}
eval($content);
return '';
}
?>