mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
Removed autoload filters
This commit is contained in:
@@ -10,8 +10,7 @@ output filters operate on the template output when it is executed.
|
|||||||
|
|
||||||
Output filters can be either [registered](#api.register.filter) or
|
Output filters can be either [registered](#api.register.filter) or
|
||||||
loaded from the [plugins directory](#variable.plugins.dir) by using the
|
loaded from the [plugins directory](#variable.plugins.dir) by using the
|
||||||
[`loadFilter()`](#api.load.filter) method or by setting the
|
[`loadFilter()`](#api.load.filter) method. Smarty will
|
||||||
[`$autoload_filters`](#variable.autoload.filters) variable. Smarty will
|
|
||||||
pass the template output as the first argument, and expect the function
|
pass the template output as the first argument, and expect the function
|
||||||
to return the result of the processing.
|
to return the result of the processing.
|
||||||
|
|
||||||
@@ -38,6 +37,5 @@ to return the result of the processing.
|
|||||||
|
|
||||||
See also [`registerFilter()`](#api.register.filter),
|
See also [`registerFilter()`](#api.register.filter),
|
||||||
[`loadFilter()`](#api.load.filter),
|
[`loadFilter()`](#api.load.filter),
|
||||||
[`$autoload_filters`](#variable.autoload.filters),
|
|
||||||
[postfilters](#advanced.features.postfilters) and
|
[postfilters](#advanced.features.postfilters) and
|
||||||
[`$plugins_dir`](#variable.plugins.dir).
|
[`$plugins_dir`](#variable.plugins.dir).
|
||||||
|
@@ -5,8 +5,7 @@ Template postfilters are PHP functions that your templates are ran
|
|||||||
through *after they are compiled*. Postfilters can be either
|
through *after they are compiled*. Postfilters can be either
|
||||||
[registered](#api.register.filter) or loaded from the [plugins
|
[registered](#api.register.filter) or loaded from the [plugins
|
||||||
directory](#variable.plugins.dir) by using the
|
directory](#variable.plugins.dir) by using the
|
||||||
[`loadFilter()`](#api.load.filter) function or by setting the
|
[`loadFilter()`](#api.load.filter) function. Smarty will
|
||||||
[`$autoload_filters`](#variable.autoload.filters) variable. Smarty will
|
|
||||||
pass the compiled template code as the first argument, and expect the
|
pass the compiled template code as the first argument, and expect the
|
||||||
function to return the result of the processing.
|
function to return the result of the processing.
|
||||||
|
|
||||||
|
@@ -8,8 +8,7 @@ putting in their templates, etc.
|
|||||||
|
|
||||||
Prefilters can be either [registered](#api.register.filter) or loaded
|
Prefilters can be either [registered](#api.register.filter) or loaded
|
||||||
from the [plugins directory](#variable.plugins.dir) by using
|
from the [plugins directory](#variable.plugins.dir) by using
|
||||||
[`loadFilter()`](#api.load.filter) function or by setting the
|
[`loadFilter()`](#api.load.filter) function.
|
||||||
[`$autoload_filters`](#variable.autoload.filters) variable.
|
|
||||||
|
|
||||||
Smarty will pass the template source code as the first argument, and
|
Smarty will pass the template source code as the first argument, and
|
||||||
expect the function to return the resulting template source code.
|
expect the function to return the resulting template source code.
|
||||||
|
@@ -37,6 +37,5 @@ specifies the `name` of the filter plugin.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
See also [`registerFilter()`](#api.register.filter),
|
See also [`registerFilter()`](#api.register.filter) and [advanced
|
||||||
[`$autoload_filters`](#variable.autoload.filters) and [advanced
|
|
||||||
features](#advanced.features).
|
features](#advanced.features).
|
||||||
|
@@ -38,8 +38,7 @@ filters](#advanced.features.outputfilters) for more information on how
|
|||||||
to set up an output filter function.
|
to set up an output filter function.
|
||||||
|
|
||||||
See also [`unregisterFilter()`](#api.unregister.filter),
|
See also [`unregisterFilter()`](#api.unregister.filter),
|
||||||
[`loadFilter()`](#api.load.filter),
|
[`loadFilter()`](#api.load.filter), [template pre
|
||||||
[`$autoload_filters`](#variable.autoload.filters), [template pre
|
|
||||||
filters](#advanced.features.prefilters) [template post
|
filters](#advanced.features.prefilters) [template post
|
||||||
filters](#advanced.features.postfilters) [template output
|
filters](#advanced.features.postfilters) [template output
|
||||||
filters](#advanced.features.outputfilters) section.
|
filters](#advanced.features.outputfilters) section.
|
||||||
|
@@ -6,7 +6,6 @@ them directly, or use the corresponding setter/getter methods.
|
|||||||
|
|
||||||
- [$allow_php_templates](./api-variables/variable-allow-php-templates.md)
|
- [$allow_php_templates](./api-variables/variable-allow-php-templates.md)
|
||||||
- [$auto_literal](./api-variables/variable-auto-literal.md)
|
- [$auto_literal](./api-variables/variable-auto-literal.md)
|
||||||
- [$autoload_filters](./api-variables/variable-autoload-filters.md)
|
|
||||||
- [$cache_dir](./api-variables/variable-cache-dir.md)
|
- [$cache_dir](./api-variables/variable-cache-dir.md)
|
||||||
- [$cache_id](./api-variables/variable-cache-id.md)
|
- [$cache_id](./api-variables/variable-cache-id.md)
|
||||||
- [$cache_lifetime](./api-variables/variable-cache-lifetime.md)
|
- [$cache_lifetime](./api-variables/variable-cache-lifetime.md)
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
\$autoload\_filters {#variable.autoload.filters}
|
|
||||||
===================
|
|
||||||
|
|
||||||
If there are some filters that you wish to load on every template
|
|
||||||
invocation, you can specify them using this variable and Smarty will
|
|
||||||
automatically load them for you. The variable is an associative array
|
|
||||||
where keys are filter types and values are arrays of the filter names.
|
|
||||||
For example:
|
|
||||||
|
|
||||||
::: {.informalexample}
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
|
|
||||||
'output' => array('convert'));
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
:::
|
|
||||||
|
|
||||||
See also [`registerFilter()`](#api.register.filter) and
|
|
||||||
[`loadFilter()`](#api.load.filter)
|
|
@@ -177,9 +177,7 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
|
|||||||
$_content = $nextCompiler->template->source->getContent();
|
$_content = $nextCompiler->template->source->getContent();
|
||||||
if ($_content !== '') {
|
if ($_content !== '') {
|
||||||
// run pre filter if required
|
// run pre filter if required
|
||||||
if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
|
if (isset($nextCompiler->smarty->registered_filters[ 'pre' ])) {
|
||||||
isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
|
|
||||||
) {
|
|
||||||
$_content = $nextCompiler->smarty->ext->_filterHandler->runFilter(
|
$_content = $nextCompiler->smarty->ext->_filterHandler->runFilter(
|
||||||
'pre',
|
'pre',
|
||||||
$_content,
|
$_content,
|
||||||
|
@@ -109,18 +109,6 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// auto loaded filters
|
|
||||||
if (isset($compiler->smarty->autoload_filters[ \Smarty\Smarty::FILTER_VARIABLE ])) {
|
|
||||||
foreach ((array)$compiler->template->smarty->autoload_filters[ \Smarty\Smarty::FILTER_VARIABLE ] as $name) {
|
|
||||||
$result = $this->compile_variable_filter($compiler, $name, $output);
|
|
||||||
if ($result !== false) {
|
|
||||||
$output = $result;
|
|
||||||
} else {
|
|
||||||
// not found, throw exception
|
|
||||||
throw new SmartyException("Unable to load variable filter '{$name}'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach ($compiler->variable_filters as $filter) {
|
foreach ($compiler->variable_filters as $filter) {
|
||||||
if (count($filter) === 1
|
if (count($filter) === 1
|
||||||
&& ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false
|
&& ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false
|
||||||
|
@@ -472,9 +472,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
public function postFilter($code)
|
public function postFilter($code)
|
||||||
{
|
{
|
||||||
// run post filter if on code
|
// run post filter if on code
|
||||||
if (!empty($code)
|
if (!empty($code) && isset($this->smarty->registered_filters[ 'post' ])) {
|
||||||
&& (isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ]))
|
|
||||||
) {
|
|
||||||
return $this->smarty->ext->_filterHandler->runFilter('post', $code, $this->template);
|
return $this->smarty->ext->_filterHandler->runFilter('post', $code, $this->template);
|
||||||
} else {
|
} else {
|
||||||
return $code;
|
return $code;
|
||||||
@@ -492,9 +490,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
public function preFilter($_content)
|
public function preFilter($_content)
|
||||||
{
|
{
|
||||||
// run pre filter if required
|
// run pre filter if required
|
||||||
if ($_content !== ''
|
if ($_content !== '' && isset($this->smarty->registered_filters[ 'pre' ])) {
|
||||||
&& ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ])))
|
|
||||||
) {
|
|
||||||
return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template);
|
return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template);
|
||||||
} else {
|
} else {
|
||||||
return $_content;
|
return $_content;
|
||||||
|
@@ -216,7 +216,6 @@ class Debug extends Data
|
|||||||
$debObj->registered_plugins = array();
|
$debObj->registered_plugins = array();
|
||||||
$debObj->registered_resources = array();
|
$debObj->registered_resources = array();
|
||||||
$debObj->registered_filters = array();
|
$debObj->registered_filters = array();
|
||||||
$debObj->autoload_filters = array();
|
|
||||||
$debObj->default_modifiers = array();
|
$debObj->default_modifiers = array();
|
||||||
$debObj->escape_html = true;
|
$debObj->escape_html = true;
|
||||||
$debObj->caching = \Smarty::CACHING_OFF;
|
$debObj->caching = \Smarty::CACHING_OFF;
|
||||||
|
@@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Smarty Method AddAutoloadFilters
|
|
||||||
*
|
|
||||||
* Smarty::addAutoloadFilters() method
|
|
||||||
*
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage PluginsInternal
|
|
||||||
* @author Uwe Tews
|
|
||||||
*/
|
|
||||||
class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Add autoload filters
|
|
||||||
*
|
|
||||||
* @api Smarty::setAutoloadFilters()
|
|
||||||
*
|
|
||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
|
||||||
* @param array $filters filters to load automatically
|
|
||||||
* @param string $type "pre", "output", … specify
|
|
||||||
* the filter type to set.
|
|
||||||
* Defaults to none treating
|
|
||||||
* $filters' keys as the
|
|
||||||
* appropriate types
|
|
||||||
*
|
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
|
||||||
* @throws \SmartyException
|
|
||||||
*/
|
|
||||||
public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
|
|
||||||
{
|
|
||||||
$smarty = $obj->_getSmartyObj();
|
|
||||||
if ($type !== null) {
|
|
||||||
$this->_checkFilterType($type);
|
|
||||||
if (!empty($smarty->autoload_filters[ $type ])) {
|
|
||||||
$smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array)$filters);
|
|
||||||
} else {
|
|
||||||
$smarty->autoload_filters[ $type ] = (array)$filters;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ((array)$filters as $type => $value) {
|
|
||||||
$this->_checkFilterType($type);
|
|
||||||
if (!empty($smarty->autoload_filters[ $type ])) {
|
|
||||||
$smarty->autoload_filters[ $type ] =
|
|
||||||
array_merge($smarty->autoload_filters[ $type ], (array)$value);
|
|
||||||
} else {
|
|
||||||
$smarty->autoload_filters[ $type ] = (array)$value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $obj;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Smarty Method GetAutoloadFilters
|
|
||||||
*
|
|
||||||
* Smarty::getAutoloadFilters() method
|
|
||||||
*
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage PluginsInternal
|
|
||||||
* @author Uwe Tews
|
|
||||||
*/
|
|
||||||
class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get autoload filters
|
|
||||||
*
|
|
||||||
* @api Smarty::getAutoloadFilters()
|
|
||||||
*
|
|
||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
|
||||||
* @param string $type type of filter to get auto loads
|
|
||||||
* for. Defaults to all autoload
|
|
||||||
* filters
|
|
||||||
*
|
|
||||||
* @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
|
|
||||||
* was specified
|
|
||||||
* @throws \SmartyException
|
|
||||||
*/
|
|
||||||
public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
|
|
||||||
{
|
|
||||||
$smarty = $obj->_getSmartyObj();
|
|
||||||
if ($type !== null) {
|
|
||||||
$this->_checkFilterType($type);
|
|
||||||
return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array();
|
|
||||||
}
|
|
||||||
return $smarty->autoload_filters;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Smarty Method SetAutoloadFilters
|
|
||||||
*
|
|
||||||
* Smarty::setAutoloadFilters() method
|
|
||||||
*
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage PluginsInternal
|
|
||||||
* @author Uwe Tews
|
|
||||||
*/
|
|
||||||
class Smarty_Internal_Method_SetAutoloadFilters
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Valid for Smarty and template object
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $objMap = 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Valid filter types
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set autoload filters
|
|
||||||
*
|
|
||||||
* @api Smarty::setAutoloadFilters()
|
|
||||||
*
|
|
||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
|
||||||
* @param array $filters filters to load automatically
|
|
||||||
* @param string $type "pre", "output", … specify
|
|
||||||
* the filter type to set.
|
|
||||||
* Defaults to none treating
|
|
||||||
* $filters' keys as the
|
|
||||||
* appropriate types
|
|
||||||
*
|
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
|
||||||
* @throws \SmartyException
|
|
||||||
*/
|
|
||||||
public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
|
|
||||||
{
|
|
||||||
$smarty = $obj->_getSmartyObj();
|
|
||||||
if ($type !== null) {
|
|
||||||
$this->_checkFilterType($type);
|
|
||||||
$smarty->autoload_filters[ $type ] = (array)$filters;
|
|
||||||
} else {
|
|
||||||
foreach ((array)$filters as $type => $value) {
|
|
||||||
$this->_checkFilterType($type);
|
|
||||||
}
|
|
||||||
$smarty->autoload_filters = (array)$filters;
|
|
||||||
}
|
|
||||||
return $obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if filter type is valid
|
|
||||||
*
|
|
||||||
* @param string $type
|
|
||||||
*
|
|
||||||
* @throws \SmartyException
|
|
||||||
*/
|
|
||||||
public function _checkFilterType($type)
|
|
||||||
{
|
|
||||||
if (!isset($this->filterTypes[ $type ])) {
|
|
||||||
throw new SmartyException("Illegal filter type '{$type}'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -32,28 +32,6 @@ class Smarty_Internal_Runtime_FilterHandler
|
|||||||
*/
|
*/
|
||||||
public function runFilter($type, $content, Smarty_Internal_Template $template)
|
public function runFilter($type, $content, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
// loop over autoload filters of specified type
|
|
||||||
if (!empty($template->smarty->autoload_filters[ $type ])) {
|
|
||||||
foreach ((array)$template->smarty->autoload_filters[ $type ] as $name) {
|
|
||||||
$plugin_name = "Smarty_{$type}filter_{$name}";
|
|
||||||
if (function_exists($plugin_name)) {
|
|
||||||
$callback = $plugin_name;
|
|
||||||
} elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
|
|
||||||
$callback = array($plugin_name, 'execute');
|
|
||||||
} else {
|
|
||||||
if (function_exists($plugin_name)) {
|
|
||||||
// use loaded Smarty2 style plugin
|
|
||||||
$callback = $plugin_name;
|
|
||||||
} elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
|
|
||||||
// loaded class of filter plugin
|
|
||||||
$callback = array($plugin_name, 'execute');
|
|
||||||
} else {
|
|
||||||
throw new SmartyException("Auto load {$type}-filter plugin method '{$plugin_name}::execute' not callable");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$content = call_user_func($callback, $content, $template);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// loop over registered filters of specified type
|
// loop over registered filters of specified type
|
||||||
if (!empty($template->smarty->registered_filters[ $type ])) {
|
if (!empty($template->smarty->registered_filters[ $type ])) {
|
||||||
foreach ($template->smarty->registered_filters[ $type ] as $key => $name) {
|
foreach ($template->smarty->registered_filters[ $type ] as $key => $name) {
|
||||||
|
@@ -116,9 +116,10 @@ class Smarty_Internal_Runtime_UpdateCache
|
|||||||
$content .= $cache_parts[ 2 ][ $curr_idx ];
|
$content .= $cache_parts[ 2 ][ $curr_idx ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$no_output_filter && !$_template->cached->has_nocache_code
|
if (
|
||||||
&& (isset($_template->smarty->autoload_filters[ 'output' ])
|
!$no_output_filter
|
||||||
|| isset($_template->smarty->registered_filters[ 'output' ]))
|
&& !$_template->cached->has_nocache_code
|
||||||
|
&& isset($_template->smarty->registered_filters[ 'output' ])
|
||||||
) {
|
) {
|
||||||
$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
|
$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
|
||||||
}
|
}
|
||||||
|
@@ -465,13 +465,6 @@ class Smarty extends \Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public $registered_cache_resources = array();
|
public $registered_cache_resources = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* autoload filter
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public $autoload_filters = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default modifier
|
* default modifier
|
||||||
*
|
*
|
||||||
|
@@ -46,7 +46,7 @@ class Smarty_Internal_Extension_Handler
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $_property_info = array(
|
private $_property_info = array(
|
||||||
'AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
|
'DefaultModifiers' => 0, 'ConfigVars' => 0,
|
||||||
'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
|
'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
|
||||||
'TemplateVars' => 0, 'Literals' => 'Literals',
|
'TemplateVars' => 0, 'Literals' => 'Literals',
|
||||||
);//
|
);//
|
||||||
|
@@ -226,8 +226,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
|
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
|
||||||
&& !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ])
|
&& !$no_output_filter && isset($this->smarty->registered_filters[ 'output' ])
|
||||||
|| isset($this->smarty->registered_filters[ 'output' ]))
|
|
||||||
) {
|
) {
|
||||||
echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
||||||
} else {
|
} else {
|
||||||
@@ -247,10 +246,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
$this->smarty->_debug->display_debug($this, true);
|
$this->smarty->_debug->display_debug($this, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$no_output_filter
|
if (
|
||||||
|
!$no_output_filter
|
||||||
&& (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
|
&& (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
|
||||||
&& (isset($this->smarty->autoload_filters[ 'output' ])
|
&& isset($this->smarty->registered_filters[ 'output' ])
|
||||||
|| isset($this->smarty->registered_filters[ 'output' ]))
|
|
||||||
) {
|
) {
|
||||||
return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
||||||
}
|
}
|
||||||
|
@@ -19,11 +19,9 @@
|
|||||||
* The following methods will be dynamically loaded by the extension handler when they are called.
|
* The following methods will be dynamically loaded by the extension handler when they are called.
|
||||||
* They are located in a corresponding Smarty_Internal_Method_xxxx class
|
* They are located in a corresponding Smarty_Internal_Method_xxxx class
|
||||||
*
|
*
|
||||||
* @method Smarty_Internal_TemplateBase addAutoloadFilters(mixed $filters, string $type = null)
|
|
||||||
* @method Smarty_Internal_TemplateBase addDefaultModifiers(mixed $modifiers)
|
* @method Smarty_Internal_TemplateBase addDefaultModifiers(mixed $modifiers)
|
||||||
* @method Smarty_Internal_TemplateBase addLiterals(mixed $literals)
|
* @method Smarty_Internal_TemplateBase addLiterals(mixed $literals)
|
||||||
* @method Smarty_Internal_TemplateBase createData(\Smarty\Data $parent = null, string $name = null)
|
* @method Smarty_Internal_TemplateBase createData(\Smarty\Data $parent = null, string $name = null)
|
||||||
* @method array getAutoloadFilters(string $type = null)
|
|
||||||
* @method string getDebugTemplate()
|
* @method string getDebugTemplate()
|
||||||
* @method array getDefaultModifier()
|
* @method array getDefaultModifier()
|
||||||
* @method array getLiterals()
|
* @method array getLiterals()
|
||||||
@@ -34,7 +32,6 @@
|
|||||||
* @method Smarty_Internal_TemplateBase registerDefaultPluginHandler(callback $callback)
|
* @method Smarty_Internal_TemplateBase registerDefaultPluginHandler(callback $callback)
|
||||||
* @method Smarty_Internal_TemplateBase registerDefaultTemplateHandler(callback $callback)
|
* @method Smarty_Internal_TemplateBase registerDefaultTemplateHandler(callback $callback)
|
||||||
* @method Smarty_Internal_TemplateBase registerResource(string $name, mixed $resource_handler)
|
* @method Smarty_Internal_TemplateBase registerResource(string $name, mixed $resource_handler)
|
||||||
* @method Smarty_Internal_TemplateBase setAutoloadFilters(mixed $filters, string $type = null)
|
|
||||||
* @method Smarty_Internal_TemplateBase setDebugTemplate(string $tpl_name)
|
* @method Smarty_Internal_TemplateBase setDebugTemplate(string $tpl_name)
|
||||||
* @method Smarty_Internal_TemplateBase setDefaultModifiers(mixed $modifiers)
|
* @method Smarty_Internal_TemplateBase setDefaultModifiers(mixed $modifiers)
|
||||||
* @method Smarty_Internal_TemplateBase setLiterals(mixed $literals)
|
* @method Smarty_Internal_TemplateBase setLiterals(mixed $literals)
|
||||||
|
@@ -26,26 +26,6 @@ class FilterTest extends PHPUnit_Smarty
|
|||||||
$this->cleanDirs();
|
$this->cleanDirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* test autoload output filter
|
|
||||||
*/
|
|
||||||
public function testAutoloadOutputFilter()
|
|
||||||
{
|
|
||||||
$this->smarty->autoload_filters[ 'output' ] = 'trimwhitespace';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{" <br>hello world"}');
|
|
||||||
$this->assertEquals("<br>hello world", $this->smarty->fetch($tpl));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* test autoload variable filter
|
|
||||||
*/
|
|
||||||
public function testAutoloadVariableFilter()
|
|
||||||
{
|
|
||||||
$this->smarty->autoload_filters[ 'variable' ] = 'htmlspecialchars';
|
|
||||||
$tpl = $this->smarty->createTemplate('eval:{"<test>"}');
|
|
||||||
$this->assertEquals("<test>", $this->smarty->fetch($tpl));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test loaded filter
|
* test loaded filter
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user