From fa10e0945ecd45bfe78a2c8fb015a43092b4944b Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 10 Dec 2015 14:02:22 +0100 Subject: bug #385 update to smarty-3.1.28-dev (from Github) --- include/smarty/.gitattributes | 22 + include/smarty/.gitignore | 221 + include/smarty/.travis.yml | 25 + include/smarty/COMPOSER_RELEASE_NOTES.txt | 29 + include/smarty/INHERITANCE_RELEASE_NOTES.txt | 67 + include/smarty/NEW_FEATURES.txt | 128 + include/smarty/README | 13 +- include/smarty/README.md | 65 + include/smarty/SMARTY_3.1_NOTES.txt | 2 +- include/smarty/change_log.txt | 692 ++- include/smarty/composer.json | 43 + .../lexer/smarty_internal_configfilelexer.plex | 318 ++ .../lexer/smarty_internal_configfileparser.y | 362 ++ .../lexer/smarty_internal_templatelexer.plex | 672 +++ .../smarty/lexer/smarty_internal_templateparser.y | 1360 +++++ include/smarty/libs/Autoloader.php | 124 + include/smarty/libs/Smarty.class.php | 1371 +++-- include/smarty/libs/SmartyBC.class.php | 115 +- include/smarty/libs/debug.tpl | 281 +- include/smarty/libs/plugins/block.textformat.php | 21 +- include/smarty/libs/plugins/function.counter.php | 38 +- include/smarty/libs/plugins/function.cycle.php | 47 +- include/smarty/libs/plugins/function.fetch.php | 117 +- .../libs/plugins/function.html_checkboxes.php | 78 +- .../smarty/libs/plugins/function.html_image.php | 68 +- .../smarty/libs/plugins/function.html_options.php | 81 +- .../smarty/libs/plugins/function.html_radios.php | 74 +- .../libs/plugins/function.html_select_date.php | 157 +- .../libs/plugins/function.html_select_time.php | 72 +- .../smarty/libs/plugins/function.html_table.php | 45 +- include/smarty/libs/plugins/function.mailto.php | 45 +- include/smarty/libs/plugins/function.math.php | 54 +- .../smarty/libs/plugins/modifier.capitalize.php | 59 +- .../smarty/libs/plugins/modifier.date_format.php | 36 +- .../libs/plugins/modifier.debug_print_var.php | 75 +- include/smarty/libs/plugins/modifier.escape.php | 32 +- .../smarty/libs/plugins/modifier.regex_replace.php | 35 +- include/smarty/libs/plugins/modifier.replace.php | 23 +- include/smarty/libs/plugins/modifier.spacify.php | 18 +- include/smarty/libs/plugins/modifier.truncate.php | 33 +- .../smarty/libs/plugins/modifiercompiler.cat.php | 15 +- .../plugins/modifiercompiler.count_characters.php | 11 +- .../plugins/modifiercompiler.count_paragraphs.php | 13 +- .../plugins/modifiercompiler.count_sentences.php | 13 +- .../libs/plugins/modifiercompiler.count_words.php | 13 +- .../libs/plugins/modifiercompiler.default.php | 14 +- .../libs/plugins/modifiercompiler.escape.php | 75 +- .../libs/plugins/modifiercompiler.from_charset.php | 9 +- .../libs/plugins/modifiercompiler.indent.php | 13 +- .../smarty/libs/plugins/modifiercompiler.lower.php | 14 +- .../libs/plugins/modifiercompiler.noprint.php | 8 +- .../plugins/modifiercompiler.string_format.php | 11 +- .../smarty/libs/plugins/modifiercompiler.strip.php | 12 +- .../libs/plugins/modifiercompiler.strip_tags.php | 16 +- .../libs/plugins/modifiercompiler.to_charset.php | 9 +- .../libs/plugins/modifiercompiler.unescape.php | 9 +- .../smarty/libs/plugins/modifiercompiler.upper.php | 19 +- .../libs/plugins/modifiercompiler.wordwrap.php | 31 +- .../libs/plugins/outputfilter.trimwhitespace.php | 38 +- .../libs/plugins/shared.escape_special_chars.php | 26 +- .../libs/plugins/shared.literal_compiler_param.php | 8 +- .../smarty/libs/plugins/shared.make_timestamp.php | 19 +- .../smarty/libs/plugins/shared.mb_str_replace.php | 20 +- include/smarty/libs/plugins/shared.mb_unicode.php | 22 +- include/smarty/libs/plugins/shared.mb_wordwrap.php | 60 +- .../plugins/variablefilter.htmlspecialchars.php | 10 +- .../libs/sysplugins/smarty_cacheresource.php | 449 +- .../sysplugins/smarty_cacheresource_custom.php | 218 +- .../smarty_cacheresource_keyvaluestore.php | 300 +- .../libs/sysplugins/smarty_config_source.php | 95 - include/smarty/libs/sysplugins/smarty_data.php | 68 + .../smarty_internal_cacheresource_file.php | 207 +- .../sysplugins/smarty_internal_compile_append.php | 23 +- .../sysplugins/smarty_internal_compile_assign.php | 82 +- .../sysplugins/smarty_internal_compile_block.php | 440 +- .../sysplugins/smarty_internal_compile_break.php | 40 +- .../sysplugins/smarty_internal_compile_call.php | 77 +- .../sysplugins/smarty_internal_compile_capture.php | 62 +- .../smarty_internal_compile_config_load.php | 73 +- .../smarty_internal_compile_continue.php | 39 +- .../sysplugins/smarty_internal_compile_debug.php | 22 +- .../sysplugins/smarty_internal_compile_eval.php | 26 +- .../sysplugins/smarty_internal_compile_extends.php | 213 +- .../sysplugins/smarty_internal_compile_for.php | 120 +- .../sysplugins/smarty_internal_compile_foreach.php | 354 +- .../smarty_internal_compile_function.php | 230 +- .../libs/sysplugins/smarty_internal_compile_if.php | 247 +- .../sysplugins/smarty_internal_compile_include.php | 421 +- .../smarty_internal_compile_include_php.php | 49 +- .../sysplugins/smarty_internal_compile_insert.php | 59 +- .../sysplugins/smarty_internal_compile_ldelim.php | 27 +- .../sysplugins/smarty_internal_compile_nocache.php | 52 +- ...marty_internal_compile_private_block_plugin.php | 46 +- ...rty_internal_compile_private_foreachsection.php | 224 + ...ty_internal_compile_private_function_plugin.php | 29 +- .../smarty_internal_compile_private_modifier.php | 59 +- ...ernal_compile_private_object_block_function.php | 43 +- ...ty_internal_compile_private_object_function.php | 61 +- .../smarty_internal_compile_private_php.php | 209 + ...y_internal_compile_private_print_expression.php | 136 +- ...y_internal_compile_private_registered_block.php | 84 +- ...nternal_compile_private_registered_function.php | 44 +- ...y_internal_compile_private_special_variable.php | 176 +- .../sysplugins/smarty_internal_compile_rdelim.php | 26 +- .../sysplugins/smarty_internal_compile_section.php | 435 +- .../smarty_internal_compile_setfilter.php | 48 +- .../smarty_internal_compile_shared_inheritance.php | 46 + .../sysplugins/smarty_internal_compile_while.php | 78 +- .../sysplugins/smarty_internal_compilebase.php | 62 +- .../libs/sysplugins/smarty_internal_config.php | 302 -- .../smarty_internal_config_file_compiler.php | 120 +- .../sysplugins/smarty_internal_configfilelexer.php | 703 +-- .../smarty_internal_configfileparser.php | 973 ++-- .../libs/sysplugins/smarty_internal_data.php | 557 +- .../libs/sysplugins/smarty_internal_debug.php | 386 +- .../sysplugins/smarty_internal_extension_clear.php | 134 + .../smarty_internal_extension_handler.php | 157 + .../sysplugins/smarty_internal_filter_handler.php | 70 - .../smarty_internal_function_call_handler.php | 55 - .../smarty_internal_get_include_path.php | 48 - .../smarty_internal_method_addautoloadfilters.php | 51 + .../smarty_internal_method_adddefaultmodifiers.php | 42 + .../sysplugins/smarty_internal_method_append.php | 74 + .../smarty_internal_method_appendbyref.php | 50 + .../smarty_internal_method_assignbyref.php | 36 + .../smarty_internal_method_assignglobal.php | 43 + .../smarty_internal_method_clearallassign.php | 37 + .../smarty_internal_method_clearallcache.php | 43 + .../smarty_internal_method_clearassign.php | 44 + .../smarty_internal_method_clearcache.php | 46 + ...marty_internal_method_clearcompiledtemplate.php | 132 + .../smarty_internal_method_clearconfig.php | 41 + .../smarty_internal_method_compileallconfig.php | 32 + .../smarty_internal_method_compilealltemplates.php | 111 + .../smarty_internal_method_configload.php | 182 + .../smarty_internal_method_createdata.php | 44 + .../smarty_internal_method_getautoloadfilters.php | 37 + .../smarty_internal_method_getconfigvars.php | 58 + .../smarty_internal_method_getdebugtemplate.php | 35 + .../smarty_internal_method_getdefaultmodifiers.php | 35 + .../smarty_internal_method_getregisteredobject.php | 44 + .../smarty_internal_method_getstreamvariable.php | 51 + .../sysplugins/smarty_internal_method_gettags.php | 62 + .../smarty_internal_method_gettemplatevars.php | 114 + .../smarty_internal_method_loadfilter.php | 77 + .../smarty_internal_method_loadplugin.php | 111 + .../smarty_internal_method_mustcompile.php | 49 + ...marty_internal_method_registercacheresource.php | 39 + .../smarty_internal_method_registerclass.php | 46 + ...nternal_method_registerdefaultconfighandler.php | 42 + ...nternal_method_registerdefaultpluginhandler.php | 43 + ...ernal_method_registerdefaulttemplatehandler.php | 72 + .../smarty_internal_method_registerfilter.php | 88 + .../smarty_internal_method_registerobject.php | 71 + .../smarty_internal_method_registerplugin.php | 50 + .../smarty_internal_method_registerresource.php | 44 + .../smarty_internal_method_setautoloadfilters.php | 70 + .../smarty_internal_method_setdebugtemplate.php | 41 + .../smarty_internal_method_setdefaultmodifiers.php | 38 + .../smarty_internal_method_unloadfilter.php | 42 + ...rty_internal_method_unregistercacheresource.php | 40 + .../smarty_internal_method_unregisterfilter.php | 42 + .../smarty_internal_method_unregisterobject.php | 40 + .../smarty_internal_method_unregisterplugin.php | 41 + .../smarty_internal_method_unregisterresource.php | 40 + .../sysplugins/smarty_internal_nocache_insert.php | 32 +- .../libs/sysplugins/smarty_internal_parsetree.php | 375 +- .../sysplugins/smarty_internal_parsetree_code.php | 42 + .../sysplugins/smarty_internal_parsetree_dq.php | 88 + .../smarty_internal_parsetree_dqcontent.php | 42 + .../sysplugins/smarty_internal_parsetree_tag.php | 69 + .../smarty_internal_parsetree_template.php | 128 + .../sysplugins/smarty_internal_parsetree_text.php | 40 + .../sysplugins/smarty_internal_resource_eval.php | 56 +- .../smarty_internal_resource_extends.php | 179 +- .../sysplugins/smarty_internal_resource_file.php | 155 +- .../sysplugins/smarty_internal_resource_php.php | 102 +- .../smarty_internal_resource_registered.php | 52 +- .../sysplugins/smarty_internal_resource_stream.php | 83 +- .../sysplugins/smarty_internal_resource_string.php | 57 +- .../smarty_internal_runtime_cachemodify.php | 67 + .../smarty_internal_runtime_codeframe.php | 94 + .../smarty_internal_runtime_filterhandler.php | 69 + .../sysplugins/smarty_internal_runtime_foreach.php | 44 + .../smarty_internal_runtime_getincludepath.php | 180 + .../sysplugins/smarty_internal_runtime_hhvm.php | 30 + .../smarty_internal_runtime_inheritance.php | 213 + .../smarty_internal_runtime_subtemplate.php | 203 + .../smarty_internal_runtime_tplfunction.php | 97 + .../smarty_internal_runtime_updatecache.php | 184 + .../smarty_internal_runtime_updatescope.php | 55 + .../smarty_internal_runtime_validatecompiled.php | 81 + .../sysplugins/smarty_internal_runtime_var.php | 33 + .../smarty_internal_runtime_writefile.php | 90 + .../smarty_internal_smartytemplatecompiler.php | 132 +- .../libs/sysplugins/smarty_internal_template.php | 704 +-- .../sysplugins/smarty_internal_templatebase.php | 903 +--- .../smarty_internal_templatecompilerbase.php | 954 +++- .../sysplugins/smarty_internal_templatelexer.php | 1506 +++--- .../sysplugins/smarty_internal_templateparser.php | 5357 +++++++++----------- .../sysplugins/smarty_internal_testinstall.php | 604 +++ .../libs/sysplugins/smarty_internal_undefined.php | 48 + .../libs/sysplugins/smarty_internal_utility.php | 830 --- .../libs/sysplugins/smarty_internal_write_file.php | 88 - include/smarty/libs/sysplugins/smarty_resource.php | 803 +-- .../libs/sysplugins/smarty_resource_custom.php | 41 +- .../libs/sysplugins/smarty_resource_recompiled.php | 31 +- .../libs/sysplugins/smarty_resource_uncompiled.php | 57 +- include/smarty/libs/sysplugins/smarty_security.php | 560 +- .../libs/sysplugins/smarty_template_cached.php | 246 + .../libs/sysplugins/smarty_template_compiled.php | 297 ++ .../libs/sysplugins/smarty_template_config.php | 97 + .../sysplugins/smarty_template_resource_base.php | 162 + .../libs/sysplugins/smarty_template_source.php | 267 + .../libs/sysplugins/smarty_undefined_variable.php | 37 + include/smarty/libs/sysplugins/smarty_variable.php | 47 + .../libs/sysplugins/smartycompilerexception.php | 39 + include/smarty/libs/sysplugins/smartyexception.php | 15 + 218 files changed, 22701 insertions(+), 13564 deletions(-) create mode 100644 include/smarty/.gitattributes create mode 100644 include/smarty/.gitignore create mode 100644 include/smarty/.travis.yml create mode 100644 include/smarty/COMPOSER_RELEASE_NOTES.txt create mode 100644 include/smarty/INHERITANCE_RELEASE_NOTES.txt create mode 100644 include/smarty/NEW_FEATURES.txt create mode 100644 include/smarty/README.md create mode 100644 include/smarty/composer.json create mode 100644 include/smarty/lexer/smarty_internal_configfilelexer.plex create mode 100644 include/smarty/lexer/smarty_internal_configfileparser.y create mode 100644 include/smarty/lexer/smarty_internal_templatelexer.plex create mode 100644 include/smarty/lexer/smarty_internal_templateparser.y create mode 100644 include/smarty/libs/Autoloader.php delete mode 100644 include/smarty/libs/sysplugins/smarty_config_source.php create mode 100644 include/smarty/libs/sysplugins/smarty_data.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_compile_private_php.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php delete mode 100644 include/smarty/libs/sysplugins/smarty_internal_config.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_extension_clear.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_extension_handler.php delete mode 100644 include/smarty/libs/sysplugins/smarty_internal_filter_handler.php delete mode 100644 include/smarty/libs/sysplugins/smarty_internal_function_call_handler.php delete mode 100644 include/smarty/libs/sysplugins/smarty_internal_get_include_path.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_append.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_clearassign.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_clearcache.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_configload.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_createdata.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_gettags.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerclass.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerobject.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_registerresource.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_parsetree_code.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_parsetree_template.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_parsetree_text.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_var.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_testinstall.php create mode 100644 include/smarty/libs/sysplugins/smarty_internal_undefined.php delete mode 100644 include/smarty/libs/sysplugins/smarty_internal_utility.php delete mode 100644 include/smarty/libs/sysplugins/smarty_internal_write_file.php create mode 100644 include/smarty/libs/sysplugins/smarty_template_cached.php create mode 100644 include/smarty/libs/sysplugins/smarty_template_compiled.php create mode 100644 include/smarty/libs/sysplugins/smarty_template_config.php create mode 100644 include/smarty/libs/sysplugins/smarty_template_resource_base.php create mode 100644 include/smarty/libs/sysplugins/smarty_template_source.php create mode 100644 include/smarty/libs/sysplugins/smarty_undefined_variable.php create mode 100644 include/smarty/libs/sysplugins/smarty_variable.php create mode 100644 include/smarty/libs/sysplugins/smartycompilerexception.php create mode 100644 include/smarty/libs/sysplugins/smartyexception.php diff --git a/include/smarty/.gitattributes b/include/smarty/.gitattributes new file mode 100644 index 000000000..412eeda78 --- /dev/null +++ b/include/smarty/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/include/smarty/.gitignore b/include/smarty/.gitignore new file mode 100644 index 000000000..0ff15aa49 --- /dev/null +++ b/include/smarty/.gitignore @@ -0,0 +1,221 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +.idea/ + +# Smarty +lexer/*.php +lexer/*.out diff --git a/include/smarty/.travis.yml b/include/smarty/.travis.yml new file mode 100644 index 000000000..fbf081bac --- /dev/null +++ b/include/smarty/.travis.yml @@ -0,0 +1,25 @@ +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - hhvm + +matrix: + allow_failures: + - php: hhvm + +before_script: + - travis_retry composer self-update + - travis_retry composer --prefer-source --dev install + +install: + - git clone --depth=50 --branch=master git://github.com/smarty-php/smarty-phpunit.git + +script: + - cd smarty-phpunit + - phpunit ./ + diff --git a/include/smarty/COMPOSER_RELEASE_NOTES.txt b/include/smarty/COMPOSER_RELEASE_NOTES.txt new file mode 100644 index 000000000..c943d9f2e --- /dev/null +++ b/include/smarty/COMPOSER_RELEASE_NOTES.txt @@ -0,0 +1,29 @@ + + +Starting with Smarty 3.1.21 Composer has been configured to load the packages from github. + +******************************************************************************* +* * +* NOTE: Because of this change you must clear your local composer cache with * +* the "composer clearcache" command * +* * +******************************************************************************* + +To get the latest stable version use + "require": { + "smarty/smarty": "~3.1" + } +in your composer.json file. + +To get the trunk version use + "require": { + "smarty/smarty": "~3.1@dev" + } + +The "smarty/smarty" package will start at libs/.... subfolder. + +To retrieve the development and documentation folders add + "require-dev": { + "smarty/smarty-dev": "~3.1@dev" + } + diff --git a/include/smarty/INHERITANCE_RELEASE_NOTES.txt b/include/smarty/INHERITANCE_RELEASE_NOTES.txt new file mode 100644 index 000000000..8568a35c8 --- /dev/null +++ b/include/smarty/INHERITANCE_RELEASE_NOTES.txt @@ -0,0 +1,67 @@ +Starting with version 3.1.28 template inheritance is no longer a compile time process. +All {block} tag parent/child relations are resolved at run time. +This does resolve all known existing restrictions (see below). + +The $smarty::$inheritance_merge_compiled_includes property has been removed. +Any access to it is ignored. + +This does enable some new features: + +Any code outside root {block} tags in child templates is now executed but any output will be ignored. + + {extends 'foo.tpl} + {$bar = 'on'} // assigns variable $bar seen in parent templates + {block 'buh'}{/block} + + {extends 'foo.tpl} + {$bar} // the output of variable bar is ignored + {block 'buh'}{/block} + +{block} tags can be dynamically en/disabled by conditions. + + {block 'root} + {if $foo} + {block 'v1} + .... + {/block} + {else} + {block 'v1} + .... + {/block} + {/if} + {/block} + + + +THE FOLLOWING RESTRICTIONS ARE NO LONGER EXISTING: +In Smarty 3.1 template inheritance is a compile time process. All the extending of {block} tags +is done at compile time and the parent and child templates are compiled in a single compiled template. +{include} subtemplate could also {block} tags. Such subtemplate could not compiled by it's own because +it could be used in other context where the {block} extended with a different result. For that reasion +the compiled code of {include} subtemplates gets also merged in compiled inheritance template. + +Merging the code into a single compile template has some drawbacks. +1. You could not use variable file names in {include} Smarty would use the {include} of compilation time. +2. You could not use individual compile_id in {include} +3. Seperate caching of subtemplate was not possible +4. Any change of the template directory structure between calls was not necessarily seen. + +Starting with 3.1.15 some of the above conditions got checked and resulted in an exception. It turned out +that a couple of users did use some of above and now got exceptions. + +To resolve this starting with 3.1.16 there is a new configuration parameter $inheritance_merge_compiled_includes. +For most backward compatibility its default setting is true. +With this setting all {include} subtemplate will be merge into the compiled inheritance template, but the above cases +could be rejected by exception. + + +If $smarty->inheritance_merge_compiled_includes = false; {include} subtemplate will not be merged. +You must now manually merge all {include} subtemplate which do contain {block} tags. This is done by setting the "inline" option. +{include file='foo.bar' inline} + +1. In case of a variable file name like {include file=$foo inline} you must use the variable in a compile_id $smarty->compile_id = $foo; +2. If you use individual compile_id in {include file='foo.tpl' compile_id=$bar inline} it must be used in the + global compile_id as well $smarty->compile_id = $bar; +3. If call templates with different template_dir configurations and a parent could same named child template from different folders + you must make the folder name part of the compile_id. + diff --git a/include/smarty/NEW_FEATURES.txt b/include/smarty/NEW_FEATURES.txt new file mode 100644 index 000000000..67d391a52 --- /dev/null +++ b/include/smarty/NEW_FEATURES.txt @@ -0,0 +1,128 @@ + + +This file contains a brief description of new features which have been added to Smarty 3.1 + +Smarty 3.1.28 + + OPCACHE + ======= + Smarty does now invalidate automatically updated and cleared compiled or cached template files in OPCACHE. + Correct operation is no longer dependent on OPCACHE configuration settings. + + Template inheritance + ==================== + Template inheritance is now processed in run time. + See the INHERITANCE_RELEASE_NOTES + + Modifier regex_replace + ====================== + An optional limit parameter was added + + fetch() and display() + ===================== + The fetch() and display() methods of the template object accept now optionally the same parameter + as the corresponding Smarty methods the get tne content of another template. + + File: resource + ============== + Multiple template_dir entries can now be selected by a comma separated list of indices. + The template_dir array is searched in the order of the indices. (could be used to change the default search order) + + Filter support + ============== + Optional filter names + An optional filter name was added to $smarty->registerFilter(). It can be used to unregister a filter by name. + - $smarty->registerFilter('output', $callback, 'name'); + $smarty->unregister('output', 'name'); + + Closures + $smarty->registerFilter() does now accept closures. + - $smarty->registerFilter('pre', function($source) {return $source;}); + If no optional filter name was specified it gets the default name 'closure'. + If you register multiple closures register each with a unique filter name. + - $smarty->registerFilter('pre', function($source) {return $source;}, 'clousre_1'); + - $smarty->registerFilter('pre', function($source) {return $source;}, 'clousre_2'); + + +Smarty 3.1.22 + + Namespace support within templates + ================================== + Within templates you can now use namespace specifications on: + - Constants like foo\bar\FOO + - Class names like foo\bar\Baz::FOO, foo\bar\Baz::$foo, foo\bar\Baz::foo() + - PHP function names like foo\bar\baz() + + Security + ======== + - disable special $smarty variable - + The Smarty_Security class has the new property $disabled_special_smarty_vars. + It's an array which can be loaded with the $smarty special variable names like + 'template_object', 'template', 'current_dir' and others which will be disabled. + Note: That this security check is performed at compile time. + + - limit template nesting - + Property $max_template_nesting of Smarty_Security does set the maximum template nesting level. + The main template is level 1. The nesting level is checked at run time. When the maximum will be exceeded + an Exception will be thrown. The default setting is 0 which does disable this check. + + - trusted static methods - + The Smarty_Security class has the new property $trusted_static_methods to restrict access to static methods. + It's an nested array of trusted class and method names. + Format: + array ( + 'class_1' => array('method_1', 'method_2'), // allowed methods + 'class_2' => array(), // all methods of class allowed + ) + To disable access for all methods of all classes set $trusted_static_methods = null; + The default value is an empty array() which does enables all methods of all classes, but for backward compatibility + the setting of $static_classes will be checked. + Note: That this security check is performed at compile time. + + - trusted static properties - + The Smarty_Security class has the new property $trusted_static_properties to restrict access to static properties. + It's an nested array of trusted class and property names. + Format: + array ( + 'class_1' => array('prop_1', 'prop_2'), // allowed properties listed + 'class_2' => array(), // all properties of class allowed + } + To disable access for all properties of all classes set $trusted_static_properties = null; + The default value is an empty array() which does enables all properties of all classes, but for backward compatibility + the setting of $static_classes will be checked. + Note: That this security check is performed at compile time. + + - trusted constants . + The Smarty_Security class has the new property $trusted_constants to restrict access to constants. + It's an array of trusted constant names. + Format: + array ( + 'SMARTY_DIR' , // allowed constant + } + If the array is empty (default) the usage of constants can be controlled with the + Smarty_Security::$allow_constants property (default true) + + + + Compiled Templates + ================== + Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html + property and creates different compiled templates files depending on the setting. + + Same applies to config files and the $config_overwrite, $config_booleanize and + $config_read_hidden properties. + + Debugging + ========= + The layout of the debug window has been changed for better readability + + New class constants + Smarty::DEBUG_OFF + Smarty::DEBUG_ON + Smarty::DEBUG_INDIVIDUAL + have been introduced for setting the $debugging property. + + Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual debug window. + + . + \ No newline at end of file diff --git a/include/smarty/README b/include/smarty/README index bf03403aa..08b397c3f 100644 --- a/include/smarty/README +++ b/include/smarty/README @@ -1,4 +1,4 @@ -Smarty 3.1.13 +Smarty 3.x Author: Monte Ohrt Author: Uwe Tews @@ -120,7 +120,7 @@ $smarty->unregisterObject($object_name) $smarty->unregisterFilter($type, $function_name) $smarty->unregisterResource($resource_type) -$smarty->compileAllTemplates($extention = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null) +$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null) $smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) $smarty->testInstall() @@ -460,12 +460,13 @@ included template. PLUGINS ======= -Smarty3 are following the same coding rules as in Smarty2. -The only difference is that the template object is passed as additional third parameter. +Smarty 3 plugins follow the same coding rules as in Smarty 2. +The main difference is that the template object is now passed in place of the smarty object. +The smarty object can be still be accessed through $template->smarty. -smarty_plugintype_name (array $params, object $smarty, object $template) +smarty_plugintype_name (array $params, Smarty_Internal_Template $template) -The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty2 internals. +The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty 2 internals. TEMPLATE INHERITANCE: diff --git a/include/smarty/README.md b/include/smarty/README.md new file mode 100644 index 000000000..5783eb3e0 --- /dev/null +++ b/include/smarty/README.md @@ -0,0 +1,65 @@ +#Smarty 3 template engine +##Distribution repository + +> Smarty 3.1.28 introduces run time template inheritance + +> Read the NEW_FEATURES and INHERITANCE_RELEASE_NOTES file for recent extensions to Smarty 3.1 functionality + +Smarty versions 3.1.11 or later are now on github and can be installed with Composer. + + +The "smarty/smarty" package will start at libs/.... subfolder. + +To get the latest stable version of Smarty 3.1 use + +```json +"require": { + "smarty/smarty": "~3.1" +} +``` + +in your composer.json file. + +To get the trunk version use + +```json +"require": { + "smarty/smarty": "~3.1@dev" +} +``` + +For a specific version use something like + +```json +"require": { + "smarty/smarty": "3.1.19" +} +``` + +PHPUnit test can be installed by corresponding composer entries like + +```json +"require": { + "smarty/smarty-phpunit": "3.1.19" +} +``` + +Similar applies for the lexer/parser generator + +```json +"require": { + "smarty/smarty-lexer": "3.1.19" +} +``` + +Or you could use + +```json +"require": { + "smarty/smarty-dev": "3.1.19" +} +``` + +Which is a wrapper to install all 3 packages + +Composer can also be used for Smarty2 versions 2.6.24 to 2.6.28 diff --git a/include/smarty/SMARTY_3.1_NOTES.txt b/include/smarty/SMARTY_3.1_NOTES.txt index e56e56f67..57709f0d7 100644 --- a/include/smarty/SMARTY_3.1_NOTES.txt +++ b/include/smarty/SMARTY_3.1_NOTES.txt @@ -199,7 +199,7 @@ Relative paths are available with {include file="..."} and $smarty->fetch('./foo.tpl') cannot be relative to a template, an exception is thrown. - Adressing a specific $template_dir + Addressing a specific $template_dir Smarty 3.1 introduces the $template_dir index notation. $smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"} diff --git a/include/smarty/change_log.txt b/include/smarty/change_log.txt index 69642e276..e9472f45b 100644 --- a/include/smarty/change_log.txt +++ b/include/smarty/change_log.txt @@ -1,9 +1,679 @@ -===== Smarty-3.1.13 ===== + ===== 3.1.28-dev===== (xx.xx.2015) + 09.12.2015 + - bugix Smarty did fail under PHP 7.0.0 with use_include_path = true; + + 09.12.2015 + -bugfix {strip} should exclude some html tags from stripping, related to fix for https://github.com/smarty-php/smarty/issues/111 + + 08.12.2015 + - bugfix internal template function data got stored in wrong compiled file https://github.com/smarty-php/smarty/issues/114 + + 05.12.2015 + -bugfix {strip} should insert a single space https://github.com/smarty-php/smarty/issues/111 + + 25.11.2015 + -bugfix a left delimter like '[%' did fail on [%$var_[%$variable%]%] (forum topic 25798) + + 02.11.2015 + - bugfix {include} with variable file name like {include file="foo_`$bar`.tpl"} did fail in 3.1.28-dev https://github.com/smarty-php/smarty/issues/102 + + 01.11.2015 + - update config file processing + + 31.10.2015 + - bugfix add missing $trusted_dir property to SmartyBC class (forum topic 25751) + + 29.10.2015 + - improve template scope handling + + 24.10.2015 + - more optimizations of template processing + - bugfix Error when using {include} within {capture} https://github.com/smarty-php/smarty/issues/100 + + 21.10.2015 + - move some code into runtime extensions + + 18.10.2015 + - optimize filepath normalization + - rework of template inheritance + - speed and size optimizations + - bugfix under HHVM temporary cache file must only be created when caches template was updated + - fix compiled code for new {block} assign attribute + - update code generated by template function call handler + + 18.09.2015 + - bugfix {if $foo instanceof $bar} failed to compile if 2nd value is a variable https://github.com/smarty-php/smarty/issues/92 + + 17.09.2015 + - bugfix {foreach} first attribute was not correctly reset since commit 05a8fa2 of 02.08.2015 https://github.com/smarty-php/smarty/issues/90 + + 16.09.2015 + - update compiler by moving no longer needed properties, code optimizations and other + + 14.09.2015 + - optimize autoloader + - optimize subtemplate handling + - update template inheritance processing + - move code of {call} processing back into Smarty_Internal_Template class + - improvement invalidate OPCACHE for cleared compiled and cached template files (forum topic 25557) + - bugfix unintended multiple debug windows (forum topic 25699) + + 30.08.2015 + - size optimization move some runtime functions into extension + - optimize inline template processing + - optimization merge inheritance child and parent templates into one compiled template file + + 29.08.2015 + - improvement convert template inheritance into runtime processing + - bugfix {$smarty.block.parent} did always reference the root parent block https://github.com/smarty-php/smarty/issues/68 + + 23.08.2015 + - introduce Smarty::$resource_cache_mode and cache template object of {include} inside loop + - load seldom used Smarty API methods dynamically to reduce memory footprint + - cache template object of {include} if same template is included several times + - convert debug console processing to object + - use output buffers for better performance and less memory usage + - optimize nocache hash processing + - remove not really needed properties + - optimize rendering + - move caching to Smarty::_cache + - remove properties with redundant content + - optimize Smarty::templateExists() + - optimize use_include_path processing + - relocate properties for size optimization + - remove redundant code + - bugfix compiling super globals like {$smarty.get.foo} did fail in the master branch https://github.com/smarty-php/smarty/issues/77 + + 06.08.2015 + - avoid possible circular object references caused by parser/lexer objects + - rewrite compileAll... utility methods + - commit several internal improvements + - bugfix Smarty failed when compile_id did contain "|" + + 03.08.2015 + - rework clear cache methods + - bugfix compileAllConfig() was broken since 3.1.22 because of the changes in config file processing + - improve getIncludePath() to return directory if no file was given + + 02.08.2015 + - optimization and code cleanup of {foreach} and {section} compiler + - rework {capture} compiler + + 01.08.2015 + - update DateTime object can be instance of DateTimeImmutable since PHP5.5 https://github.com/smarty-php/smarty/pull/75 + - improvement show resource type and start of template source instead of uid on eval: and string: resource (forum topic 25630) + + 31.07.2015 + - optimize {foreach} and {section} compiler + + 29.07.2015 + - optimize {section} compiler for speed and size of compiled code + + 28.07.2015 + - update for PHP 7 compatibility + + 26.07.2015 + - improvement impement workaround for HHVM PHP incompatibillity https://github.com/facebook/hhvm/issues/4797 + + 25.07.2015 + - bugfix parser did hang on text starting fetch('foo.tpl') https://github.com/smarty-php/smarty/issues/70 + - improvement Added $limit parameter to regex_replace modifier #71 + - new feature multiple indices on file: resource + + 06.07.2015 + - optimize {block} compilation + - optimization get rid of __get and __set in source object + + 01.07.2015 + - optimize compile check handling + - update {foreach} compiler + - bugfix debugging console did not display string values containing \n, \r or \t correctly https://github.com/smarty-php/smarty/issues/66 + - optimize source resources + + 28.06.2015 + - move $smarty->enableSecurity() into Smarty_Security class + - optimize security isTrustedResourceDir() + - move auto load filter methods into extension + - move $smarty->getTemplateVars() into extension + - move getStreamVariable() into extension + - move $smarty->append() and $smarty->appendByRef() into extension + - optimize autoloader + - optimize file path normalization + - bugfix PATH_SEPARATOR was replaced by mistake in autoloader + - remove redundant code + + 27.06.2015 + - bugfix resolve naming conflict between custom Smarty delimiter '<%' and PHP ASP tags https://github.com/smarty-php/smarty/issues/64 + - update $smarty->_realpath for relative path not starting with './' + - update Smarty security with new realpath handling + - update {include_php} with new realpath handling + - move $smarty->loadPlugin() into extension + - minor compiler optimizations + - bugfix allow function plugins with name ending with 'close' https://github.com/smarty-php/smarty/issues/52 + - rework of $smarty->clearCompiledTemplate() and move it to its own extension + + 19.06.2015 + - improvement allow closures as callback at $smarty->registerFilter() https://github.com/smarty-php/smarty/issues/59 + + ===== 3.1.27===== (18.06.2015) + 18.06.2015 + - bugfix another update on file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56 + + ===== 3.1.26===== (18.06.2015) + 18.06.2015 + - bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56 + + 17.06.2015 + - bugfix calling a plugin with nocache option but no other attributes like {foo nocache} caused call to undefined function https://github.com/smarty-php/smarty/issues/55 + + ===== 3.1.25===== (15.06.2015) + 15.06.2015 + - optimization of smarty_cachereource_keyvaluestore.php code + + 14.06.2015 + - bugfix a relative sub template path could fail if template_dir path did contain /../ https://github.com/smarty-php/smarty/issues/50 + - optimization rework of path normalization + - bugfix an output tag with variable, modifier followed by an operator like {$foo|modifier+1} did fail https://github.com/smarty-php/smarty/issues/53 + + 13.06.2015 + - bugfix a custom cache resource using smarty_cachereource_keyvaluestore.php did fail if php.ini mbstring.func_overload = 2 (forum topic 25568) + + 11.06.2015 + - bugfix the lexer could hang on very large quoted strings (forum topic 25570) + + 08.06.2015 + - bugfix using {$foo} as array index like $bar.{$foo} or in double quoted string like "some {$foo} thing" failed https://github.com/smarty-php/smarty/issues/49 + + 04.06.2015 + - bugfix possible error message on unset() while compiling {block} tags https://github.com/smarty-php/smarty/issues/46 + + 01.06.2015 + - bugfix including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47 + + 27.05.2015 + - bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43 + + 24.05.2015 + - bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42 + + ===== 3.1.24===== (23.05.2015) + 23.05.2015 + - improvement on php_handling to allow very large PHP sections, better error handling + - improvement allow extreme large comment sections (forum 25538) + + 21.05.2015 + - bugfix broken PHP 5.2 compatibility when compiling 1 did compile into wrong code https://github.com/smarty-php/smarty/issues/41 + + 19.05.2015 + - bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39 + - bugfix output filter trimwhitespace could run into the pcre.backtrack_limit on large output (code.google issue 220) + - bugfix compiler could run into the pcre.backtrack_limit on larger comment or {php} tag sections (forum 25538) + + 18.05.2015 + - improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher + compilation speed + + 16.05.2015 + - bugfix {php}{/php} did work just for single lines https://github.com/smarty-php/smarty/issues/33 + - improvement remove not needed ?> handling from parser to new compiler module + + 05.05.2015 + - bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23 + + 04.05.2015 + - bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22) + - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (https://github.com/smarty-php/smarty/issues/24) + + 28.04.2015 + - bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508) 2nd fix + + 28.04.2015 + - bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508) + + 23.04.2015 + - bugfix a nocache template variable used as parameter at {insert} was by mistake cached + + 20.04.2015 + - bugfix at a template function containing nocache code a parmeter could overwrite a template variable of same name + + 27.03.2015 + - bugfix Smarty_Security->allow_constants=false; did also disable true, false and null (change of 16.03.2015) + - improvement added a whitelist for trusted constants to security Smarty_Security::$trusted_constants (forum topic 25471) + + 20.03.2015 + - bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452} + - bugfix correct update of global variable values on exit of template functions. (reported under Smarty Developers) + + 16.03.2015 + - bugfix problems with {function}{/function} and {call} tags in different subtemplate cache files {forum topic 25452} + - bugfix Smarty_Security->allow_constants=false; did not disallow direct usage of defined constants like {SMARTY_DIR} {forum topic 25457} + - bugfix {block}{/block} tags did not work inside double quoted strings https://github.com/smarty-php/smarty/issues/18 + + + 15.03.2015 + - bugfix $smarty->compile_check must be restored before rendering of a just updated cache file {forum 25452} + + 14.03.2015 + - bugfix {nocache} {/nocache} tags corrupted code when used within a nocache section caused by a nocache template variable. + + - bugfix template functions defined with {function} in an included subtemplate could not be called in nocache + mode with {call... nocache} if the subtemplate had it's own cache file {forum 25452} + + 10.03.2015 + - bugfix {include ... nocache} whith variable file or compile_id attribute was not executed in nocache mode. + + 12.02.2015 + - bugfix multiple Smarty::fetch() of same template when $smarty->merge_compiled_includes = true; could cause function already defined error + + 11.02.2015 + - bugfix recursive {includes} did create E_NOTICE message when $smarty->merge_compiled_includes = true; (github issue #16) + + 22.01.2015 + - new feature security can now control access to static methods and properties + see also NEW_FEATURES.txt + + 21.01.2015 + - bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive at wrong path permissions because realpath() fail (forum 25397) + - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class + + 04.01.2015 + - push last weeks changes to github + + - different optimizations + - improvement automatically create different versions of compiled templates and config files depending + on property settings. + - optimization restructure template processing by moving code into classes it better belongs to + - optimization restructure config file processing + + 31.12.2014 + - bugfix use function_exists('mb_get_info') for setting Smarty::$_MBSTRING. + Function mb_split could be overloaded depending on php.ini mbstring.func_overload + + + 29.12.2014 + - new feature security can now limit the template nesting level by property $max_template_nesting + see also NEW_FEATURES.txt (forum 25370) + + 29.12.2014 + - new feature security can now disable special $smarty variables listed in property $disabled_special_smarty_vars + see also NEW_FEATURES.txt (forum 25370) + + 27.12.2014 + - bugfix clear internal _is_file_cache when plugins_dir was modified + + 13.12.2014 + - improvement optimization of lexer and parser resulting in a up to 30% higher compiling speed + + 11.12.2014 + - bugfix resolve parser ambiguity between constant print tag {CONST} and other smarty tags after change of 09.12.2014 + + 09.12.2014 + - bugfix variables $null, $true and $false did not work after the change of 12.11.2014 (forum 25342) + - bugfix call of template function by a variable name did not work after latest changes (forum 25342) + + 23.11.2014 + - bugfix a plugin with attached modifier could fail if the tag was immediately followed by another Smarty tag (since 3.1.21) (forum 25326) + + 13.11.2014 + - improvement move autoload code into Autoloader.php. Use Composer autoloader when possible + + 12.11.2014 + - new feature added support of namespaces to template code + + 08.11.2014 - 10.11.2014 + - bugfix subtemplate called in nocache mode could be called with wrong compile_id when it did change on one of the calling templates + - improvement add code of template functions called in nocache mode dynamically to cache file (related to bugfix of 01.11.2014) + - bugfix Debug Console did not include all data from merged compiled subtemplates + + 04.11.2014 + - new feature $smarty->debugging = true; => overwrite existing Debug Console window (old behaviour) + $smarty->debugging = 2; => individual Debug Console window by template name + + 03.11.2014 + - bugfix Debug Console did not show included subtemplates since 3.1.17 (forum 25301) + - bugfix Modifier debug_print_var did not limit recursion or prevent recursive object display at Debug Console + (ATTENTION: parameter order has changed to be able to specify maximum recursion) + - bugfix Debug consol did not include subtemplate information with $smarty->merge_compiled_includes = true + - improvement The template variables are no longer displayed as objects on the Debug Console + - improvement $smarty->createData($parent = null, $name = null) new optional name parameter for display at Debug Console + - addition of some hooks for future extension of Debug Console + + 01.11.2014 + - bugfix and enhancement on subtemplate {include} and template {function} tags. + * Calling a template which has a nocache section could fail if it was called from a cached and a not cached subtemplate. + * Calling the same subtemplate cached and not cached with the $smarty->merge_compiled_includes enabled could cause problems + * Many smaller related changes + + 30.10.2014 + - bugfix access to class constant by object like {$object::CONST} or variable class name {$class::CONST} did not work (forum 25301) + + 26.10.2014 + - bugfix E_NOTICE message was created during compilation when ASP tags '<%' or '%>' are in template source text + - bugfix merge_compiled_includes option failed when caching enables and same subtemplate was included cached and not cached + + ===== 3.1.21 ===== (18.10.2014) + 18.10.2014 + - composer moved to github + + 17.10.2014 + - bugfix on $php_handling security and optimization of smarty_internal_parsetree (Thue Kristensen) + + 16.10.2014 + - bugfix composer.json update + + 15.10.2014 + - bugfix calling a new created cache file with fetch() and Smarty::CACHING_LIFETIME_SAVED multiple times did fail (forum 22350) + + 14.10.2014 + - bugfix any tag placed within " diff --git a/include/smarty/libs/plugins/block.textformat.php b/include/smarty/libs/plugins/block.textformat.php index b22b104a5..abf544939 100644 --- a/include/smarty/libs/plugins/block.textformat.php +++ b/include/smarty/libs/plugins/block.textformat.php @@ -2,13 +2,12 @@ /** * Smarty plugin to format text blocks * - * @package Smarty + * @package Smarty * @subpackage PluginsBlock */ /** * Smarty {textformat}{/textformat} block plugin - * * Type: block function
* Name: textformat
* Purpose: format text a certain way with preset styles @@ -23,12 +22,14 @@ * - wrap_boundary - boolean (true) * * - * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} - * (Smarty online manual) + * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} + * (Smarty online manual) + * * @param array $params parameters * @param string $content contents of the block * @param Smarty_Internal_Template $template template object * @param boolean &$repeat repeat flag + * * @return string content re-formatted * @author Monte Ohrt */ @@ -53,17 +54,17 @@ function smarty_block_textformat($params, $content, $template, &$repeat) case 'indent_char': case 'wrap_char': case 'assign': - $$_key = (string)$_val; + $$_key = (string) $_val; break; case 'indent': case 'indent_first': case 'wrap': - $$_key = (int)$_val; + $$_key = (int) $_val; break; case 'wrap_cut': - $$_key = (bool)$_val; + $$_key = (bool) $_val; break; default: @@ -76,8 +77,6 @@ function smarty_block_textformat($params, $content, $template, &$repeat) } // split into paragraphs $_paragraphs = preg_split('![\r\n]{2}!', $content); - $_output = ''; - foreach ($_paragraphs as &$_paragraph) { if (!$_paragraph) { @@ -102,12 +101,10 @@ function smarty_block_textformat($params, $content, $template, &$repeat) } } $_output = implode($wrap_char . $wrap_char, $_paragraphs); - + if ($assign) { $template->assign($assign, $_output); } else { return $_output; } } - -?> \ No newline at end of file diff --git a/include/smarty/libs/plugins/function.counter.php b/include/smarty/libs/plugins/function.counter.php index 3906badf0..4da85a14e 100644 --- a/include/smarty/libs/plugins/function.counter.php +++ b/include/smarty/libs/plugins/function.counter.php @@ -1,22 +1,24 @@ * Name: counter
* Purpose: print out a counter value * * @author Monte Ohrt - * @link http://www.smarty.net/manual/en/language.function.counter.php {counter} - * (Smarty online manual) + * @link http://www.smarty.net/manual/en/language.function.counter.php {counter} + * (Smarty online manual) + * * @param array $params parameters * @param Smarty_Internal_Template $template template object + * * @return string|null */ function smarty_function_counter($params, $template) @@ -26,16 +28,16 @@ function smarty_function_counter($params, $template) $name = (isset($params['name'])) ? $params['name'] : 'default'; if (!isset($counters[$name])) { $counters[$name] = array( - 'start'=>1, - 'skip'=>1, - 'direction'=>'up', - 'count'=>1 - ); + 'start' => 1, + 'skip' => 1, + 'direction' => 'up', + 'count' => 1 + ); } $counter =& $counters[$name]; if (isset($params['start'])) { - $counter['start'] = $counter['count'] = (int)$params['start']; + $counter['start'] = $counter['count'] = (int) $params['start']; } if (!empty($params['assign'])) { @@ -45,9 +47,9 @@ function smarty_function_counter($params, $template) if (isset($counter['assign'])) { $template->assign($counter['assign'], $counter['count']); } - + if (isset($params['print'])) { - $print = (bool)$params['print']; + $print = (bool) $params['print']; } else { $print = empty($counter['assign']); } @@ -61,18 +63,16 @@ function smarty_function_counter($params, $template) if (isset($params['skip'])) { $counter['skip'] = $params['skip']; } - + if (isset($params['direction'])) { $counter['direction'] = $params['direction']; } - if ($counter['direction'] == "down") + if ($counter['direction'] == "down") { $counter['count'] -= $counter['skip']; - else + } else { $counter['count'] += $counter['skip']; - + } + return $retval; - } - -?> \ No newline at end of file diff --git a/include/smarty/libs/plugins/function.cycle.php b/include/smarty/libs/plugins/function.cycle.php index 1778ffb53..8dc5cd9d5 100644 --- a/include/smarty/libs/plugins/function.cycle.php +++ b/include/smarty/libs/plugins/function.cycle.php @@ -2,13 +2,12 @@ /** * Smarty plugin * - * @package Smarty + * @package Smarty * @subpackage PluginsFunction */ /** * Smarty {cycle} function plugin - * * Type: function
* Name: cycle
* Date: May 3, 2002
@@ -31,15 +30,17 @@ * {cycle name=row} * * - * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} - * (Smarty online manual) - * @author Monte Ohrt - * @author credit to Mark Priatel - * @author credit to Gerard - * @author credit to Jason Sweat + * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} + * (Smarty online manual) + * @author Monte Ohrt + * @author credit to Mark Priatel + * @author credit to Gerard + * @author credit to Jason Sweat * @version 1.3 + * * @param array $params parameters * @param Smarty_Internal_Template $template template object + * * @return string|null */ @@ -48,18 +49,20 @@ function smarty_function_cycle($params, $template) static $cycle_vars; $name = (empty($params['name'])) ? 'default' : $params['name']; - $print = (isset($params['print'])) ? (bool)$params['print'] : true; - $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true; - $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false; + $print = (isset($params['print'])) ? (bool) $params['print'] : true; + $advance = (isset($params['advance'])) ? (bool) $params['advance'] : true; + $reset = (isset($params['reset'])) ? (bool) $params['reset'] : false; if (!isset($params['values'])) { - if(!isset($cycle_vars[$name]['values'])) { + if (!isset($cycle_vars[$name]['values'])) { trigger_error("cycle: missing 'values' parameter"); + return; } } else { - if(isset($cycle_vars[$name]['values']) - && $cycle_vars[$name]['values'] != $params['values'] ) { + if (isset($cycle_vars[$name]['values']) + && $cycle_vars[$name]['values'] != $params['values'] + ) { $cycle_vars[$name]['index'] = 0; } $cycle_vars[$name]['values'] = $params['values']; @@ -71,13 +74,13 @@ function smarty_function_cycle($params, $template) $cycle_vars[$name]['delimiter'] = ','; } - if(is_array($cycle_vars[$name]['values'])) { + if (is_array($cycle_vars[$name]['values'])) { $cycle_array = $cycle_vars[$name]['values']; } else { - $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); + $cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']); } - if(!isset($cycle_vars[$name]['index']) || $reset ) { + if (!isset($cycle_vars[$name]['index']) || $reset) { $cycle_vars[$name]['index'] = 0; } @@ -86,21 +89,19 @@ function smarty_function_cycle($params, $template) $template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]); } - if($print) { + if ($print) { $retval = $cycle_array[$cycle_vars[$name]['index']]; } else { $retval = null; } - if($advance) { - if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { + if ($advance) { + if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) { $cycle_vars[$name]['index'] = 0; } else { - $cycle_vars[$name]['index']++; + $cycle_vars[$name]['index'] ++; } } return $retval; } - -?> \ No newline at end of file diff --git a/include/smarty/libs/plugins/function.fetch.php b/include/smarty/libs/plugins/function.fetch.php index eca1182d5..3506d4a8d 100644 --- a/include/smarty/libs/plugins/function.fetch.php +++ b/include/smarty/libs/plugins/function.fetch.php @@ -2,50 +2,53 @@ /** * Smarty plugin * - * @package Smarty + * @package Smarty * @subpackage PluginsFunction */ /** * Smarty {fetch} plugin - * * Type: function
* Name: fetch
* Purpose: fetch file, web or ftp data and display results * - * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch} - * (Smarty online manual) + * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch} + * (Smarty online manual) * @author Monte Ohrt + * * @param array $params parameters * @param Smarty_Internal_Template $template template object + * + * @throws SmartyException * @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable */ function smarty_function_fetch($params, $template) { if (empty($params['file'])) { - trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE); + trigger_error("[plugin] fetch parameter 'file' cannot be empty", E_USER_NOTICE); + return; } - + // strip file protocol if (stripos($params['file'], 'file://') === 0) { $params['file'] = substr($params['file'], 7); } - + $protocol = strpos($params['file'], '://'); if ($protocol !== false) { $protocol = strtolower(substr($params['file'], 0, $protocol)); } - + if (isset($template->smarty->security_policy)) { if ($protocol) { // remote resource (or php stream, …) - if(!$template->smarty->security_policy->isTrustedUri($params['file'])) { + if (!$template->smarty->security_policy->isTrustedUri($params['file'])) { return; } } else { // local file - if(!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) { + if (!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) { return; } } @@ -54,53 +57,54 @@ function smarty_function_fetch($params, $template) $content = ''; if ($protocol == 'http') { // http fetch - if($uri_parts = parse_url($params['file'])) { + if ($uri_parts = parse_url($params['file'])) { // set defaults $host = $server_name = $uri_parts['host']; $timeout = 30; $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; - $agent = "Smarty Template Engine ". Smarty::SMARTY_VERSION; + $agent = "Smarty Template Engine " . Smarty::SMARTY_VERSION; $referer = ""; $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; $_is_proxy = false; - if(empty($uri_parts['port'])) { + if (empty($uri_parts['port'])) { $port = 80; } else { $port = $uri_parts['port']; } - if(!empty($uri_parts['user'])) { + if (!empty($uri_parts['user'])) { $user = $uri_parts['user']; } - if(!empty($uri_parts['pass'])) { + if (!empty($uri_parts['pass'])) { $pass = $uri_parts['pass']; } // loop through parameters, setup headers - foreach($params as $param_key => $param_value) { - switch($param_key) { + foreach ($params as $param_key => $param_value) { + switch ($param_key) { case "file": case "assign": case "assign_headers": break; case "user": - if(!empty($param_value)) { + if (!empty($param_value)) { $user = $param_value; } break; case "pass": - if(!empty($param_value)) { + if (!empty($param_value)) { $pass = $param_value; } break; case "accept": - if(!empty($param_value)) { + if (!empty($param_value)) { $accept = $param_value; } break; case "header": - if(!empty($param_value)) { - if(!preg_match('![\w\d-]+: .+!',$param_value)) { - trigger_error("[plugin] invalid header format '".$param_value."'",E_USER_NOTICE); + if (!empty($param_value)) { + if (!preg_match('![\w\d-]+: .+!', $param_value)) { + trigger_error("[plugin] invalid header format '" . $param_value . "'", E_USER_NOTICE); + return; } else { $extra_headers[] = $param_value; @@ -108,99 +112,104 @@ function smarty_function_fetch($params, $template) } break; case "proxy_host": - if(!empty($param_value)) { + if (!empty($param_value)) { $proxy_host = $param_value; } break; case "proxy_port": - if(!preg_match('!\D!', $param_value)) { + if (!preg_match('!\D!', $param_value)) { $proxy_port = (int) $param_value; } else { - trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE); + trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + return; } break; case "agent": - if(!empty($param_value)) { + if (!empty($param_value)) { $agent = $param_value; } break; case "referer": - if(!empty($param_value)) { + if (!empty($param_value)) { $referer = $param_value; } break; case "timeout": - if(!preg_match('!\D!', $param_value)) { + if (!preg_match('!\D!', $param_value)) { $timeout = (int) $param_value; } else { - trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE); + trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + return; } break; default: - trigger_error("[plugin] unrecognized attribute '".$param_key."'",E_USER_NOTICE); + trigger_error("[plugin] unrecognized attribute '" . $param_key . "'", E_USER_NOTICE); + return; } } - if(!empty($proxy_host) && !empty($proxy_port)) { + if (!empty($proxy_host) && !empty($proxy_port)) { $_is_proxy = true; - $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout); + $fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout); } else { - $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout); + $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout); } - if(!$fp) { - trigger_error("[plugin] unable to fetch: $errstr ($errno)",E_USER_NOTICE); + if (!$fp) { + trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE); + return; } else { - if($_is_proxy) { + if ($_is_proxy) { fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n"); } else { fputs($fp, "GET $uri HTTP/1.0\r\n"); } - if(!empty($host)) { + if (!empty($host)) { fputs($fp, "Host: $host\r\n"); } - if(!empty($accept)) { + if (!empty($accept)) { fputs($fp, "Accept: $accept\r\n"); } - if(!empty($agent)) { + if (!empty($agent)) { fputs($fp, "User-Agent: $agent\r\n"); } - if(!empty($referer)) { + if (!empty($referer)) { fputs($fp, "Referer: $referer\r\n"); } - if(isset($extra_headers) && is_array($extra_headers)) { - foreach($extra_headers as $curr_header) { - fputs($fp, $curr_header."\r\n"); + if (isset($extra_headers) && is_array($extra_headers)) { + foreach ($extra_headers as $curr_header) { + fputs($fp, $curr_header . "\r\n"); } } - if(!empty($user) && !empty($pass)) { - fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); + if (!empty($user) && !empty($pass)) { + fputs($fp, "Authorization: BASIC " . base64_encode("$user:$pass") . "\r\n"); } fputs($fp, "\r\n"); - while(!feof($fp)) { - $content .= fgets($fp,4096); + while (!feof($fp)) { + $content .= fgets($fp, 4096); } fclose($fp); - $csplit = preg_split("!\r\n\r\n!",$content,2); + $csplit = preg_split("!\r\n\r\n!", $content, 2); $content = $csplit[1]; - if(!empty($params['assign_headers'])) { - $template->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0])); + if (!empty($params['assign_headers'])) { + $template->assign($params['assign_headers'], preg_split("!\r\n!", $csplit[0])); } } } else { - trigger_error("[plugin fetch] unable to parse URL, check syntax",E_USER_NOTICE); + trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE); + return; } } else { $content = @file_get_contents($params['file']); if ($content === false) { - throw new SmartyException("{fetch} cannot read resource '" . $params['file'] ."'"); + throw new SmartyException("{fetch} cannot read resource '" . $params['file'] . "'"); } } @@ -210,5 +219,3 @@ function smarty_function_fetch($params, $template) return $content; } } - -?> \ No newline at end of file diff --git a/include/smarty/libs/plugins/function.html_checkboxes.php b/include/smarty/libs/plugins/function.html_checkboxes.php index 1866bc2f3..d78680368 100644 --- a/include/smarty/libs/plugins/function.html_checkboxes.php +++ b/include/smarty/libs/plugins/function.html_checkboxes.php @@ -2,13 +2,12 @@ /** * Smarty plugin * - * @package Smarty + * @package Smarty * @subpackage PluginsFunction */ /** * Smarty {html_checkboxes} function plugin - * * File: function.html_checkboxes.php
* Type: function
* Name: html_checkboxes
@@ -32,15 +31,17 @@ * - escape (optional) - escape the content (not value), defaults to true * * - * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} - * (Smarty online manual) + * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} + * (Smarty online manual) * @author Christopher Kvarme - * @author credits to Monte Ohrt + * @author credits to Monte Ohrt * @version 1.0 - * @param array $params parameters + * + * @param array $params parameters * @param object $template template object + * * @return string - * @uses smarty_function_escape_special_chars() + * @uses smarty_function_escape_special_chars() */ function smarty_function_html_checkboxes($params, $template) { @@ -58,8 +59,8 @@ function smarty_function_html_checkboxes($params, $template) $extra = ''; - foreach($params as $_key => $_val) { - switch($_key) { + foreach ($params as $_key => $_val) { + switch ($_key) { case 'name': case 'separator': $$_key = (string) $_val; @@ -89,7 +90,7 @@ function smarty_function_html_checkboxes($params, $template) if (method_exists($_sel, "__toString")) { $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); } else { - trigger_error("html_checkboxes: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE); + trigger_error("html_checkboxes: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE); continue; } } else { @@ -101,7 +102,7 @@ function smarty_function_html_checkboxes($params, $template) if (method_exists($_val, "__toString")) { $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - trigger_error("html_checkboxes: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE); + trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE); } } else { $selected = smarty_function_escape_special_chars((string) $_val); @@ -116,7 +117,8 @@ function smarty_function_html_checkboxes($params, $template) case 'assign': break; - case 'strict': break; + case 'strict': + break; case 'disabled': case 'readonly': @@ -131,11 +133,11 @@ function smarty_function_html_checkboxes($params, $template) break; } - // omit break; to fall through! + // omit break; to fall through! default: - if(!is_array($_val)) { - $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; + if (!is_array($_val)) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); } @@ -143,76 +145,79 @@ function smarty_function_html_checkboxes($params, $template) } } - if (!isset($options) && !isset($values)) - return ''; /* raise error here? */ + if (!isset($options) && !isset($values)) { + return ''; + } /* raise error here? */ $_html_result = array(); if (isset($options)) { - foreach ($options as $_key=>$_val) { + foreach ($options as $_key => $_val) { $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape); } } else { - foreach ($values as $_i=>$_key) { + foreach ($values as $_i => $_key) { $_val = isset($output[$_i]) ? $output[$_i] : ''; $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape); } } - if(!empty($params['assign'])) { + if (!empty($params['assign'])) { $template->assign($params['assign'], $_html_result); } else { return implode("\n", $_html_result); } - } -function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true) { +function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape = true) +{ $_output = ''; - + if (is_object($value)) { if (method_exists($value, "__toString")) { $value = (string) $value->__toString(); } else { - trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE); + trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE); + return ''; } } else { $value = (string) $value; } - + if (is_object($output)) { if (method_exists($output, "__toString")) { $output = (string) $output->__toString(); } else { - trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE); + trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE); + return ''; } } else { $output = (string) $output; } - + if ($labels) { if ($label_ids) { $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value)); $_output .= '