Update to Smarty 2.6.22

This commit is contained in:
anubis
2009-01-04 17:34:22 -05:00
parent eedd737a97
commit 60b674c776
18 changed files with 473 additions and 216 deletions

View File

@@ -20,17 +20,17 @@
*
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-general-subscribe@lists.php.net
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://smarty.php.net/
* @link http://www.smarty.net/
* @copyright 2001-2005 New Digital Group, Inc.
* @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
* @package Smarty
* @version 2.6.12
* @version 2.6.22
*/
/* $Id: Smarty.class.php,v 1.523 2005/12/31 19:17:04 messju Exp $ */
/* $Id: Smarty.class.php 2785 2008-09-18 21:04:12Z Uwe.Tews $ */
/**
* DIR_SEP isn't used anymore, but third party apps might
@@ -464,7 +464,7 @@ class Smarty
*
* @var string
*/
var $_version = '2.6.12';
var $_version = '2.6.22';
/**
* current template inclusion depth
@@ -838,69 +838,66 @@ class Smarty
* Registers a prefilter function to apply
* to a template before compiling
*
* @param string $function name of PHP function to register
* @param callback $function
*/
function register_prefilter($function)
{
$_name = (is_array($function)) ? $function[1] : $function;
$this->_plugins['prefilter'][$_name]
$this->_plugins['prefilter'][$this->_get_filter_name($function)]
= array($function, null, null, false);
}
/**
* Unregisters a prefilter function
*
* @param string $function name of PHP function
* @param callback $function
*/
function unregister_prefilter($function)
{
unset($this->_plugins['prefilter'][$function]);
unset($this->_plugins['prefilter'][$this->_get_filter_name($function)]);
}
/**
* Registers a postfilter function to apply
* to a compiled template after compilation
*
* @param string $function name of PHP function to register
* @param callback $function
*/
function register_postfilter($function)
{
$_name = (is_array($function)) ? $function[1] : $function;
$this->_plugins['postfilter'][$_name]
$this->_plugins['postfilter'][$this->_get_filter_name($function)]
= array($function, null, null, false);
}
/**
* Unregisters a postfilter function
*
* @param string $function name of PHP function
* @param callback $function
*/
function unregister_postfilter($function)
{
unset($this->_plugins['postfilter'][$function]);
unset($this->_plugins['postfilter'][$this->_get_filter_name($function)]);
}
/**
* Registers an output filter function to apply
* to a template output
*
* @param string $function name of PHP function
* @param callback $function
*/
function register_outputfilter($function)
{
$_name = (is_array($function)) ? $function[1] : $function;
$this->_plugins['outputfilter'][$_name]
$this->_plugins['outputfilter'][$this->_get_filter_name($function)]
= array($function, null, null, false);
}
/**
* Unregisters an outputfilter function
*
* @param string $function name of PHP function
* @param callback $function
*/
function unregister_outputfilter($function)
{
unset($this->_plugins['outputfilter'][$function]);
unset($this->_plugins['outputfilter'][$this->_get_filter_name($function)]);
}
/**
@@ -1935,6 +1932,25 @@ class Smarty
{
return eval($code);
}
/**
* Extracts the filter name from the given callback
*
* @param callback $function
* @return string
*/
function _get_filter_name($function)
{
if (is_array($function)) {
$_class_name = (is_object($function[0]) ?
get_class($function[0]) : $function[0]);
return $_class_name . '_' . $function[1];
}
else {
return $function;
}
}
/**#@-*/
}