mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-06 15:21:37 +01:00
- change of filenames in sysplugins folder for internal spl_autoload function
- lexer/parser changed for increased compilation speed
This commit is contained in:
35
libs/sysplugins/smarty_method_register_compiler_function.php
Normal file
35
libs/sysplugins/smarty_method_register_compiler_function.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty method Register_Compiler_Function
|
||||
*
|
||||
* Registers a PHP function as Smarty compiler function plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage SmartyMethod
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register a PHP function as Smarty compiler function plugin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers compiler function
|
||||
*
|
||||
* @param string $compiler_tag of template function
|
||||
* @param string $compiler_impl name of PHP function to register
|
||||
*/
|
||||
function register_compiler_function($smarty, $compiler_tag, $compiler_impl, $cacheable = true)
|
||||
{
|
||||
if (isset($smarty->registered_plugins[$compiler_tag])) {
|
||||
throw new Exception("Plugin tag \"{$compiler_tag}\" already registered");
|
||||
} elseif (!is_callable($compiler_impl)) {
|
||||
throw new Exception("Plugin \"{$compiler_tag}\" not callable");
|
||||
} else {
|
||||
$smarty->registered_plugins[$compiler_tag] =
|
||||
array('compiler', $compiler_impl, $cacheable);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user