Skip to content

Commit

Permalink
smarty: Add some more Smarty BC methods for lazy upgraders
Browse files Browse the repository at this point in the history
This only applies to 2.9(.5)+ branch. Jump to 3.0 after you successfully upgraded.
  • Loading branch information
ophian committed May 2, 2020
1 parent 98c81d9 commit 3c29d3b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions include/serendipity_smarty_class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,45 @@ public function assign_by_ref($tpl_var, &$value)
$this->assignByRef($tpl_var, $value);
}

/**
* Wrapper for old Smarty 2 Registers custom function to be used in templates
*
* @param string $function the name of the template function
* @param string $function_impl the name of the PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*
* @throws \SmartyException
*/
public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
{
$this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
}

/**
* Wrapper for old Smarty 2 Registers modifier to be used in templates
*
* @param string $modifier name of template modifier
* @param string $modifier_impl name of PHP function to register
*
* @throws \SmartyException
*/
public function register_modifier($modifier, $modifier_impl)
{
$this->registerPlugin('modifier', $modifier, $modifier_impl);
}

/**
* Wrapper for old Smarty 2 Registers a resource to fetch a template
*
* @param string $type name of resource
* @param array $functions array of functions to handle resource
*/
public function register_resource($type, $functions)
{
$this->registerResource($type, $functions);
}

public static function test()
{
var_dump(get_called_class());
Expand Down

0 comments on commit 3c29d3b

Please sign in to comment.