PHPMailer6
auswertung
bootstrap
classes
config
controller
dashboard
datepicker
jquery
js
language
lib
old
smarty
demo
lexer
libs
plugins
sysplugins
smarty_cacheresource.php
smarty_cacheresource_custom.php
smarty_cacheresource_keyvaluestore.php
smarty_data.php
smarty_internal_block.php
smarty_internal_cacheresource_file.php
smarty_internal_compile_append.php
smarty_internal_compile_assign.php
smarty_internal_compile_block.php
smarty_internal_compile_block_child.php
smarty_internal_compile_block_parent.php
smarty_internal_compile_break.php
smarty_internal_compile_call.php
smarty_internal_compile_capture.php
smarty_internal_compile_child.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_make_nocache.php
smarty_internal_compile_nocache.php
smarty_internal_compile_parent.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_errorhandler.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_getconfigvariable.php
smarty_internal_method_getconfigvars.php
smarty_internal_method_getdebugtemplate.php
smarty_internal_method_getdefaultmodifiers.php
smarty_internal_method_getglobal.php
smarty_internal_method_getregisteredobject.php
smarty_internal_method_getstreamvariable.php
smarty_internal_method_gettags.php
smarty_internal_method_gettemplatevars.php
smarty_internal_method_literals.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_cacheresourcefile.php
smarty_internal_runtime_capture.php
smarty_internal_runtime_codeframe.php
smarty_internal_runtime_filterhandler.php
smarty_internal_runtime_foreach.php
smarty_internal_runtime_getincludepath.php
smarty_internal_runtime_inheritance.php
smarty_internal_runtime_make_nocache.php
smarty_internal_runtime_tplfunction.php
smarty_internal_runtime_updatecache.php
smarty_internal_runtime_updatescope.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
Smarty.class.php
SmartyBC.class.php
bootstrap.php
debug.tpl
CHANGELOG.md
COMPOSER_RELEASE_NOTES.txt
INHERITANCE_RELEASE_NOTES.txt
LICENSE
NEW_FEATURES.txt
README
README.md
SMARTY_2_BC_NOTES.txt
SMARTY_3.0_BC_NOTES.txt
SMARTY_3.1_NOTES.txt
composer.json
expectException
smarty2
smarty_3
Smarty-2.6.28.zip
smarty-3.1.29.zip
media
selfregistration
sql
survey
templates
test
tinymce
.gitignore
Hinweise_zu_php8.txt
config.inc.php
todo.txt
101 lines
4.1 KiB
PHP
101 lines
4.1 KiB
PHP
<?php
|
|
/**
|
|
* Smarty Internal Extension
|
|
* This file contains the Smarty template extension to create a code frame
|
|
*
|
|
* @package Smarty
|
|
* @subpackage Template
|
|
* @author Uwe Tews
|
|
*/
|
|
|
|
/**
|
|
* Class Smarty_Internal_Extension_CodeFrame
|
|
* Create code frame for compiled and cached templates
|
|
*/
|
|
class Smarty_Internal_Runtime_CodeFrame
|
|
{
|
|
/**
|
|
* Create code frame for compiled and cached templates
|
|
*
|
|
* @param Smarty_Internal_Template $_template
|
|
* @param string $content optional template content
|
|
* @param string $functions compiled template function and block code
|
|
* @param bool $cache flag for cache file
|
|
* @param \Smarty_Internal_TemplateCompilerBase $compiler
|
|
*
|
|
* @return string
|
|
*/
|
|
public function create(
|
|
Smarty_Internal_Template $_template,
|
|
$content = '',
|
|
$functions = '',
|
|
$cache = false,
|
|
Smarty_Internal_TemplateCompilerBase $compiler = null
|
|
) {
|
|
// build property code
|
|
$properties[ 'version' ] = Smarty::SMARTY_VERSION;
|
|
$properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
|
|
if (!$cache) {
|
|
$properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code;
|
|
$properties[ 'file_dependency' ] = $_template->compiled->file_dependency;
|
|
$properties[ 'includes' ] = $_template->compiled->includes;
|
|
} else {
|
|
$properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code;
|
|
$properties[ 'file_dependency' ] = $_template->cached->file_dependency;
|
|
$properties[ 'cache_lifetime' ] = $_template->cache_lifetime;
|
|
}
|
|
$output = "<?php\n";
|
|
$output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") .
|
|
"\n from '" . str_replace('*/', '* /', $_template->source->filepath) . "' */\n\n";
|
|
$output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n";
|
|
$dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
|
|
($cache ? 'true' : 'false') . ')';
|
|
$output .= "if ({$dec}) {\n";
|
|
$output .= "function {$properties['unifunc']} (Smarty_Internal_Template \$_smarty_tpl) {\n";
|
|
if (!$cache && !empty($compiler->tpl_function)) {
|
|
$output .= '$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions($_smarty_tpl, ';
|
|
$output .= var_export($compiler->tpl_function, true);
|
|
$output .= ");\n";
|
|
}
|
|
if ($cache && isset($_template->smarty->ext->_tplFunction)) {
|
|
$output .= "\$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " .
|
|
var_export($_template->smarty->ext->_tplFunction->getTplFunction($_template), true) . ");\n";
|
|
}
|
|
$output .= "?>";
|
|
$output .= $content;
|
|
$output .= "<?php }\n?>";
|
|
$output .= $functions;
|
|
$output .= "<?php }\n";
|
|
// remove unneeded PHP tags
|
|
if (preg_match('/\s*\?>[\n]?<\?php\s*/', $output)) {
|
|
$curr_split = preg_split(
|
|
'/\s*\?>[\n]?<\?php\s*/',
|
|
$output
|
|
);
|
|
preg_match_all(
|
|
'/\s*\?>[\n]?<\?php\s*/',
|
|
$output,
|
|
$curr_parts
|
|
);
|
|
$output = '';
|
|
foreach ($curr_split as $idx => $curr_output) {
|
|
$output .= $curr_output;
|
|
if (isset($curr_parts[ 0 ][ $idx ])) {
|
|
$output .= "\n";
|
|
}
|
|
}
|
|
}
|
|
if (preg_match('/\?>\s*$/', $output)) {
|
|
$curr_split = preg_split(
|
|
'/\?>\s*$/',
|
|
$output
|
|
);
|
|
$output = '';
|
|
foreach ($curr_split as $idx => $curr_output) {
|
|
$output .= $curr_output;
|
|
}
|
|
}
|
|
return $output;
|
|
}
|
|
}
|