mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
(phpdoc indentation)
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Smarty Template Base
|
||||
*
|
||||
* This file contains the basic shared methodes for template handling
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
* Smarty Internal Plugin Smarty Template Base
|
||||
*
|
||||
* This file contains the basic shared methodes for template handling
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class with shared template methodes
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
* Class with shared template methodes
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
|
||||
/**
|
||||
* fetches a rendered Smarty template
|
||||
*
|
||||
* @param string $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
* @param bool $display true: display, false: fetch
|
||||
* @param bool $merge_tpl_vars if true parent template variables merged in to local scope
|
||||
* @param bool $no_output_filter if true do not run output filter
|
||||
* @return string rendered template output
|
||||
*/
|
||||
* fetches a rendered Smarty template
|
||||
*
|
||||
* @param string $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
* @param bool $display true: display, false: fetch
|
||||
* @param bool $merge_tpl_vars if true parent template variables merged in to local scope
|
||||
* @param bool $no_output_filter if true do not run output filter
|
||||
* @return string rendered template output
|
||||
*/
|
||||
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
|
||||
{
|
||||
if ($template === null && $this instanceof $this->template_class) {
|
||||
@@ -361,13 +361,13 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* displays a Smarty template
|
||||
*
|
||||
* @param string $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
*/
|
||||
* displays a Smarty template
|
||||
*
|
||||
* @param string $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
*/
|
||||
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
|
||||
{
|
||||
// display template
|
||||
@@ -375,14 +375,14 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* test if cache is valid
|
||||
*
|
||||
* @param string|object $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
* @return boolean cache status
|
||||
*/
|
||||
* test if cache is valid
|
||||
*
|
||||
* @param string|object $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
* @return boolean cache status
|
||||
*/
|
||||
public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
|
||||
{
|
||||
if ($template === null && $this instanceof $this->template_class) {
|
||||
@@ -399,27 +399,27 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a data object
|
||||
*
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
* @returns Smarty_Data data object
|
||||
*/
|
||||
* creates a data object
|
||||
*
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
* @returns Smarty_Data data object
|
||||
*/
|
||||
public function createData($parent = null)
|
||||
{
|
||||
return new Smarty_Data($parent, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers plugin to be used in templates
|
||||
*
|
||||
* @param string $type plugin type
|
||||
* @param string $tag name of template tag
|
||||
* @param callback $callback PHP callback to register
|
||||
* @param boolean $cacheable if true (default) this fuction is cachable
|
||||
* @param array $cache_attr caching attributes if any
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException when the plugin tag is invalid
|
||||
*/
|
||||
* Registers plugin to be used in templates
|
||||
*
|
||||
* @param string $type plugin type
|
||||
* @param string $tag name of template tag
|
||||
* @param callback $callback PHP callback to register
|
||||
* @param boolean $cacheable if true (default) this fuction is cachable
|
||||
* @param array $cache_attr caching attributes if any
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException when the plugin tag is invalid
|
||||
*/
|
||||
public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)
|
||||
{
|
||||
if (isset($this->smarty->registered_plugins[$type][$tag])) {
|
||||
@@ -434,12 +434,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister Plugin
|
||||
*
|
||||
* @param string $type of plugin
|
||||
* @param string $tag name of plugin
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* Unregister Plugin
|
||||
*
|
||||
* @param string $type of plugin
|
||||
* @param string $tag name of plugin
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function unregisterPlugin($type, $tag)
|
||||
{
|
||||
if (isset($this->smarty->registered_plugins[$type][$tag])) {
|
||||
@@ -450,12 +450,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a resource to fetch a template
|
||||
*
|
||||
* @param string $type name of resource type
|
||||
* @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* Registers a resource to fetch a template
|
||||
*
|
||||
* @param string $type name of resource type
|
||||
* @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function registerResource($type, $callback)
|
||||
{
|
||||
$this->smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback, false);
|
||||
@@ -463,11 +463,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a resource
|
||||
*
|
||||
* @param string $type name of resource type
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* Unregisters a resource
|
||||
*
|
||||
* @param string $type name of resource type
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function unregisterResource($type)
|
||||
{
|
||||
if (isset($this->smarty->registered_resources[$type])) {
|
||||
@@ -478,12 +478,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a cache resource to cache a template's output
|
||||
*
|
||||
* @param string $type name of cache resource type
|
||||
* @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* Registers a cache resource to cache a template's output
|
||||
*
|
||||
* @param string $type name of cache resource type
|
||||
* @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function registerCacheResource($type, Smarty_CacheResource $callback)
|
||||
{
|
||||
$this->smarty->registered_cache_resources[$type] = $callback;
|
||||
@@ -491,11 +491,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a cache resource
|
||||
*
|
||||
* @param string $type name of cache resource type
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* Unregisters a cache resource
|
||||
*
|
||||
* @param string $type name of cache resource type
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function unregisterCacheResource($type)
|
||||
{
|
||||
if (isset($this->smarty->registered_cache_resources[$type])) {
|
||||
@@ -506,17 +506,17 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers object to be used in templates
|
||||
*
|
||||
* @param string $object name of template object
|
||||
* @param object $object_impl the referenced PHP object to register
|
||||
* @param array $allowed list of allowed methods (empty = all)
|
||||
* @param boolean $smarty_args smarty argument format, else traditional
|
||||
* @param array $block_methods list of block-methods
|
||||
* @param array $block_functs list of methods that are block format
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if any of the methods in $allowed or $block_methods are invalid
|
||||
*/
|
||||
* Registers object to be used in templates
|
||||
*
|
||||
* @param string $object name of template object
|
||||
* @param object $object_impl the referenced PHP object to register
|
||||
* @param array $allowed list of allowed methods (empty = all)
|
||||
* @param boolean $smarty_args smarty argument format, else traditional
|
||||
* @param array $block_methods list of block-methods
|
||||
* @param array $block_functs list of methods that are block format
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if any of the methods in $allowed or $block_methods are invalid
|
||||
*/
|
||||
public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
||||
{
|
||||
// test if allowed methodes callable
|
||||
@@ -542,12 +542,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* return a reference to a registered object
|
||||
*
|
||||
* @param string $name object name
|
||||
* @return object
|
||||
* @throws SmartyException if no such object is found
|
||||
*/
|
||||
* return a reference to a registered object
|
||||
*
|
||||
* @param string $name object name
|
||||
* @return object
|
||||
* @throws SmartyException if no such object is found
|
||||
*/
|
||||
public function getRegisteredObject($name)
|
||||
{
|
||||
if (!isset($this->smarty->registered_objects[$name])) {
|
||||
@@ -560,11 +560,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* unregister an object
|
||||
*
|
||||
* @param string $name object name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* unregister an object
|
||||
*
|
||||
* @param string $name object name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function unregisterObject($name)
|
||||
{
|
||||
if (isset($this->smarty->registered_objects[$name])) {
|
||||
@@ -575,13 +575,13 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers static classes to be used in templates
|
||||
*
|
||||
* @param string $class name of template class
|
||||
* @param string $class_impl the referenced PHP class to register
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $class_impl does not refer to an existing class
|
||||
*/
|
||||
* Registers static classes to be used in templates
|
||||
*
|
||||
* @param string $class name of template class
|
||||
* @param string $class_impl the referenced PHP class to register
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $class_impl does not refer to an existing class
|
||||
*/
|
||||
public function registerClass($class_name, $class_impl)
|
||||
{
|
||||
// test if exists
|
||||
@@ -594,12 +594,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a default plugin handler
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $callback is not callable
|
||||
*/
|
||||
* Registers a default plugin handler
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $callback is not callable
|
||||
*/
|
||||
public function registerDefaultPluginHandler($callback)
|
||||
{
|
||||
if (is_callable($callback)) {
|
||||
@@ -612,12 +612,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a default template handler
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $callback is not callable
|
||||
*/
|
||||
* Registers a default template handler
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $callback is not callable
|
||||
*/
|
||||
public function registerDefaultTemplateHandler($callback)
|
||||
{
|
||||
if (is_callable($callback)) {
|
||||
@@ -630,12 +630,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a default template handler
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $callback is not callable
|
||||
*/
|
||||
* Registers a default template handler
|
||||
*
|
||||
* @param callable $callback class/method name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
* @throws SmartyException if $callback is not callable
|
||||
*/
|
||||
public function registerDefaultConfigHandler($callback)
|
||||
{
|
||||
if (is_callable($callback)) {
|
||||
@@ -648,12 +648,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a filter function
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param callback $callback
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* Registers a filter function
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param callback $callback
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function registerFilter($type, $callback)
|
||||
{
|
||||
$this->smarty->registered_filters[$type][$this->_get_filter_name($callback)] = $callback;
|
||||
@@ -661,12 +661,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a filter function
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param callback $callback
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* Unregisters a filter function
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param callback $callback
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function unregisterFilter($type, $callback)
|
||||
{
|
||||
$name = $this->_get_filter_name($callback);
|
||||
@@ -678,11 +678,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return internal filter name
|
||||
*
|
||||
* @param callback $function_name
|
||||
* @return string internal filter name
|
||||
*/
|
||||
* Return internal filter name
|
||||
*
|
||||
* @param callback $function_name
|
||||
* @return string internal filter name
|
||||
*/
|
||||
public function _get_filter_name($function_name)
|
||||
{
|
||||
if (is_array($function_name)) {
|
||||
@@ -695,12 +695,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* load a filter of specified type and name
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
* @throws SmartyException if filter could not be loaded
|
||||
*/
|
||||
* load a filter of specified type and name
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
* @throws SmartyException if filter could not be loaded
|
||||
*/
|
||||
public function loadFilter($type, $name)
|
||||
{
|
||||
$_plugin = "smarty_{$type}filter_{$name}";
|
||||
@@ -718,12 +718,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* unload a filter of specified type and name
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
* unload a filter of specified type and name
|
||||
*
|
||||
* @param string $type filter type
|
||||
* @param string $name filter name
|
||||
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function unloadFilter($type, $name)
|
||||
{
|
||||
$_filter_name = "smarty_{$type}filter_{$name}";
|
||||
@@ -735,21 +735,21 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* preg_replace callback to convert camelcase getter/setter to underscore property names
|
||||
*
|
||||
* @param string $match match string
|
||||
* @return string replacemant
|
||||
*/
|
||||
* preg_replace callback to convert camelcase getter/setter to underscore property names
|
||||
*
|
||||
* @param string $match match string
|
||||
* @return string replacemant
|
||||
*/
|
||||
private function replaceCamelcase($match) {
|
||||
return "_" . strtolower($match[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown class methods
|
||||
*
|
||||
* @param string $name unknown method-name
|
||||
* @param array $args argument array
|
||||
*/
|
||||
* Handle unknown class methods
|
||||
*
|
||||
* @param string $name unknown method-name
|
||||
* @param array $args argument array
|
||||
*/
|
||||
public function __call($name, $args)
|
||||
{
|
||||
static $_prefixes = array('set' => true, 'get' => true);
|
||||
|
Reference in New Issue
Block a user