Files
++ Dokumente
Test
admin
ajaxtabs
bewerbung
ckeditor5
classes
config
datepicker
fancybox-2.1.7
hogrefe
jquery
language
lib
smarty
demo
lexer
libs
internals
plugins
sysplugins
smarty_cacheresource.php
smarty_cacheresource_custom.php
smarty_cacheresource_keyvaluestore.php
smarty_data.php
smarty_internal_cacheresource_file.php
smarty_internal_compile_append.php
smarty_internal_compile_assign.php
smarty_internal_compile_block.php
smarty_internal_compile_break.php
smarty_internal_compile_call.php
smarty_internal_compile_capture.php
smarty_internal_compile_config_load.php
smarty_internal_compile_continue.php
smarty_internal_compile_debug.php
smarty_internal_compile_eval.php
smarty_internal_compile_extends.php
smarty_internal_compile_for.php
smarty_internal_compile_foreach.php
smarty_internal_compile_function.php
smarty_internal_compile_if.php
smarty_internal_compile_include.php
smarty_internal_compile_include_php.php
smarty_internal_compile_insert.php
smarty_internal_compile_ldelim.php
smarty_internal_compile_nocache.php
smarty_internal_compile_private_block_plugin.php
smarty_internal_compile_private_foreachsection.php
smarty_internal_compile_private_function_plugin.php
smarty_internal_compile_private_modifier.php
smarty_internal_compile_private_object_block_function.php
smarty_internal_compile_private_object_function.php
smarty_internal_compile_private_php.php
smarty_internal_compile_private_print_expression.php
smarty_internal_compile_private_registered_block.php
smarty_internal_compile_private_registered_function.php
smarty_internal_compile_private_special_variable.php
smarty_internal_compile_rdelim.php
smarty_internal_compile_section.php
smarty_internal_compile_setfilter.php
smarty_internal_compile_shared_inheritance.php
smarty_internal_compile_while.php
smarty_internal_compilebase.php
smarty_internal_config_file_compiler.php
smarty_internal_configfilelexer.php
smarty_internal_configfileparser.php
smarty_internal_data.php
smarty_internal_debug.php
smarty_internal_extension_clear.php
smarty_internal_extension_handler.php
smarty_internal_method_addautoloadfilters.php
smarty_internal_method_adddefaultmodifiers.php
smarty_internal_method_append.php
smarty_internal_method_appendbyref.php
smarty_internal_method_assignbyref.php
smarty_internal_method_assignglobal.php
smarty_internal_method_clearallassign.php
smarty_internal_method_clearallcache.php
smarty_internal_method_clearassign.php
smarty_internal_method_clearcache.php
smarty_internal_method_clearcompiledtemplate.php
smarty_internal_method_clearconfig.php
smarty_internal_method_compileallconfig.php
smarty_internal_method_compilealltemplates.php
smarty_internal_method_configload.php
smarty_internal_method_createdata.php
smarty_internal_method_getautoloadfilters.php
smarty_internal_method_getconfigvars.php
smarty_internal_method_getdebugtemplate.php
smarty_internal_method_getdefaultmodifiers.php
smarty_internal_method_getregisteredobject.php
smarty_internal_method_getstreamvariable.php
smarty_internal_method_gettags.php
smarty_internal_method_gettemplatevars.php
smarty_internal_method_loadfilter.php
smarty_internal_method_loadplugin.php
smarty_internal_method_mustcompile.php
smarty_internal_method_registercacheresource.php
smarty_internal_method_registerclass.php
smarty_internal_method_registerdefaultconfighandler.php
smarty_internal_method_registerdefaultpluginhandler.php
smarty_internal_method_registerdefaulttemplatehandler.php
smarty_internal_method_registerfilter.php
smarty_internal_method_registerobject.php
smarty_internal_method_registerplugin.php
smarty_internal_method_registerresource.php
smarty_internal_method_setautoloadfilters.php
smarty_internal_method_setdebugtemplate.php
smarty_internal_method_setdefaultmodifiers.php
smarty_internal_method_unloadfilter.php
smarty_internal_method_unregistercacheresource.php
smarty_internal_method_unregisterfilter.php
smarty_internal_method_unregisterobject.php
smarty_internal_method_unregisterplugin.php
smarty_internal_method_unregisterresource.php
smarty_internal_nocache_insert.php
smarty_internal_parsetree.php
smarty_internal_parsetree_code.php
smarty_internal_parsetree_dq.php
smarty_internal_parsetree_dqcontent.php
smarty_internal_parsetree_tag.php
smarty_internal_parsetree_template.php
smarty_internal_parsetree_text.php
smarty_internal_resource_eval.php
smarty_internal_resource_extends.php
smarty_internal_resource_file.php
smarty_internal_resource_php.php
smarty_internal_resource_registered.php
smarty_internal_resource_stream.php
smarty_internal_resource_string.php
smarty_internal_runtime_cachemodify.php
smarty_internal_runtime_codeframe.php
smarty_internal_runtime_filterhandler.php
smarty_internal_runtime_foreach.php
smarty_internal_runtime_getincludepath.php
smarty_internal_runtime_hhvm.php
smarty_internal_runtime_inheritance.php
smarty_internal_runtime_subtemplate.php
smarty_internal_runtime_tplfunction.php
smarty_internal_runtime_updatecache.php
smarty_internal_runtime_updatescope.php
smarty_internal_runtime_validatecompiled.php
smarty_internal_runtime_var.php
smarty_internal_runtime_writefile.php
smarty_internal_smartytemplatecompiler.php
smarty_internal_template.php
smarty_internal_templatebase.php
smarty_internal_templatecompilerbase.php
smarty_internal_templatelexer.php
smarty_internal_templateparser.php
smarty_internal_testinstall.php
smarty_internal_undefined.php
smarty_resource.php
smarty_resource_custom.php
smarty_resource_recompiled.php
smarty_resource_uncompiled.php
smarty_security.php
smarty_template_cached.php
smarty_template_compiled.php
smarty_template_config.php
smarty_template_resource_base.php
smarty_template_source.php
smarty_undefined_variable.php
smarty_variable.php
smartycompilerexception.php
smartyexception.php
Autoloader.php
Config_File.class.php
Smarty.class.php
SmartyBC.class.php
Smarty_Compiler.class.php
debug.tpl
.gitattributes
.gitignore
.travis.yml
BUGS
COMPOSER_RELEASE_NOTES.txt
COPYING.lib
ChangeLog
FAQ
INHERITANCE_RELEASE_NOTES.txt
INSTALL
NEWS
NEW_FEATURES.txt
QUICK_START
README
README.md
RELEASE_NOTES
SMARTY_2_BC_NOTES.txt
SMARTY_3.0_BC_NOTES.txt
SMARTY_3.1_NOTES.txt
TODO
change_log.txt
composer.json
smarty2
smarty_3
Smarty-2.6.28.zip
smarty-3.1.29.zip
media
mpdf
old_CKEditor_4.6.1
overlib
phpspreadsheet-1.13_php-7.4
phpspreadsheet_1.8.1.0_php-7.0
praxisstelle
status
templates
templates_c
upload
uploads
.gitignore
PHPExcel-1.8.zip
aufl.html
config.inc.php
cr_test.php
cron_remember_mail_dummy.php
cron_remember_mail_kehl.php
cron_remember_mail_lubu.php
cron_remember_upload.php
fetch_gebdat.php
func_age.php
func_fetch_tan.php
func_get_parameter.php
func_get_restplatz.php
func_id.php
func_notenskala.php
func_standard_hs.php
func_tangen.php
func_terminwahl.php
index.php
index.php_Ausbildungsjahr_dynamisch
index.php_Ausbildungsjahr_text
my.jpg
phpoffice_phpspreadsheet_1.13.0.0_require.zip
sepa-ueberweisung.jpg
sepa-ueberweisung2.jpg
tanimport.php
test.pdf
test.php
test1.php
ueberweisungstraeger.png
bpm/lib/smarty/libs/sysplugins/smarty_internal_template.php
2022-11-28 10:24:23 +01:00

377 lines
12 KiB
PHP
Executable File

<?php
/**
* Smarty Internal Plugin Template
* This file contains the Smarty template engine
*
* @package Smarty
* @subpackage Template
* @author Uwe Tews
*/
/**
* Main class with template data structures and methods
*
* @package Smarty
* @subpackage Template
*
* @property Smarty_Template_Source|Smarty_Template_Config $source
* @property Smarty_Template_Compiled $compiled
* @property Smarty_Template_Cached $cached
* @method bool mustCompile()
*/
class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
{
/**
* This object type (Smarty = 1, template = 2, data = 4)
*
* @var int
*/
public $_objType = 2;
/**
* Global smarty instance
*
* @var Smarty
*/
public $smarty = null;
/**
* Source instance
*
* @var Smarty_Template_Source|Smarty_Template_Config
*/
public $source = null;
/**
* Template resource
*
* @var string
*/
public $template_resource = null;
/**
* flag if compiled template is invalid and must be (re)compiled
*
* @var bool
*/
public $mustCompile = null;
/**
* Template Id
*
* @var null|string
*/
public $templateId = null;
/**
* Known template functions
*
* @var array
*/
public $tpl_function = array();
/**
* Scope in which template is rendered
*
* @var int
*/
public $scope = 0;
/**
* Create template data object
* Some of the global Smarty settings copied to template scope
* It load the required template resources and caching plugins
*
* @param string $template_resource template resource string
* @param Smarty $smarty Smarty instance
* @param \Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent back pointer to parent object
* with variables or null
* @param mixed $_cache_id cache id or null
* @param mixed $_compile_id compile id or null
* @param bool $_caching use caching?
* @param int $_cache_lifetime cache life-time in seconds
*
* @throws \SmartyException
*/
public function __construct($template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null,
$_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null)
{
$this->smarty = &$smarty;
// Smarty parameter
$this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
$this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id;
$this->caching = $_caching === null ? $this->smarty->caching : $_caching;
if ($this->caching === true) {
$this->caching = Smarty::CACHING_LIFETIME_CURRENT;
}
$this->cache_lifetime = $_cache_lifetime === null ? $this->smarty->cache_lifetime : $_cache_lifetime;
$this->parent = $_parent;
// Template resource
$this->template_resource = $template_resource;
$this->source = Smarty_Template_Source::load($this);
parent::__construct();
}
/**
* render template
*
* @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
* @param bool $display true: display, false: fetch null: subtemplate
*
* @throws Exception
* @throws SmartyException
* @return string rendered template output
*/
public function render($no_output_filter = true, $display = null)
{
$parentIsTpl = isset($this->parent) && $this->parent->_objType == 2;
if ($this->smarty->debugging) {
$this->smarty->_debug->start_template($this, $display);
}
// checks if template exists
if (!$this->source->exists) {
if ($parentIsTpl) {
$parent_resource = " in '{$this->parent->template_resource}'";
} else {
$parent_resource = '';
}
throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}");
}
// disable caching for evaluated code
if ($this->source->handler->recompiled) {
$this->caching = false;
}
// read from cache or render
$isCacheTpl =
$this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED;
if ($isCacheTpl) {
if (!isset($this->cached)) {
$this->loadCached();
}
$this->cached->render($this, $no_output_filter);
} elseif ($this->source->handler->uncompiled) {
$this->source->render($this);
} else {
if (!isset($this->compiled)) {
$this->loadCompiled();
}
$this->compiled->render($this);
}
// display or fetch
if ($display) {
if ($this->caching && $this->smarty->cache_modified_check) {
$this->smarty->ext->_cachemodify->cacheModifiedCheck($this->cached, $this,
isset($content) ? $content : ob_get_clean());
} else {
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) &&
!$no_output_filter && (isset($this->smarty->autoload_filters['output']) ||
isset($this->smarty->registered_filters['output']))
) {
echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
} else {
ob_end_flush();
flush();
}
}
if ($this->smarty->debugging) {
$this->smarty->_debug->end_template($this);
// debug output
$this->smarty->_debug->display_debug($this, true);
}
return '';
} else {
if ($this->smarty->debugging) {
$this->smarty->_debug->end_template($this);
if ($this->smarty->debugging === 2 && $display === false) {
$this->smarty->_debug->display_debug($this, true);
}
}
if ($parentIsTpl) {
if (!empty($this->tpl_function)) {
$this->parent->tpl_function = array_merge($this->parent->tpl_function, $this->tpl_function);
}
foreach ($this->compiled->required_plugins as $code => $tmp1) {
foreach ($tmp1 as $name => $tmp) {
foreach ($tmp as $type => $data) {
$this->parent->compiled->required_plugins[$code][$name][$type] = $data;
}
}
}
}
if (!$no_output_filter &&
(!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) &&
(isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))
) {
return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
}
// return cache content
return null;
}
}
/**
* Compiles the template
* If the template is not evaluated the compiled template is saved on disk
*/
public function compileTemplateSource()
{
return $this->compiled->compileTemplateSource($this);
}
/**
* Writes the content to cache resource
*
* @param string $content
*
* @return bool
*/
public function writeCachedContent($content)
{
return $this->smarty->ext->_updateCache->writeCachedContent($this->cached, $this, $content);
}
/**
* Get unique template id
*
* @return string
*/
public function _getTemplateId()
{
return isset($this->templateId) ? $this->templateId : $this->templateId =
$this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id);
}
/**
* runtime error not matching capture tags
*/
public function capture_error()
{
throw new SmartyException("Not matching {capture} open/close in \"{$this->template_resource}\"");
}
/**
* Load compiled object
*
*/
public function loadCompiled()
{
if (!isset($this->compiled)) {
$this->compiled = Smarty_Template_Compiled::load($this);
}
}
/**
* Load cached object
*
*/
public function loadCached()
{
if (!isset($this->cached)) {
$this->cached = Smarty_Template_Cached::load($this);
}
}
/**
* Load compiler object
*
* @throws \SmartyException
*/
public function loadCompiler()
{
if (!class_exists($this->source->handler->compiler_class)) {
$this->smarty->loadPlugin($this->source->handler->compiler_class);
}
$this->compiler = new $this->source->handler->compiler_class($this->source->handler->template_lexer_class,
$this->source->handler->template_parser_class,
$this->smarty);
}
/**
* Handle unknown class methods
*
* @param string $name unknown method-name
* @param array $args argument array
*
* @return mixed
* @throws SmartyException
*/
public function __call($name, $args)
{
// method of Smarty object?
if (method_exists($this->smarty, $name)) {
return call_user_func_array(array($this->smarty, $name), $args);
}
// parent
return parent::__call($name, $args);
}
/**
* set Smarty property in template context
*
* @param string $property_name property name
* @param mixed $value value
*
* @throws SmartyException
*/
public function __set($property_name, $value)
{
switch ($property_name) {
case 'compiled':
case 'cached':
case 'compiler':
$this->$property_name = $value;
return;
default:
// Smarty property ?
if (property_exists($this->smarty, $property_name)) {
$this->smarty->$property_name = $value;
return;
}
}
throw new SmartyException("invalid template property '$property_name'.");
}
/**
* get Smarty property in template context
*
* @param string $property_name property name
*
* @return mixed|Smarty_Template_Cached
* @throws SmartyException
*/
public function __get($property_name)
{
switch ($property_name) {
case 'compiled':
$this->loadCompiled();
return $this->compiled;
case 'cached':
$this->loadCached();
return $this->cached;
case 'compiler':
$this->loadCompiler();
return $this->compiler;
default:
// Smarty property ?
if (property_exists($this->smarty, $property_name)) {
return $this->smarty->$property_name;
}
}
throw new SmartyException("template property '$property_name' does not exist.");
}
/**
* Template data object destructor
*/
public function __destruct()
{
if ($this->smarty->cache_locking && isset($this->cached) && $this->cached->is_locked) {
$this->cached->handler->releaseLock($this->smarty, $this->cached);
}
}
}