From e65bee75ffd89a6723055d0a72b891eb28157638 Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Fri, 8 Apr 2022 20:11:23 -0300 Subject: [PATCH] Composer oriented packages --- composer.json | 6 +- composer.lock | 412 ++ system/credis/autoload.php | 1516 +------ system/engine/autoload.php | 22 +- system/engine/controller.php | 159 +- system/engine/log.php | 4 +- system/engine/render.php | 204 + system/engine/response.php | 2 +- system/templateEngines/Twig/autoload.php | 10 +- system/vendor/autoload.php | 7 + .../vendor/colinmollenhour/credis/Client.php | 1535 +++++++ .../vendor/colinmollenhour/credis/Cluster.php | 343 ++ system/vendor/colinmollenhour/credis/LICENSE | 23 + .../vendor/colinmollenhour/credis/Module.php | 68 + .../colinmollenhour/credis/README.markdown | 206 + .../colinmollenhour/credis/Sentinel.php | 367 ++ .../colinmollenhour/credis/composer.json | 27 + .../colinmollenhour/credis/phpunit_local.sh | 26 + .../credis/testenv/docker-compose.yml | 32 + .../credis/testenv/env/php-5.6/Dockerfile | 24 + .../credis/testenv/env/php-7.0/Dockerfile | 25 + .../credis/testenv/env/php-7.1/Dockerfile | 25 + .../credis/testenv/env/php-7.2/Dockerfile | 25 + .../credis/testenv/env/php-7.3/Dockerfile | 25 + .../credis/testenv/env/php-7.4/Dockerfile | 25 + system/vendor/composer/ClassLoader.php | 445 ++ system/vendor/composer/LICENSE | 21 + system/vendor/composer/autoload_classmap.php | 187 + system/vendor/composer/autoload_files.php | 11 + .../vendor/composer/autoload_namespaces.php | 10 + system/vendor/composer/autoload_psr4.php | 12 + system/vendor/composer/autoload_real.php | 73 + system/vendor/composer/autoload_static.php | 242 ++ system/vendor/composer/installed.json | 405 ++ .../vendor/mustache/mustache/.gitattributes | 8 + system/vendor/mustache/mustache/LICENSE | 21 + system/vendor/mustache/mustache/README.md | 73 + system/vendor/mustache/mustache/composer.json | 25 + .../mustache/src/Mustache/Autoloader.php | 88 + .../mustache/mustache/src/Mustache/Cache.php | 43 + .../src/Mustache/Cache/AbstractCache.php | 60 + .../src/Mustache/Cache/FilesystemCache.php | 161 + .../mustache/src/Mustache/Cache/NoopCache.php | 47 + .../mustache/src/Mustache/Compiler.php | 689 ++++ .../mustache/src/Mustache/Context.php | 242 ++ .../mustache/mustache/src/Mustache/Engine.php | 829 ++++ .../mustache/src/Mustache/Exception.php | 18 + .../Exception/InvalidArgumentException.php | 18 + .../src/Mustache/Exception/LogicException.php | 18 + .../Mustache/Exception/RuntimeException.php | 18 + .../Mustache/Exception/SyntaxException.php | 41 + .../Exception/UnknownFilterException.php | 38 + .../Exception/UnknownHelperException.php | 38 + .../Exception/UnknownTemplateException.php | 38 + .../src/Mustache/HelperCollection.php | 172 + .../mustache/src/Mustache/LambdaHelper.php | 76 + .../mustache/mustache/src/Mustache/Loader.php | 27 + .../src/Mustache/Loader/ArrayLoader.php | 79 + .../src/Mustache/Loader/CascadingLoader.php | 69 + .../src/Mustache/Loader/FilesystemLoader.php | 135 + .../src/Mustache/Loader/InlineLoader.php | 123 + .../src/Mustache/Loader/MutableLoader.php | 31 + .../Loader/ProductionFilesystemLoader.php | 86 + .../src/Mustache/Loader/StringLoader.php | 39 + .../mustache/mustache/src/Mustache/Logger.php | 126 + .../src/Mustache/Logger/AbstractLogger.php | 121 + .../src/Mustache/Logger/StreamLogger.php | 194 + .../mustache/mustache/src/Mustache/Parser.php | 317 ++ .../mustache/mustache/src/Mustache/Source.php | 40 + .../src/Mustache/Source/FilesystemSource.php | 77 + .../mustache/src/Mustache/Template.php | 180 + .../mustache/src/Mustache/Tokenizer.php | 347 ++ system/vendor/smarty/smarty/CHANGELOG.md | 3494 ++++++++++++++++ .../smarty/smarty/COMPOSER_RELEASE_NOTES.txt | 31 + .../smarty/INHERITANCE_RELEASE_NOTES.txt | 91 + system/vendor/smarty/smarty/LICENSE | 179 + system/vendor/smarty/smarty/NEW_FEATURES.txt | 291 ++ system/vendor/smarty/smarty/README | 575 +++ system/vendor/smarty/smarty/README.md | 78 + system/vendor/smarty/smarty/SECURITY.md | 19 + .../smarty/smarty/SMARTY_2_BC_NOTES.txt | 109 + .../smarty/smarty/SMARTY_3.0_BC_NOTES.txt | 24 + .../vendor/smarty/smarty/SMARTY_3.1_NOTES.txt | 306 ++ system/vendor/smarty/smarty/composer.json | 46 + .../smarty/smarty/demo/configs/test.conf | 5 + system/vendor/smarty/smarty/demo/index.php | 35 + .../smarty/demo/plugins/cacheresource.apc.php | 85 + .../demo/plugins/cacheresource.memcache.php | 99 + .../demo/plugins/cacheresource.mysql.php | 183 + .../smarty/demo/plugins/cacheresource.pdo.php | 346 ++ .../demo/plugins/cacheresource.pdo_gzip.php | 42 + .../demo/plugins/resource.extendsall.php | 62 + .../smarty/demo/plugins/resource.mysql.php | 101 + .../smarty/demo/plugins/resource.mysqls.php | 77 + .../smarty/smarty/demo/templates/footer.tpl | 2 + .../smarty/smarty/demo/templates/header.tpl | 5 + .../smarty/smarty/demo/templates/index.tpl | 87 + .../smarty_internal_configfilelexer.plex | 318 ++ .../lexer/smarty_internal_configfileparser.y | 346 ++ .../lexer/smarty_internal_templatelexer.plex | 696 ++++ .../lexer/smarty_internal_templateparser.y | 1280 ++++++ .../vendor/smarty/smarty/libs/Autoloader.php | 110 + .../smarty/smarty/libs/Smarty.class.php | 1424 +++++++ .../smarty/smarty/libs/SmartyBC.class.php | 477 +++ .../vendor/smarty/smarty/libs/bootstrap.php | 16 + system/vendor/smarty/smarty/libs/debug.tpl | 160 + .../smarty/libs/plugins/block.textformat.php | 121 + .../smarty/libs/plugins/function.counter.php | 62 + .../smarty/libs/plugins/function.cycle.php | 92 + .../smarty/libs/plugins/function.fetch.php | 204 + .../libs/plugins/function.html_checkboxes.php | 286 ++ .../libs/plugins/function.html_image.php | 158 + .../libs/plugins/function.html_options.php | 230 ++ .../libs/plugins/function.html_radios.php | 266 ++ .../plugins/function.html_select_date.php | 388 ++ .../plugins/function.html_select_time.php | 354 ++ .../libs/plugins/function.html_table.php | 164 + .../smarty/libs/plugins/function.mailto.php | 134 + .../smarty/libs/plugins/function.math.php | 142 + .../libs/plugins/modifier.capitalize.php | 145 + .../libs/plugins/modifier.date_format.php | 85 + .../libs/plugins/modifier.debug_print_var.php | 103 + .../smarty/libs/plugins/modifier.escape.php | 260 ++ .../libs/plugins/modifier.mb_wordwrap.php | 71 + .../libs/plugins/modifier.regex_replace.php | 55 + .../smarty/libs/plugins/modifier.replace.php | 37 + .../smarty/libs/plugins/modifier.spacify.php | 26 + .../smarty/libs/plugins/modifier.truncate.php | 62 + .../libs/plugins/modifiercompiler.cat.php | 28 + .../modifiercompiler.count_characters.php | 32 + .../modifiercompiler.count_paragraphs.php | 26 + .../modifiercompiler.count_sentences.php | 26 + .../plugins/modifiercompiler.count_words.php | 31 + .../libs/plugins/modifiercompiler.default.php | 32 + .../libs/plugins/modifiercompiler.escape.php | 113 + .../plugins/modifiercompiler.from_charset.php | 30 + .../libs/plugins/modifiercompiler.indent.php | 30 + .../libs/plugins/modifiercompiler.lower.php | 29 + .../libs/plugins/modifiercompiler.noprint.php | 20 + .../modifiercompiler.string_format.php | 24 + .../libs/plugins/modifiercompiler.strip.php | 30 + .../plugins/modifiercompiler.strip_tags.php | 28 + .../plugins/modifiercompiler.to_charset.php | 30 + .../plugins/modifiercompiler.unescape.php | 44 + .../libs/plugins/modifiercompiler.upper.php | 28 + .../plugins/modifiercompiler.wordwrap.php | 39 + .../plugins/outputfilter.trimwhitespace.php | 89 + .../plugins/shared.escape_special_chars.php | 32 + .../plugins/shared.literal_compiler_param.php | 35 + .../libs/plugins/shared.make_timestamp.php | 49 + .../libs/plugins/shared.mb_str_replace.php | 53 + .../smarty/libs/plugins/shared.mb_unicode.php | 51 + .../variablefilter.htmlspecialchars.php | 19 + .../libs/sysplugins/smarty_cacheresource.php | 219 + .../smarty_cacheresource_custom.php | 297 ++ .../smarty_cacheresource_keyvaluestore.php | 538 +++ .../smarty/libs/sysplugins/smarty_data.php | 68 + .../libs/sysplugins/smarty_internal_block.php | 90 + .../smarty_internal_cacheresource_file.php | 239 ++ .../smarty_internal_compile_append.php | 52 + .../smarty_internal_compile_assign.php | 96 + .../smarty_internal_compile_block.php | 189 + .../smarty_internal_compile_block_child.php | 24 + .../smarty_internal_compile_block_parent.php | 31 + .../smarty_internal_compile_break.php | 117 + .../smarty_internal_compile_call.php | 89 + .../smarty_internal_compile_capture.php | 105 + .../smarty_internal_compile_child.php | 79 + .../smarty_internal_compile_config_load.php | 96 + .../smarty_internal_compile_continue.php | 25 + .../smarty_internal_compile_debug.php | 40 + .../smarty_internal_compile_eval.php | 70 + .../smarty_internal_compile_extends.php | 158 + .../smarty_internal_compile_for.php | 164 + .../smarty_internal_compile_foreach.php | 343 ++ .../smarty_internal_compile_function.php | 236 ++ .../sysplugins/smarty_internal_compile_if.php | 207 + .../smarty_internal_compile_include.php | 347 ++ .../smarty_internal_compile_include_php.php | 110 + .../smarty_internal_compile_insert.php | 157 + .../smarty_internal_compile_ldelim.php | 37 + .../smarty_internal_compile_make_nocache.php | 62 + .../smarty_internal_compile_nocache.php | 73 + .../smarty_internal_compile_parent.php | 31 + ..._internal_compile_private_block_plugin.php | 124 + ...nternal_compile_private_foreachsection.php | 228 ++ ...ternal_compile_private_function_plugin.php | 78 + ...arty_internal_compile_private_modifier.php | 158 + ..._compile_private_object_block_function.php | 42 + ...ternal_compile_private_object_function.php | 85 + .../smarty_internal_compile_private_php.php | 253 ++ ...ernal_compile_private_print_expression.php | 161 + ...ernal_compile_private_registered_block.php | 72 + ...al_compile_private_registered_function.php | 91 + ...ernal_compile_private_special_variable.php | 130 + .../smarty_internal_compile_rdelim.php | 34 + .../smarty_internal_compile_section.php | 462 +++ .../smarty_internal_compile_setfilter.php | 68 + ...ty_internal_compile_shared_inheritance.php | 49 + .../smarty_internal_compile_while.php | 100 + .../smarty_internal_compilebase.php | 203 + .../smarty_internal_config_file_compiler.php | 209 + .../smarty_internal_configfilelexer.php | 739 ++++ .../smarty_internal_configfileparser.php | 1046 +++++ .../libs/sysplugins/smarty_internal_data.php | 292 ++ .../libs/sysplugins/smarty_internal_debug.php | 425 ++ .../smarty_internal_errorhandler.php | 113 + .../smarty_internal_extension_handler.php | 197 + ...rty_internal_method_addautoloadfilters.php | 53 + ...ty_internal_method_adddefaultmodifiers.php | 42 + .../smarty_internal_method_append.php | 74 + .../smarty_internal_method_appendbyref.php | 49 + .../smarty_internal_method_assignbyref.php | 36 + .../smarty_internal_method_assignglobal.php | 44 + .../smarty_internal_method_clearallassign.php | 36 + .../smarty_internal_method_clearallcache.php | 41 + .../smarty_internal_method_clearassign.php | 43 + .../smarty_internal_method_clearcache.php | 50 + ..._internal_method_clearcompiledtemplate.php | 131 + .../smarty_internal_method_clearconfig.php | 41 + ...marty_internal_method_compileallconfig.php | 36 + ...ty_internal_method_compilealltemplates.php | 130 + .../smarty_internal_method_configload.php | 182 + .../smarty_internal_method_createdata.php | 44 + ...rty_internal_method_getautoloadfilters.php | 37 + ...arty_internal_method_getconfigvariable.php | 34 + .../smarty_internal_method_getconfigvars.php | 58 + ...marty_internal_method_getdebugtemplate.php | 35 + ...ty_internal_method_getdefaultmodifiers.php | 35 + .../smarty_internal_method_getglobal.php | 47 + ...ty_internal_method_getregisteredobject.php | 44 + ...arty_internal_method_getstreamvariable.php | 50 + .../smarty_internal_method_gettags.php | 63 + ...smarty_internal_method_gettemplatevars.php | 119 + .../smarty_internal_method_literals.php | 100 + .../smarty_internal_method_loadfilter.php | 77 + .../smarty_internal_method_loadplugin.php | 111 + .../smarty_internal_method_mustcompile.php | 50 + ..._internal_method_registercacheresource.php | 42 + .../smarty_internal_method_registerclass.php | 46 + ...al_method_registerdefaultconfighandler.php | 42 + ...al_method_registerdefaultpluginhandler.php | 43 + ..._method_registerdefaulttemplatehandler.php | 88 + .../smarty_internal_method_registerfilter.php | 87 + .../smarty_internal_method_registerobject.php | 84 + .../smarty_internal_method_registerplugin.php | 58 + ...marty_internal_method_registerresource.php | 46 + ...rty_internal_method_setautoloadfilters.php | 72 + ...marty_internal_method_setdebugtemplate.php | 41 + ...ty_internal_method_setdefaultmodifiers.php | 38 + .../smarty_internal_method_unloadfilter.php | 43 + ...nternal_method_unregistercacheresource.php | 40 + ...marty_internal_method_unregisterfilter.php | 43 + ...marty_internal_method_unregisterobject.php | 40 + ...marty_internal_method_unregisterplugin.php | 41 + ...rty_internal_method_unregisterresource.php | 40 + .../smarty_internal_nocache_insert.php | 51 + .../sysplugins/smarty_internal_parsetree.php | 50 + .../smarty_internal_parsetree_code.php | 42 + .../smarty_internal_parsetree_dq.php | 95 + .../smarty_internal_parsetree_dqcontent.php | 42 + .../smarty_internal_parsetree_tag.php | 67 + .../smarty_internal_parsetree_template.php | 169 + .../smarty_internal_parsetree_text.php | 57 + .../smarty_internal_resource_eval.php | 94 + .../smarty_internal_resource_extends.php | 126 + .../smarty_internal_resource_file.php | 180 + .../smarty_internal_resource_php.php | 116 + .../smarty_internal_resource_registered.php | 101 + .../smarty_internal_resource_stream.php | 78 + .../smarty_internal_resource_string.php | 108 + .../smarty_internal_runtime_cachemodify.php | 68 + ...rty_internal_runtime_cacheresourcefile.php | 139 + .../smarty_internal_runtime_capture.php | 174 + .../smarty_internal_runtime_codeframe.php | 100 + .../smarty_internal_runtime_filterhandler.php | 69 + .../smarty_internal_runtime_foreach.php | 162 + ...smarty_internal_runtime_getincludepath.php | 181 + .../smarty_internal_runtime_inheritance.php | 251 ++ .../smarty_internal_runtime_make_nocache.php | 54 + .../smarty_internal_runtime_tplfunction.php | 177 + .../smarty_internal_runtime_updatecache.php | 183 + .../smarty_internal_runtime_updatescope.php | 115 + .../smarty_internal_runtime_writefile.php | 100 + ...smarty_internal_smartytemplatecompiler.php | 184 + .../sysplugins/smarty_internal_template.php | 740 ++++ .../smarty_internal_templatebase.php | 386 ++ .../smarty_internal_templatecompilerbase.php | 1760 ++++++++ .../smarty_internal_templatelexer.php | 1095 +++++ .../smarty_internal_templateparser.php | 3627 +++++++++++++++++ .../smarty_internal_testinstall.php | 609 +++ .../sysplugins/smarty_internal_undefined.php | 67 + .../libs/sysplugins/smarty_resource.php | 262 ++ .../sysplugins/smarty_resource_custom.php | 93 + .../sysplugins/smarty_resource_recompiled.php | 94 + .../sysplugins/smarty_resource_uncompiled.php | 49 + .../libs/sysplugins/smarty_security.php | 721 ++++ .../sysplugins/smarty_template_cached.php | 257 ++ .../sysplugins/smarty_template_compiled.php | 257 ++ .../sysplugins/smarty_template_config.php | 100 + .../smarty_template_resource_base.php | 152 + .../sysplugins/smarty_template_source.php | 213 + .../sysplugins/smarty_undefined_variable.php | 33 + .../libs/sysplugins/smarty_variable.php | 47 + .../sysplugins/smartycompilerexception.php | 45 + .../libs/sysplugins/smartyexception.php | 19 + .../vendor/symfony/polyfill-ctype/Ctype.php | 232 ++ system/vendor/symfony/polyfill-ctype/LICENSE | 19 + .../vendor/symfony/polyfill-ctype/README.md | 12 + .../symfony/polyfill-ctype/bootstrap.php | 50 + .../symfony/polyfill-ctype/bootstrap80.php | 46 + .../symfony/polyfill-ctype/composer.json | 41 + .../vendor/symfony/polyfill-mbstring/LICENSE | 19 + .../symfony/polyfill-mbstring/Mbstring.php | 873 ++++ .../symfony/polyfill-mbstring/README.md | 13 + .../Resources/unidata/lowerCase.php | 1397 +++++++ .../Resources/unidata/titleCaseRegexp.php | 5 + .../Resources/unidata/upperCase.php | 1489 +++++++ .../symfony/polyfill-mbstring/bootstrap.php | 147 + .../symfony/polyfill-mbstring/bootstrap80.php | 143 + .../symfony/polyfill-mbstring/composer.json | 41 + system/vendor/twig/twig/.editorconfig | 18 + system/vendor/twig/twig/.gitattributes | 4 + .../vendor/twig/twig/.github/workflows/ci.yml | 175 + .../twig/.github/workflows/documentation.yml | 60 + system/vendor/twig/twig/.gitignore | 4 + .../vendor/twig/twig/.php-cs-fixer.dist.php | 20 + system/vendor/twig/twig/CHANGELOG | 132 + system/vendor/twig/twig/LICENSE | 27 + system/vendor/twig/twig/README.rst | 23 + system/vendor/twig/twig/composer.json | 50 + .../twig/twig/src/Cache/CacheInterface.php | 46 + .../twig/twig/src/Cache/FilesystemCache.php | 87 + .../vendor/twig/twig/src/Cache/NullCache.php | 38 + system/vendor/twig/twig/src/Compiler.php | 214 + system/vendor/twig/twig/src/Environment.php | 832 ++++ system/vendor/twig/twig/src/Error/Error.php | 227 ++ .../twig/twig/src/Error/LoaderError.php | 21 + .../twig/twig/src/Error/RuntimeError.php | 22 + .../twig/twig/src/Error/SyntaxError.php | 46 + .../vendor/twig/twig/src/ExpressionParser.php | 825 ++++ .../twig/src/Extension/AbstractExtension.php | 45 + .../twig/twig/src/Extension/CoreExtension.php | 1695 ++++++++ .../twig/src/Extension/DebugExtension.php | 64 + .../twig/src/Extension/EscaperExtension.php | 416 ++ .../twig/src/Extension/ExtensionInterface.php | 68 + .../twig/src/Extension/GlobalsInterface.php | 25 + .../twig/src/Extension/OptimizerExtension.php | 29 + .../twig/src/Extension/ProfilerExtension.php | 52 + .../Extension/RuntimeExtensionInterface.php | 19 + .../twig/src/Extension/SandboxExtension.php | 123 + .../twig/src/Extension/StagingExtension.php | 100 + .../src/Extension/StringLoaderExtension.php | 42 + system/vendor/twig/twig/src/ExtensionSet.php | 463 +++ .../src/FileExtensionEscapingStrategy.php | 60 + system/vendor/twig/twig/src/Lexer.php | 501 +++ .../twig/twig/src/Loader/ArrayLoader.php | 77 + .../twig/twig/src/Loader/ChainLoader.php | 119 + .../twig/twig/src/Loader/FilesystemLoader.php | 283 ++ .../twig/twig/src/Loader/LoaderInterface.php | 49 + system/vendor/twig/twig/src/Markup.php | 52 + .../twig/twig/src/Node/AutoEscapeNode.php | 38 + .../vendor/twig/twig/src/Node/BlockNode.php | 44 + .../twig/twig/src/Node/BlockReferenceNode.php | 36 + system/vendor/twig/twig/src/Node/BodyNode.php | 21 + .../twig/src/Node/CheckSecurityCallNode.php | 28 + .../twig/twig/src/Node/CheckSecurityNode.php | 88 + .../twig/twig/src/Node/CheckToStringNode.php | 45 + .../twig/twig/src/Node/DeprecatedNode.php | 53 + system/vendor/twig/twig/src/Node/DoNode.php | 38 + .../vendor/twig/twig/src/Node/EmbedNode.php | 48 + .../Node/Expression/AbstractExpression.php | 24 + .../src/Node/Expression/ArrayExpression.php | 85 + .../Expression/ArrowFunctionExpression.php | 64 + .../Node/Expression/AssignNameExpression.php | 27 + .../Node/Expression/Binary/AbstractBinary.php | 42 + .../src/Node/Expression/Binary/AddBinary.php | 23 + .../src/Node/Expression/Binary/AndBinary.php | 23 + .../Expression/Binary/BitwiseAndBinary.php | 23 + .../Expression/Binary/BitwiseOrBinary.php | 23 + .../Expression/Binary/BitwiseXorBinary.php | 23 + .../Node/Expression/Binary/ConcatBinary.php | 23 + .../src/Node/Expression/Binary/DivBinary.php | 23 + .../Node/Expression/Binary/EndsWithBinary.php | 35 + .../Node/Expression/Binary/EqualBinary.php | 39 + .../Node/Expression/Binary/FloorDivBinary.php | 29 + .../Node/Expression/Binary/GreaterBinary.php | 39 + .../Expression/Binary/GreaterEqualBinary.php | 39 + .../src/Node/Expression/Binary/InBinary.php | 33 + .../src/Node/Expression/Binary/LessBinary.php | 39 + .../Expression/Binary/LessEqualBinary.php | 39 + .../Node/Expression/Binary/MatchesBinary.php | 33 + .../src/Node/Expression/Binary/ModBinary.php | 23 + .../src/Node/Expression/Binary/MulBinary.php | 23 + .../Node/Expression/Binary/NotEqualBinary.php | 39 + .../Node/Expression/Binary/NotInBinary.php | 33 + .../src/Node/Expression/Binary/OrBinary.php | 23 + .../Node/Expression/Binary/PowerBinary.php | 22 + .../Node/Expression/Binary/RangeBinary.php | 33 + .../Expression/Binary/SpaceshipBinary.php | 22 + .../Expression/Binary/StartsWithBinary.php | 35 + .../src/Node/Expression/Binary/SubBinary.php | 23 + .../Expression/BlockReferenceExpression.php | 86 + .../src/Node/Expression/CallExpression.php | 320 ++ .../Node/Expression/ConditionalExpression.php | 36 + .../Node/Expression/ConstantExpression.php | 28 + .../Node/Expression/Filter/DefaultFilter.php | 52 + .../src/Node/Expression/FilterExpression.php | 40 + .../Node/Expression/FunctionExpression.php | 43 + .../src/Node/Expression/GetAttrExpression.php | 87 + .../twig/src/Node/Expression/InlinePrint.php | 35 + .../Node/Expression/MethodCallExpression.php | 62 + .../src/Node/Expression/NameExpression.php | 97 + .../Expression/NullCoalesceExpression.php | 60 + .../src/Node/Expression/ParentExpression.php | 46 + .../Node/Expression/TempNameExpression.php | 31 + .../src/Node/Expression/Test/ConstantTest.php | 49 + .../src/Node/Expression/Test/DefinedTest.php | 74 + .../Node/Expression/Test/DivisiblebyTest.php | 36 + .../src/Node/Expression/Test/EvenTest.php | 35 + .../src/Node/Expression/Test/NullTest.php | 34 + .../twig/src/Node/Expression/Test/OddTest.php | 35 + .../src/Node/Expression/Test/SameasTest.php | 34 + .../src/Node/Expression/TestExpression.php | 42 + .../Node/Expression/Unary/AbstractUnary.php | 34 + .../src/Node/Expression/Unary/NegUnary.php | 23 + .../src/Node/Expression/Unary/NotUnary.php | 23 + .../src/Node/Expression/Unary/PosUnary.php | 23 + .../Node/Expression/VariadicExpression.php | 24 + .../vendor/twig/twig/src/Node/FlushNode.php | 35 + .../vendor/twig/twig/src/Node/ForLoopNode.php | 49 + system/vendor/twig/twig/src/Node/ForNode.php | 107 + system/vendor/twig/twig/src/Node/IfNode.php | 70 + .../vendor/twig/twig/src/Node/ImportNode.php | 63 + .../vendor/twig/twig/src/Node/IncludeNode.php | 106 + .../vendor/twig/twig/src/Node/MacroNode.php | 113 + .../vendor/twig/twig/src/Node/ModuleNode.php | 464 +++ system/vendor/twig/twig/src/Node/Node.php | 179 + .../twig/src/Node/NodeCaptureInterface.php | 21 + .../twig/src/Node/NodeOutputInterface.php | 21 + .../vendor/twig/twig/src/Node/PrintNode.php | 39 + .../vendor/twig/twig/src/Node/SandboxNode.php | 52 + system/vendor/twig/twig/src/Node/SetNode.php | 105 + system/vendor/twig/twig/src/Node/TextNode.php | 38 + system/vendor/twig/twig/src/Node/WithNode.php | 70 + system/vendor/twig/twig/src/NodeTraverser.php | 76 + .../src/NodeVisitor/AbstractNodeVisitor.php | 49 + .../src/NodeVisitor/EscaperNodeVisitor.php | 208 + .../MacroAutoImportNodeVisitor.php | 74 + .../src/NodeVisitor/NodeVisitorInterface.php | 46 + .../src/NodeVisitor/OptimizerNodeVisitor.php | 217 + .../NodeVisitor/SafeAnalysisNodeVisitor.php | 160 + .../src/NodeVisitor/SandboxNodeVisitor.php | 136 + system/vendor/twig/twig/src/Parser.php | 348 ++ .../twig/src/Profiler/Dumper/BaseDumper.php | 63 + .../src/Profiler/Dumper/BlackfireDumper.php | 72 + .../twig/src/Profiler/Dumper/HtmlDumper.php | 47 + .../twig/src/Profiler/Dumper/TextDumper.php | 35 + .../src/Profiler/Node/EnterProfileNode.php | 42 + .../src/Profiler/Node/LeaveProfileNode.php | 36 + .../NodeVisitor/ProfilerNodeVisitor.php | 70 + .../vendor/twig/twig/src/Profiler/Profile.php | 181 + .../RuntimeLoader/ContainerRuntimeLoader.php | 37 + .../RuntimeLoader/FactoryRuntimeLoader.php | 41 + .../RuntimeLoader/RuntimeLoaderInterface.php | 27 + .../twig/twig/src/Sandbox/SecurityError.php | 23 + .../Sandbox/SecurityNotAllowedFilterError.php | 33 + .../SecurityNotAllowedFunctionError.php | 33 + .../Sandbox/SecurityNotAllowedMethodError.php | 40 + .../SecurityNotAllowedPropertyError.php | 40 + .../Sandbox/SecurityNotAllowedTagError.php | 33 + .../twig/twig/src/Sandbox/SecurityPolicy.php | 126 + .../src/Sandbox/SecurityPolicyInterface.php | 45 + system/vendor/twig/twig/src/Source.php | 51 + system/vendor/twig/twig/src/Template.php | 422 ++ .../vendor/twig/twig/src/TemplateWrapper.php | 109 + .../twig/src/Test/IntegrationTestCase.php | 265 ++ .../twig/twig/src/Test/NodeTestCase.php | 65 + system/vendor/twig/twig/src/Token.php | 178 + .../src/TokenParser/AbstractTokenParser.php | 32 + .../twig/src/TokenParser/ApplyTokenParser.php | 60 + .../src/TokenParser/AutoEscapeTokenParser.php | 58 + .../twig/src/TokenParser/BlockTokenParser.php | 78 + .../src/TokenParser/DeprecatedTokenParser.php | 43 + .../twig/src/TokenParser/DoTokenParser.php | 38 + .../twig/src/TokenParser/EmbedTokenParser.php | 73 + .../src/TokenParser/ExtendsTokenParser.php | 52 + .../twig/src/TokenParser/FlushTokenParser.php | 38 + .../twig/src/TokenParser/ForTokenParser.php | 78 + .../twig/src/TokenParser/FromTokenParser.php | 66 + .../twig/src/TokenParser/IfTokenParser.php | 89 + .../src/TokenParser/ImportTokenParser.php | 44 + .../src/TokenParser/IncludeTokenParser.php | 69 + .../twig/src/TokenParser/MacroTokenParser.php | 66 + .../src/TokenParser/SandboxTokenParser.php | 66 + .../twig/src/TokenParser/SetTokenParser.php | 73 + .../src/TokenParser/TokenParserInterface.php | 46 + .../twig/src/TokenParser/UseTokenParser.php | 73 + .../twig/src/TokenParser/WithTokenParser.php | 56 + system/vendor/twig/twig/src/TokenStream.php | 132 + system/vendor/twig/twig/src/TwigFilter.php | 134 + system/vendor/twig/twig/src/TwigFunction.php | 122 + system/vendor/twig/twig/src/TwigTest.php | 100 + .../twig/src/Util/DeprecationCollector.php | 77 + .../twig/src/Util/TemplateDirIterator.php | 36 + 505 files changed, 73094 insertions(+), 1678 deletions(-) create mode 100644 composer.lock create mode 100644 system/engine/render.php create mode 100644 system/vendor/autoload.php create mode 100644 system/vendor/colinmollenhour/credis/Client.php create mode 100644 system/vendor/colinmollenhour/credis/Cluster.php create mode 100644 system/vendor/colinmollenhour/credis/LICENSE create mode 100644 system/vendor/colinmollenhour/credis/Module.php create mode 100644 system/vendor/colinmollenhour/credis/README.markdown create mode 100644 system/vendor/colinmollenhour/credis/Sentinel.php create mode 100644 system/vendor/colinmollenhour/credis/composer.json create mode 100644 system/vendor/colinmollenhour/credis/phpunit_local.sh create mode 100644 system/vendor/colinmollenhour/credis/testenv/docker-compose.yml create mode 100644 system/vendor/colinmollenhour/credis/testenv/env/php-5.6/Dockerfile create mode 100644 system/vendor/colinmollenhour/credis/testenv/env/php-7.0/Dockerfile create mode 100644 system/vendor/colinmollenhour/credis/testenv/env/php-7.1/Dockerfile create mode 100644 system/vendor/colinmollenhour/credis/testenv/env/php-7.2/Dockerfile create mode 100644 system/vendor/colinmollenhour/credis/testenv/env/php-7.3/Dockerfile create mode 100644 system/vendor/colinmollenhour/credis/testenv/env/php-7.4/Dockerfile create mode 100644 system/vendor/composer/ClassLoader.php create mode 100644 system/vendor/composer/LICENSE create mode 100644 system/vendor/composer/autoload_classmap.php create mode 100644 system/vendor/composer/autoload_files.php create mode 100644 system/vendor/composer/autoload_namespaces.php create mode 100644 system/vendor/composer/autoload_psr4.php create mode 100644 system/vendor/composer/autoload_real.php create mode 100644 system/vendor/composer/autoload_static.php create mode 100644 system/vendor/composer/installed.json create mode 100644 system/vendor/mustache/mustache/.gitattributes create mode 100644 system/vendor/mustache/mustache/LICENSE create mode 100644 system/vendor/mustache/mustache/README.md create mode 100644 system/vendor/mustache/mustache/composer.json create mode 100644 system/vendor/mustache/mustache/src/Mustache/Autoloader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Cache.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Cache/AbstractCache.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Compiler.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Context.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Engine.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception/LogicException.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception/RuntimeException.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception/SyntaxException.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/HelperCollection.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/LambdaHelper.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader/ArrayLoader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader/ProductionFilesystemLoader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Logger.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Logger/AbstractLogger.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Parser.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Source.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Source/FilesystemSource.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Template.php create mode 100644 system/vendor/mustache/mustache/src/Mustache/Tokenizer.php create mode 100644 system/vendor/smarty/smarty/CHANGELOG.md create mode 100644 system/vendor/smarty/smarty/COMPOSER_RELEASE_NOTES.txt create mode 100644 system/vendor/smarty/smarty/INHERITANCE_RELEASE_NOTES.txt create mode 100644 system/vendor/smarty/smarty/LICENSE create mode 100644 system/vendor/smarty/smarty/NEW_FEATURES.txt create mode 100644 system/vendor/smarty/smarty/README create mode 100644 system/vendor/smarty/smarty/README.md create mode 100644 system/vendor/smarty/smarty/SECURITY.md create mode 100644 system/vendor/smarty/smarty/SMARTY_2_BC_NOTES.txt create mode 100644 system/vendor/smarty/smarty/SMARTY_3.0_BC_NOTES.txt create mode 100644 system/vendor/smarty/smarty/SMARTY_3.1_NOTES.txt create mode 100644 system/vendor/smarty/smarty/composer.json create mode 100644 system/vendor/smarty/smarty/demo/configs/test.conf create mode 100644 system/vendor/smarty/smarty/demo/index.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/cacheresource.apc.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/cacheresource.mysql.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/cacheresource.pdo_gzip.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/resource.extendsall.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/resource.mysql.php create mode 100644 system/vendor/smarty/smarty/demo/plugins/resource.mysqls.php create mode 100644 system/vendor/smarty/smarty/demo/templates/footer.tpl create mode 100644 system/vendor/smarty/smarty/demo/templates/header.tpl create mode 100644 system/vendor/smarty/smarty/demo/templates/index.tpl create mode 100644 system/vendor/smarty/smarty/lexer/smarty_internal_configfilelexer.plex create mode 100644 system/vendor/smarty/smarty/lexer/smarty_internal_configfileparser.y create mode 100644 system/vendor/smarty/smarty/lexer/smarty_internal_templatelexer.plex create mode 100644 system/vendor/smarty/smarty/lexer/smarty_internal_templateparser.y create mode 100644 system/vendor/smarty/smarty/libs/Autoloader.php create mode 100644 system/vendor/smarty/smarty/libs/Smarty.class.php create mode 100644 system/vendor/smarty/smarty/libs/SmartyBC.class.php create mode 100644 system/vendor/smarty/smarty/libs/bootstrap.php create mode 100644 system/vendor/smarty/smarty/libs/debug.tpl create mode 100644 system/vendor/smarty/smarty/libs/plugins/block.textformat.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.counter.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.cycle.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.fetch.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.html_image.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.html_options.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.html_radios.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.html_select_date.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.html_select_time.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.html_table.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.mailto.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/function.math.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.date_format.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.escape.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.replace.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.spacify.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifier.truncate.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/shared.literal_compiler_param.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php create mode 100644 system/vendor/smarty/smarty/libs/plugins/variablefilter.htmlspecialchars.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_data.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_registered.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_security.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_template_config.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smarty_variable.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smartycompilerexception.php create mode 100644 system/vendor/smarty/smarty/libs/sysplugins/smartyexception.php create mode 100644 system/vendor/symfony/polyfill-ctype/Ctype.php create mode 100644 system/vendor/symfony/polyfill-ctype/LICENSE create mode 100644 system/vendor/symfony/polyfill-ctype/README.md create mode 100644 system/vendor/symfony/polyfill-ctype/bootstrap.php create mode 100644 system/vendor/symfony/polyfill-ctype/bootstrap80.php create mode 100644 system/vendor/symfony/polyfill-ctype/composer.json create mode 100644 system/vendor/symfony/polyfill-mbstring/LICENSE create mode 100644 system/vendor/symfony/polyfill-mbstring/Mbstring.php create mode 100644 system/vendor/symfony/polyfill-mbstring/README.md create mode 100644 system/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php create mode 100644 system/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php create mode 100644 system/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php create mode 100644 system/vendor/symfony/polyfill-mbstring/bootstrap.php create mode 100644 system/vendor/symfony/polyfill-mbstring/bootstrap80.php create mode 100644 system/vendor/symfony/polyfill-mbstring/composer.json create mode 100644 system/vendor/twig/twig/.editorconfig create mode 100644 system/vendor/twig/twig/.gitattributes create mode 100644 system/vendor/twig/twig/.github/workflows/ci.yml create mode 100644 system/vendor/twig/twig/.github/workflows/documentation.yml create mode 100644 system/vendor/twig/twig/.gitignore create mode 100644 system/vendor/twig/twig/.php-cs-fixer.dist.php create mode 100644 system/vendor/twig/twig/CHANGELOG create mode 100644 system/vendor/twig/twig/LICENSE create mode 100644 system/vendor/twig/twig/README.rst create mode 100644 system/vendor/twig/twig/composer.json create mode 100644 system/vendor/twig/twig/src/Cache/CacheInterface.php create mode 100644 system/vendor/twig/twig/src/Cache/FilesystemCache.php create mode 100644 system/vendor/twig/twig/src/Cache/NullCache.php create mode 100644 system/vendor/twig/twig/src/Compiler.php create mode 100644 system/vendor/twig/twig/src/Environment.php create mode 100644 system/vendor/twig/twig/src/Error/Error.php create mode 100644 system/vendor/twig/twig/src/Error/LoaderError.php create mode 100644 system/vendor/twig/twig/src/Error/RuntimeError.php create mode 100644 system/vendor/twig/twig/src/Error/SyntaxError.php create mode 100644 system/vendor/twig/twig/src/ExpressionParser.php create mode 100644 system/vendor/twig/twig/src/Extension/AbstractExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/CoreExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/DebugExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/EscaperExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/ExtensionInterface.php create mode 100644 system/vendor/twig/twig/src/Extension/GlobalsInterface.php create mode 100644 system/vendor/twig/twig/src/Extension/OptimizerExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/ProfilerExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php create mode 100644 system/vendor/twig/twig/src/Extension/SandboxExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/StagingExtension.php create mode 100644 system/vendor/twig/twig/src/Extension/StringLoaderExtension.php create mode 100644 system/vendor/twig/twig/src/ExtensionSet.php create mode 100644 system/vendor/twig/twig/src/FileExtensionEscapingStrategy.php create mode 100644 system/vendor/twig/twig/src/Lexer.php create mode 100644 system/vendor/twig/twig/src/Loader/ArrayLoader.php create mode 100644 system/vendor/twig/twig/src/Loader/ChainLoader.php create mode 100644 system/vendor/twig/twig/src/Loader/FilesystemLoader.php create mode 100644 system/vendor/twig/twig/src/Loader/LoaderInterface.php create mode 100644 system/vendor/twig/twig/src/Markup.php create mode 100644 system/vendor/twig/twig/src/Node/AutoEscapeNode.php create mode 100644 system/vendor/twig/twig/src/Node/BlockNode.php create mode 100644 system/vendor/twig/twig/src/Node/BlockReferenceNode.php create mode 100644 system/vendor/twig/twig/src/Node/BodyNode.php create mode 100644 system/vendor/twig/twig/src/Node/CheckSecurityCallNode.php create mode 100644 system/vendor/twig/twig/src/Node/CheckSecurityNode.php create mode 100644 system/vendor/twig/twig/src/Node/CheckToStringNode.php create mode 100644 system/vendor/twig/twig/src/Node/DeprecatedNode.php create mode 100644 system/vendor/twig/twig/src/Node/DoNode.php create mode 100644 system/vendor/twig/twig/src/Node/EmbedNode.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/AbstractExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/ArrayExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/CallExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/ConstantExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/FilterExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/FunctionExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/InlinePrint.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/NameExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/ParentExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/TempNameExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Test/NullTest.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Test/OddTest.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/TestExpression.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php create mode 100644 system/vendor/twig/twig/src/Node/Expression/VariadicExpression.php create mode 100644 system/vendor/twig/twig/src/Node/FlushNode.php create mode 100644 system/vendor/twig/twig/src/Node/ForLoopNode.php create mode 100644 system/vendor/twig/twig/src/Node/ForNode.php create mode 100644 system/vendor/twig/twig/src/Node/IfNode.php create mode 100644 system/vendor/twig/twig/src/Node/ImportNode.php create mode 100644 system/vendor/twig/twig/src/Node/IncludeNode.php create mode 100644 system/vendor/twig/twig/src/Node/MacroNode.php create mode 100644 system/vendor/twig/twig/src/Node/ModuleNode.php create mode 100644 system/vendor/twig/twig/src/Node/Node.php create mode 100644 system/vendor/twig/twig/src/Node/NodeCaptureInterface.php create mode 100644 system/vendor/twig/twig/src/Node/NodeOutputInterface.php create mode 100644 system/vendor/twig/twig/src/Node/PrintNode.php create mode 100644 system/vendor/twig/twig/src/Node/SandboxNode.php create mode 100644 system/vendor/twig/twig/src/Node/SetNode.php create mode 100644 system/vendor/twig/twig/src/Node/TextNode.php create mode 100644 system/vendor/twig/twig/src/Node/WithNode.php create mode 100644 system/vendor/twig/twig/src/NodeTraverser.php create mode 100644 system/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php create mode 100644 system/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php create mode 100644 system/vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php create mode 100644 system/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php create mode 100644 system/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php create mode 100644 system/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php create mode 100644 system/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php create mode 100644 system/vendor/twig/twig/src/Parser.php create mode 100644 system/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php create mode 100644 system/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php create mode 100644 system/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php create mode 100644 system/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php create mode 100644 system/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php create mode 100644 system/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php create mode 100644 system/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php create mode 100644 system/vendor/twig/twig/src/Profiler/Profile.php create mode 100644 system/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php create mode 100644 system/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php create mode 100644 system/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityError.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityPolicy.php create mode 100644 system/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php create mode 100644 system/vendor/twig/twig/src/Source.php create mode 100644 system/vendor/twig/twig/src/Template.php create mode 100644 system/vendor/twig/twig/src/TemplateWrapper.php create mode 100644 system/vendor/twig/twig/src/Test/IntegrationTestCase.php create mode 100644 system/vendor/twig/twig/src/Test/NodeTestCase.php create mode 100644 system/vendor/twig/twig/src/Token.php create mode 100644 system/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/BlockTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/DoTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/FlushTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/ForTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/FromTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/IfTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/ImportTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/MacroTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/SetTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/TokenParserInterface.php create mode 100644 system/vendor/twig/twig/src/TokenParser/UseTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenParser/WithTokenParser.php create mode 100644 system/vendor/twig/twig/src/TokenStream.php create mode 100644 system/vendor/twig/twig/src/TwigFilter.php create mode 100644 system/vendor/twig/twig/src/TwigFunction.php create mode 100644 system/vendor/twig/twig/src/TwigTest.php create mode 100644 system/vendor/twig/twig/src/Util/DeprecationCollector.php create mode 100644 system/vendor/twig/twig/src/Util/TemplateDirIterator.php diff --git a/composer.json b/composer.json index b99213d..0ac4420 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,10 @@ "vendor-dir": "./system/vendor/" }, "require": { - "php": ">=5.4.20" + "php": ">=5.4.20", + "colinmollenhour/credis": "^1.13", + "twig/twig": "^3.0", + "mustache/mustache": "^2.0", + "smarty/smarty": "^3.0" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..2230ad2 --- /dev/null +++ b/composer.lock @@ -0,0 +1,412 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "7f672103460572d4ac75a680dec2a9b5", + "packages": [ + { + "name": "colinmollenhour/credis", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/colinmollenhour/credis.git", + "reference": "afec8e58ec93d2291c127fa19709a048f28641e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/afec8e58ec93d2291c127fa19709a048f28641e5", + "reference": "afec8e58ec93d2291c127fa19709a048f28641e5", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "suggest": { + "ext-redis": "Improved performance for communicating with redis" + }, + "type": "library", + "autoload": { + "classmap": [ + "Client.php", + "Cluster.php", + "Sentinel.php", + "Module.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Colin Mollenhour", + "email": "colin@mollenhour.com" + } + ], + "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", + "homepage": "https://github.com/colinmollenhour/credis", + "support": { + "issues": "https://github.com/colinmollenhour/credis/issues", + "source": "https://github.com/colinmollenhour/credis/tree/v1.13.0" + }, + "time": "2022-04-07T14:57:22+00:00" + }, + { + "name": "mustache/mustache", + "version": "v2.14.1", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/mustache.php.git", + "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/579ffa5c96e1d292c060b3dd62811ff01ad8c24e", + "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~1.11", + "phpunit/phpunit": "~3.7|~4.0|~5.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Mustache": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "A Mustache implementation in PHP.", + "homepage": "https://github.com/bobthecow/mustache.php", + "keywords": [ + "mustache", + "templating" + ], + "time": "2022-01-21T06:08:36+00:00" + }, + { + "name": "smarty/smarty", + "version": "v3.1.44", + "source": { + "type": "git", + "url": "https://github.com/smarty-php/smarty.git", + "reference": "99085d8dc65eeb5e55ae3cba74d3dc6b3bb0205e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/99085d8dc65eeb5e55ae3cba74d3dc6b3bb0205e", + "reference": "99085d8dc65eeb5e55ae3cba74d3dc6b3bb0205e", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^6.5 || ^5.7 || ^4.8", + "smarty/smarty-lexer": "^3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "libs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Monte Ohrt", + "email": "monte@ohrt.com" + }, + { + "name": "Uwe Tews", + "email": "uwe.tews@googlemail.com" + }, + { + "name": "Rodney Rehm", + "email": "rodney.rehm@medialize.de" + } + ], + "description": "Smarty - the compiling PHP template engine", + "homepage": "http://www.smarty.net", + "keywords": [ + "templating" + ], + "time": "2022-01-17T23:12:04+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-10-20T20:35:02+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-30T18:21:41+00:00" + }, + { + "name": "twig/twig", + "version": "v3.3.10", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "8442df056c51b706793adf80a9fd363406dd3674" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/8442df056c51b706793adf80a9fd363406dd3674", + "reference": "8442df056c51b706793adf80a9fd363406dd3674", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.3.10" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2022-04-06T06:47:41+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4.20" + }, + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/system/credis/autoload.php b/system/credis/autoload.php index 52c80b6..5f15cf3 100644 --- a/system/credis/autoload.php +++ b/system/credis/autoload.php @@ -13,1519 +13,5 @@ namespace Phacil\Framework; //class_alias('\\Phacil\\Framework\\Credis_Client', '\\Phacil\\Framework\\Credis'); /** @package Phacil\Framework */ -class Credis extends Credis_Client +class Credis extends \Credis_Client {} - -/** - * Credis_Client (a fork of Redisent) - * - * Most commands are compatible with phpredis library: - * - use "pipeline()" to start a pipeline of commands instead of multi(Redis::PIPELINE) - * - any arrays passed as arguments will be flattened automatically - * - setOption and getOption are not supported in standalone mode - * - order of arguments follows redis-cli instead of phpredis where they differ (lrem) - * - * - Uses phpredis library if extension is installed for better performance. - * - Establishes connection lazily. - * - Supports tcp and unix sockets. - * - Reconnects automatically unless a watch or transaction is in progress. - * - Can set automatic retry connection attempts for iffy Redis connections. - * - * @author Colin Mollenhour - * @copyright 2011 Colin Mollenhour - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - * @package Credis_Client - */ - -if( ! defined('CRLF')) define('CRLF', sprintf('%s%s', chr(13), chr(10))); - -/** - * Credis-specific errors, wraps native Redis errors - */ -class CredisException extends Exception -{ - - const CODE_TIMED_OUT = 1; - const CODE_DISCONNECTED = 2; - - public function __construct($message, $code = 0, $exception = NULL) - { - if ($exception && get_class($exception) == 'RedisException' && strpos($message,'read error on connection') === 0) { - $code = CredisException::CODE_DISCONNECTED; - } - parent::__construct($message, $code, $exception); - } - -} - -/** - * Credis_Client, a lightweight Redis PHP standalone client and phpredis wrapper - * - * Server/Connection: - * @method Credis_Client pipeline() - * @method Credis_Client multi() - * @method Credis_Client watch(string ...$keys) - * @method Credis_Client unwatch() - * @method array exec() - * @method string|Credis_Client flushAll() - * @method string|Credis_Client flushDb() - * @method array|Credis_Client info(string $section = null) - * @method bool|array|Credis_Client config(string $setGet, string $key, string $value = null) - * @method array|Credis_Client role() - * @method array|Credis_Client time() - * @method int|Credis_Client dbsize() - * - * Keys: - * @method int|Credis_Client del(string $key) - * @method int|Credis_Client exists(string $key) - * @method int|Credis_Client expire(string $key, int $seconds) - * @method int|Credis_Client expireAt(string $key, int $timestamp) - * @method array|Credis_Client keys(string $key) - * @method int|Credis_Client persist(string $key) - * @method bool|Credis_Client rename(string $key, string $newKey) - * @method bool|Credis_Client renameNx(string $key, string $newKey) - * @method array|Credis_Client sort(string $key, string $arg1, string $valueN = null) - * @method int|Credis_Client ttl(string $key) - * @method string|Credis_Client type(string $key) - * - * Scalars: - * @method int|Credis_Client append(string $key, string $value) - * @method int|Credis_Client decr(string $key) - * @method int|Credis_Client decrBy(string $key, int $decrement) - * @method bool|string|Credis_Client get(string $key) - * @method int|Credis_Client getBit(string $key, int $offset) - * @method string|Credis_Client getRange(string $key, int $start, int $end) - * @method string|Credis_Client getSet(string $key, string $value) - * @method int|Credis_Client incr(string $key) - * @method int|Credis_Client incrBy(string $key, int $decrement) - * @method array|Credis_Client mGet(array $keys) - * @method bool|Credis_Client mSet(array $keysValues) - * @method int|Credis_Client mSetNx(array $keysValues) - * @method bool|Credis_Client set(string $key, string $value, int | array $options = null) - * @method int|Credis_Client setBit(string $key, int $offset, int $value) - * @method bool|Credis_Client setEx(string $key, int $seconds, string $value) - * @method int|Credis_Client setNx(string $key, string $value) - * @method int |Credis_Client setRange(string $key, int $offset, int $value) - * @method int|Credis_Client strLen(string $key) - * - * Sets: - * @method int|Credis_Client sAdd(string $key, mixed $value, string $valueN = null) - * @method int|Credis_Client sRem(string $key, mixed $value, string $valueN = null) - * @method array|Credis_Client sMembers(string $key) - * @method array|Credis_Client sUnion(mixed $keyOrArray, string $valueN = null) - * @method array|Credis_Client sInter(mixed $keyOrArray, string $valueN = null) - * @method array |Credis_Client sDiff(mixed $keyOrArray, string $valueN = null) - * @method string|Credis_Client sPop(string $key) - * @method int|Credis_Client sCard(string $key) - * @method int|Credis_Client sIsMember(string $key, string $member) - * @method int|Credis_Client sMove(string $source, string $dest, string $member) - * @method string|array|Credis_Client sRandMember(string $key, int $count = null) - * @method int|Credis_Client sUnionStore(string $dest, string $key1, string $key2 = null) - * @method int|Credis_Client sInterStore(string $dest, string $key1, string $key2 = null) - * @method int|Credis_Client sDiffStore(string $dest, string $key1, string $key2 = null) - * - * Hashes: - * @method bool|int|Credis_Client hSet(string $key, string $field, string $value) - * @method bool|Credis_Client hSetNx(string $key, string $field, string $value) - * @method bool|string|Credis_Client hGet(string $key, string $field) - * @method bool|int|Credis_Client hLen(string $key) - * @method bool|Credis_Client hDel(string $key, string $field) - * @method array|Credis_Client hKeys(string $key, string $field) - * @method array|Credis_Client hVals(string $key) - * @method array|Credis_Client hGetAll(string $key) - * @method bool|Credis_Client hExists(string $key, string $field) - * @method int|Credis_Client hIncrBy(string $key, string $field, int $value) - * @method float|Credis_Client hIncrByFloat(string $key, string $member, float $value) - * @method bool|Credis_Client hMSet(string $key, array $keysValues) - * @method array|Credis_Client hMGet(string $key, array $fields) - * - * Lists: - * @method array|null|Credis_Client blPop(string $keyN, int $timeout) - * @method array|null|Credis_Client brPop(string $keyN, int $timeout) - * @method array|null |Credis_Client brPoplPush(string $source, string $destination, int $timeout) - * @method string|null|Credis_Client lIndex(string $key, int $index) - * @method int|Credis_Client lInsert(string $key, string $beforeAfter, string $pivot, string $value) - * @method int|Credis_Client lLen(string $key) - * @method string|null|Credis_Client lPop(string $key) - * @method int|Credis_Client lPush(string $key, mixed $value, mixed $valueN = null) - * @method int|Credis_Client lPushX(string $key, mixed $value) - * @method array|Credis_Client lRange(string $key, int $start, int $stop) - * @method int|Credis_Client lRem(string $key, int $count, mixed $value) - * @method bool|Credis_Client lSet(string $key, int $index, mixed $value) - * @method bool|Credis_Client lTrim(string $key, int $start, int $stop) - * @method string|null|Credis_Client rPop(string $key) - * @method string|null|Credis_Client rPoplPush(string $source, string $destination) - * @method int|Credis_Client rPush(string $key, mixed $value, mixed $valueN = null) - * @method int |Credis_Client rPushX(string $key, mixed $value) - * - * Sorted Sets: - * @method int|Credis_Client zAdd(string $key, double $score, string $value) - * @method int|Credis_Client zCard(string $key) - * @method int|Credis_Client zSize(string $key) - * @method int|Credis_Client zCount(string $key, mixed $start, mixed $stop) - * @method int|Credis_Client zIncrBy(string $key, double $value, string $member) - * @method array|Credis_Client zRangeByScore(string $key, mixed $start, mixed $stop, array $args = null) - * @method array|Credis_Client zRevRangeByScore(string $key, mixed $start, mixed $stop, array $args = null) - * @method int|Credis_Client zRemRangeByScore(string $key, mixed $start, mixed $stop) - * @method array|Credis_Client zRange(string $key, mixed $start, mixed $stop, array $args = null) - * @method array|Credis_Client zRevRange(string $key, mixed $start, mixed $stop, array $args = null) - * @method int|Credis_Client zRank(string $key, string $member) - * @method int|Credis_Client zRevRank(string $key, string $member) - * @method int|Credis_Client zRem(string $key, string $member) - * @method int|Credis_Client zDelete(string $key, string $member) - * TODO - * - * Pub/Sub - * @method int |Credis_Client publish(string $channel, string $message) - * @method int|array|Credis_Client pubsub(string $subCommand, $arg = null) - * - * Scripting: - * @method string|int|Credis_Client script(string $command, string $arg1 = null) - * @method string|int|array|bool|Credis_Client eval(string $script, array $keys = null, array $args = null) - * @method string|int|array|bool|Credis_Client evalSha(string $script, array $keys = null, array $args = null) - */ -class Credis_Client { - - const VERSION = '1.11.4'; - - const TYPE_STRING = 'string'; - const TYPE_LIST = 'list'; - const TYPE_SET = 'set'; - const TYPE_ZSET = 'zset'; - const TYPE_HASH = 'hash'; - const TYPE_NONE = 'none'; - - const FREAD_BLOCK_SIZE = 8192; - - /** - * Socket connection to the Redis server or Redis library instance - * @var resource|\Redis - */ - protected $redis; - protected $redisMulti; - - /** - * Host of the Redis server - * @var string - */ - protected $host; - - /** - * Scheme of the Redis server (tcp, tls, unix) - * @var string - */ - protected $scheme; - - /** - * Port on which the Redis server is running - * @var integer - */ - protected $port; - - /** - * Timeout for connecting to Redis server - * @var float - */ - protected $timeout; - - /** - * Timeout for reading response from Redis server - * @var float - */ - protected $readTimeout; - - /** - * Unique identifier for persistent connections - * @var string - */ - protected $persistent; - - /** - * @var bool - */ - protected $closeOnDestruct = TRUE; - - /** - * @var bool - */ - protected $connected = FALSE; - - /** - * @var bool - */ - protected $standalone; - - /** - * @var int - */ - protected $maxConnectRetries = 0; - - /** - * @var int - */ - protected $connectFailures = 0; - - /** - * @var bool - */ - protected $usePipeline = FALSE; - - /** - * @var array - */ - protected $commandNames; - - /** - * @var string - */ - protected $commands; - - /** - * @var bool - */ - protected $isMulti = FALSE; - - /** - * @var bool - */ - protected $isWatching = FALSE; - - /** - * @var string - */ - protected $authPassword; - - /** - * @var int - */ - protected $selectedDb = 0; - - /** - * Aliases for backwards compatibility with phpredis - * @var array - */ - protected $wrapperMethods = array('delete' => 'del', 'getkeys' => 'keys', 'sremove' => 'srem'); - - /** - * @var array - */ - protected $renamedCommands; - - /** - * @var int - */ - protected $requests = 0; - - /** - * @var bool - */ - protected $subscribed = false; - - - /** - * Creates a Redisent connection to the Redis server on host {@link $host} and port {@link $port}. - * $host may also be a path to a unix socket or a string in the form of tcp://[hostname]:[port] or unix://[path] - * - * @param string $host The hostname of the Redis server - * @param integer $port The port number of the Redis server - * @param string $password The authentication password of the Redis server - * @param float $timeout Timeout period in seconds - * @param string $persistent Flag to establish persistent connection - * @param int $db The selected datbase of the Redis server - */ - public function __construct($host = '127.0.0.1', $port = 6379, $password = null, $timeout = null, $persistent = '', $db = 0) - { - $this->host = (string) $host; - $this->port = (int) $port; - $this->scheme = null; - $this->timeout = $timeout; - $this->persistent = (string) $persistent; - $this->standalone = ! extension_loaded('redis'); - $this->authPassword = $password; - $this->selectedDb = (int)$db; - $this->convertHost(); - // PHP Redis extension support TLS since 5.3.0 - if ($this->scheme == 'tls' && !$this->standalone && version_compare(phpversion('redis'),'5.3.0','<')){ - $this->standalone = true; - } - } - - public function __destruct() - { - if ($this->closeOnDestruct) { - $this->close(); - } - } - - /** - * @return bool - */ - public function isSubscribed() - { - return $this->subscribed; - } - - /** - * Return the host of the Redis instance - * @return string - */ - public function getHost() - { - return $this->host; - } - /** - * Return the port of the Redis instance - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * Return the selected database - * @return int - */ - public function getSelectedDb() - { - return $this->selectedDb; - } - /** - * @return string - */ - public function getPersistence() - { - return $this->persistent; - } - /** - * @throws CredisException - * @return Credis_Client - */ - public function forceStandalone() - { - if ($this->standalone) { - return $this; - } - if($this->connected) { - throw new CredisException('Cannot force Credis_Client to use standalone PHP driver after a connection has already been established.'); - } - $this->standalone = TRUE; - return $this; - } - - /** - * @param int $retries - * @return Credis_Client - */ - public function setMaxConnectRetries($retries) - { - $this->maxConnectRetries = $retries; - return $this; - } - - /** - * @param bool $flag - * @return Credis_Client - */ - public function setCloseOnDestruct($flag) - { - $this->closeOnDestruct = $flag; - return $this; - } - protected function convertHost() - { - if (preg_match('#^(tcp|tls|unix)://(.*)$#', $this->host, $matches)) { - if($matches[1] == 'tcp' || $matches[1] == 'tls') { - $this->scheme = $matches[1]; - if ( ! preg_match('#^([^:]+)(:([0-9]+))?(/(.+))?$#', $matches[2], $matches)) { - throw new CredisException('Invalid host format; expected '.$this->scheme.'://host[:port][/persistence_identifier]'); - } - $this->host = $matches[1]; - $this->port = (int) (isset($matches[3]) ? $matches[3] : $this->port); - $this->persistent = isset($matches[5]) ? $matches[5] : $this->persistent; - } else { - $this->host = $matches[2]; - $this->port = NULL; - $this->scheme = 'unix'; - if (substr($this->host,0,1) != '/') { - throw new CredisException('Invalid unix socket format; expected unix:///path/to/redis.sock'); - } - } - } - if ($this->port !== NULL && substr($this->host,0,1) == '/') { - $this->port = NULL; - $this->scheme = 'unix'; - } - if (!$this->scheme) { - $this->scheme = 'tcp'; - } - } - /** - * @throws CredisException - * @return Credis_Client - */ - public function connect() - { - if ($this->connected) { - return $this; - } - $this->close(true); - - if ($this->standalone) { - $flags = STREAM_CLIENT_CONNECT; - $remote_socket = $this->port === NULL - ? $this->scheme.'://'.$this->host - : $this->scheme.'://'.$this->host.':'.$this->port; - if ($this->persistent && $this->port !== NULL) { - // Persistent connections to UNIX sockets are not supported - $remote_socket .= '/'.$this->persistent; - $flags = $flags | STREAM_CLIENT_PERSISTENT; - } - $result = $this->redis = @stream_socket_client($remote_socket, $errno, $errstr, $this->timeout !== null ? $this->timeout : 2.5, $flags); - } - else { - if ( ! $this->redis) { - $this->redis = new \Redis; - } - $socketTimeout = $this->timeout ? $this->timeout : 0.0; - try - { - $result = $this->persistent - ? $this->redis->pconnect($this->host, $this->port, $socketTimeout, $this->persistent) - : $this->redis->connect($this->host, $this->port, $socketTimeout); - } - catch(Exception $e) - { - // Some applications will capture the php error that phpredis can sometimes generate and throw it as an Exception - $result = false; - $errno = 1; - $errstr = $e->getMessage(); - } - } - - // Use recursion for connection retries - if ( ! $result) { - $this->connectFailures++; - if ($this->connectFailures <= $this->maxConnectRetries) { - return $this->connect(); - } - $failures = $this->connectFailures; - $this->connectFailures = 0; - throw new CredisException("Connection to Redis {$this->host}:{$this->port} failed after $failures failures." . (isset($errno) && isset($errstr) ? "Last Error : ({$errno}) {$errstr}" : "")); - } - - $this->connectFailures = 0; - $this->connected = TRUE; - - // Set read timeout - if ($this->readTimeout) { - $this->setReadTimeout($this->readTimeout); - } - - if($this->authPassword) { - $this->auth($this->authPassword); - } - if($this->selectedDb !== 0) { - $this->select($this->selectedDb); - } - return $this; - } - /** - * @return bool - */ - public function isConnected() - { - return $this->connected; - } - /** - * Set the read timeout for the connection. Use 0 to disable timeouts entirely (or use a very long timeout - * if not supported). - * - * @param int $timeout 0 (or -1) for no timeout, otherwise number of seconds - * @throws CredisException - * @return Credis_Client - */ - public function setReadTimeout($timeout) - { - if ($timeout < -1) { - throw new CredisException('Timeout values less than -1 are not accepted.'); - } - $this->readTimeout = $timeout; - if ($this->isConnected()) { - if ($this->standalone) { - $timeout = $timeout <= 0 ? 315360000 : $timeout; // Ten-year timeout - stream_set_blocking($this->redis, TRUE); - stream_set_timeout($this->redis, (int) floor($timeout), ($timeout - floor($timeout)) * 1000000); - } else if (defined('Redis::OPT_READ_TIMEOUT')) { - // supported in phpredis 2.2.3 - // a timeout value of -1 means reads will not timeout - $timeout = $timeout == 0 ? -1 : $timeout; - $this->redis->setOption(\Redis::OPT_READ_TIMEOUT, $timeout); - } - } - return $this; - } - - /** - * @return bool - */ - public function close($force = FALSE) - { - $result = TRUE; - if ($this->redis && ($force || $this->connected && ! $this->persistent)) { - try { - if (is_callable(array($this->redis, 'close'))) { - $this->redis->close(); - } else { - @fclose($this->redis); - $this->redis = null; - } - } catch (Exception $e) { - ; // Ignore exceptions on close - } - $this->connected = $this->usePipeline = $this->isMulti = $this->isWatching = FALSE; - } - return $result; - } - - /** - * Enabled command renaming and provide mapping method. Supported methods are: - * - * 1. renameCommand('foo') // Salted md5 hash for all commands -> md5('foo'.$command) - * 2. renameCommand(function($command){ return 'my'.$command; }); // Callable - * 3. renameCommand('get', 'foo') // Single command -> alias - * 4. renameCommand(['get' => 'foo', 'set' => 'bar']) // Full map of [command -> alias] - * - * @param string|callable|array $command - * @param string|null $alias - * @return $this - */ - public function renameCommand($command, $alias = NULL) - { - if ( ! $this->standalone) { - $this->forceStandalone(); - } - if ($alias === NULL) { - $this->renamedCommands = $command; - } else { - if ( ! $this->renamedCommands) { - $this->renamedCommands = array(); - } - $this->renamedCommands[$command] = $alias; - } - return $this; - } - - /** - * @param $command - * @return string - */ - public function getRenamedCommand($command) - { - static $map; - - // Command renaming not enabled - if ($this->renamedCommands === NULL) { - return $command; - } - - // Initialize command map - if ($map === NULL) { - if (is_array($this->renamedCommands)) { - $map = $this->renamedCommands; - } else { - $map = array(); - } - } - - // Generate and return cached result - if ( ! isset($map[$command])) { - // String means all commands are hashed with salted md5 - if (is_string($this->renamedCommands)) { - $map[$command] = md5($this->renamedCommands.$command); - } - // Would already be set in $map if it was intended to be renamed - else if (is_array($this->renamedCommands)) { - return $command; - } - // User-supplied function - else if (is_callable($this->renamedCommands)) { - $map[$command] = call_user_func($this->renamedCommands, $command); - } - } - return $map[$command]; - } - - /** - * @param string $password - * @return bool - */ - public function auth($password) - { - $response = $this->__call('auth', array($password)); - $this->authPassword = $password; - return $response; - } - - /** - * @param int $index - * @return bool - */ - public function select($index) - { - $response = $this->__call('select', array($index)); - $this->selectedDb = (int) $index; - return $response; - } - - /** - * @param string|array $pattern - * @return array - */ - public function pUnsubscribe() - { - list($command, $channel, $subscribedChannels) = $this->__call('punsubscribe', func_get_args()); - $this->subscribed = $subscribedChannels > 0; - return array($command, $channel, $subscribedChannels); - } - - /** - * @param int $Iterator - * @param string $pattern - * @param int $count - * @return bool|array - */ - public function scan(&$Iterator, $pattern = null, $count = null) - { - return $this->__call('scan', array(&$Iterator, $pattern, $count)); - } - - /** - * @param int $Iterator - * @param string $field - * @param string $pattern - * @param int $count - * @return bool|array - */ - public function hscan(&$Iterator, $field, $pattern = null, $count = null) - { - return $this->__call('hscan', array($field, &$Iterator, $pattern, $count)); - } - - /** - * @param int $Iterator - * @param string $field - * @param string $pattern - * @param int $Iterator - * @return bool|array - */ - public function sscan(&$Iterator, $field, $pattern = null, $count = null) - { - return $this->__call('sscan', array($field, &$Iterator, $pattern, $count)); - } - - /** - * @param int $Iterator - * @param string $field - * @param string $pattern - * @param int $Iterator - * @return bool|array - */ - public function zscan(&$Iterator, $field, $pattern = null, $count = null) - { - return $this->__call('zscan', array($field, &$Iterator, $pattern, $count)); - } - - /** - * @param string|array $patterns - * @param $callback - * @return $this|array|bool|Credis_Client|mixed|null|string - * @throws CredisException - */ - public function pSubscribe($patterns, $callback) - { - if ( ! $this->standalone) { - return $this->__call('pSubscribe', array((array)$patterns, $callback)); - } - - // Standalone mode: use infinite loop to subscribe until timeout - $patternCount = is_array($patterns) ? count($patterns) : 1; - while ($patternCount--) { - if (isset($status)) { - list($command, $pattern, $status) = $this->read_reply(); - } else { - list($command, $pattern, $status) = $this->__call('psubscribe', array($patterns)); - } - $this->subscribed = $status > 0; - if ( ! $status) { - throw new CredisException('Invalid pSubscribe response.'); - } - } - while ($this->subscribed) { - list($type, $pattern, $channel, $message) = $this->read_reply(); - if ($type != 'pmessage') { - throw new CredisException('Received non-pmessage reply.'); - } - $callback($this, $pattern, $channel, $message); - } - return null; - } - - /** - * @param string|array $pattern - * @return array - */ - public function unsubscribe() - { - list($command, $channel, $subscribedChannels) = $this->__call('unsubscribe', func_get_args()); - $this->subscribed = $subscribedChannels > 0; - return array($command, $channel, $subscribedChannels); - } - - /** - * @param string|array $channels - * @param $callback - * @throws CredisException - * @return $this|array|bool|Credis_Client|mixed|null|string - */ - public function subscribe($channels, $callback) - { - if ( ! $this->standalone) { - return $this->__call('subscribe', array((array)$channels, $callback)); - } - - // Standalone mode: use infinite loop to subscribe until timeout - $channelCount = is_array($channels) ? count($channels) : 1; - while ($channelCount--) { - if (isset($status)) { - list($command, $channel, $status) = $this->read_reply(); - } else { - list($command, $channel, $status) = $this->__call('subscribe', array($channels)); - } - $this->subscribed = $status > 0; - if ( ! $status) { - throw new CredisException('Invalid subscribe response.'); - } - } - while ($this->subscribed) { - list($type, $channel, $message) = $this->read_reply(); - if ($type != 'message') { - throw new CredisException('Received non-message reply.'); - } - $callback($this, $channel, $message); - } - return null; - } - - /** - * @param string|null $name - * @return string|Credis_Client - */ - public function ping($name = null) - { - return $this->__call('ping', $name ? array($name) : array()); - } - - /** - * @param string $command - * @param array $args - * - * @return array|Credis_Client - */ - public function rawCommand($command, array $args) - { - if($this->standalone) - { - return $this->__call($command, $args); - } - else - { - \array_unshift($args, $command); - return $this->__call('rawCommand', $args); - } - } - - public function __call($name, $args) - { - // Lazy connection - $this->connect(); - - $name = strtolower($name); - - // Send request via native PHP - if($this->standalone) - { - $trackedArgs = array(); - switch ($name) { - case 'eval': - case 'evalsha': - $script = array_shift($args); - $keys = (array) array_shift($args); - $eArgs = (array) array_shift($args); - $args = array($script, count($keys), $keys, $eArgs); - break; - case 'zinterstore': - case 'zunionstore': - $dest = array_shift($args); - $keys = (array) array_shift($args); - $weights = array_shift($args); - $aggregate = array_shift($args); - $args = array($dest, count($keys), $keys); - if ($weights) { - $args[] = (array) $weights; - } - if ($aggregate) { - $args[] = $aggregate; - } - break; - case 'set': - // The php redis module has different behaviour with ttl - // https://github.com/phpredis/phpredis#set - if (count($args) === 3 && is_int($args[2])) { - $args = array($args[0], $args[1], array('EX', $args[2])); - } elseif (count($args) === 3 && is_array($args[2])) { - $tmp_args = $args; - $args = array($tmp_args[0], $tmp_args[1]); - foreach ($tmp_args[2] as $k=>$v) { - if (is_string($k)) { - $args[] = array($k,$v); - } elseif (is_int($k)) { - $args[] = $v; - } - } - unset($tmp_args); - } - break; - case 'scan': - $trackedArgs = array(&$args[0]); - if (empty($trackedArgs[0])) - { - $trackedArgs[0] = 0; - } - $eArgs = array($trackedArgs[0]); - if (!empty($args[1])) - { - $eArgs[] = 'MATCH'; - $eArgs[] = $args[1]; - } - if (!empty($args[2])) - { - $eArgs[] = 'COUNT'; - $eArgs[] = $args[2]; - } - $args = $eArgs; - break; - case 'sscan': - case 'zscan': - case 'hscan': - $trackedArgs = array(&$args[1]); - if (empty($trackedArgs[0])) - { - $trackedArgs[0] = 0; - } - $eArgs = array($args[0],$trackedArgs[0]); - if (!empty($args[2])) - { - $eArgs[] = 'MATCH'; - $eArgs[] = $args[2]; - } - if (!empty($args[3])) - { - $eArgs[] = 'COUNT'; - $eArgs[] = $args[3]; - } - $args = $eArgs; - break; - case 'zrangebyscore': - case 'zrevrangebyscore': - case 'zrange': - case 'zrevrange': - if (isset($args[3]) && is_array($args[3])) { - // map options - $cArgs = array(); - if (!empty($args[3]['withscores'])) { - $cArgs[] = 'withscores'; - } - if (($name == 'zrangebyscore' || $name == 'zrevrangebyscore') && array_key_exists('limit', $args[3])) { - $cArgs[] = array('limit' => $args[3]['limit']); - } - $args[3] = $cArgs; - $trackedArgs = $cArgs; - } - break; - case 'mget': - if (isset($args[0]) && is_array($args[0])) - { - $args = array_values($args[0]); - } - break; - case 'hmset': - if (isset($args[1]) && is_array($args[1])) - { - $cArgs = array(); - foreach($args[1] as $id => $value) - { - $cArgs[] = $id; - $cArgs[] = $value; - } - $args[1] = $cArgs; - } - break; - case 'zsize': - $name = 'zcard'; - break; - case 'zdelete': - $name = 'zrem'; - break; - case 'hmget': - // hmget needs to track the keys for rehydrating the results - if (isset($args[1])) - { - $trackedArgs = $args[1]; - } - break; - } - // Flatten arguments - $args = self::_flattenArguments($args); - - // In pipeline mode - if($this->usePipeline) - { - if($name === 'pipeline') { - throw new CredisException('A pipeline is already in use and only one pipeline is supported.'); - } - else if($name === 'exec') { - if($this->isMulti) { - $this->commandNames[] = array($name, $trackedArgs); - $this->commands .= self::_prepare_command(array($this->getRenamedCommand($name))); - } - - // Write request - if($this->commands) { - $this->write_command($this->commands); - } - $this->commands = NULL; - - // Read response - $queuedResponses = array(); - $response = array(); - foreach($this->commandNames as $command) { - list($name, $arguments) = $command; - $result = $this->read_reply($name, true); - if ($result !== null) - { - $result = $this->decode_reply($name, $result, $arguments); - } - else - { - $queuedResponses[] = $command; - } - $response[] = $result; - } - - if($this->isMulti) { - $response = array_pop($response); - foreach($queuedResponses as $key => $command) - { - list($name, $arguments) = $command; - $response[$key] = $this->decode_reply($name, $response[$key], $arguments); - } - } - - $this->commandNames = NULL; - $this->usePipeline = $this->isMulti = FALSE; - return $response; - } - else if ($name === 'discard') - { - $this->commands = NULL; - $this->commandNames = NULL; - $this->usePipeline = $this->isMulti = FALSE; - } - else { - if($name === 'multi') { - $this->isMulti = TRUE; - } - array_unshift($args, $this->getRenamedCommand($name)); - $this->commandNames[] = array($name, $trackedArgs); - $this->commands .= self::_prepare_command($args); - return $this; - } - } - - // Start pipeline mode - if($name === 'pipeline') - { - $this->usePipeline = TRUE; - $this->commandNames = array(); - $this->commands = ''; - return $this; - } - - // If unwatching, allow reconnect with no error thrown - if($name === 'unwatch') { - $this->isWatching = FALSE; - } - - // Non-pipeline mode - array_unshift($args, $this->getRenamedCommand($name)); - $command = self::_prepare_command($args); - $this->write_command($command); - $response = $this->read_reply($name); - $response = $this->decode_reply($name, $response, $trackedArgs); - - // Watch mode disables reconnect so error is thrown - if($name == 'watch') { - $this->isWatching = TRUE; - } - // Transaction mode - else if($this->isMulti && ($name == 'exec' || $name == 'discard')) { - $this->isMulti = FALSE; - } - // Started transaction - else if($this->isMulti || $name == 'multi') { - $this->isMulti = TRUE; - $response = $this; - } - } - - // Send request via phpredis client - else - { - // Tweak arguments - switch($name) { - case 'get': // optimize common cases - case 'set': - case 'hget': - case 'hset': - case 'setex': - case 'mset': - case 'msetnx': - case 'hmset': - case 'hmget': - case 'del': - case 'zrangebyscore': - case 'zrevrangebyscore': - break; - case 'zrange': - case 'zrevrange': - if (isset($args[3]) && is_array($args[3])) - { - $cArgs = $args[3]; - $args[3] = !empty($cArgs['withscores']); - } - $args = self::_flattenArguments($args); - break; - case 'zinterstore': - case 'zunionstore': - $cArgs = array(); - $cArgs[] = array_shift($args); // destination - $cArgs[] = array_shift($args); // keys - if(isset($args[0]) and isset($args[0]['weights'])) { - $cArgs[] = (array) $args[0]['weights']; - } else { - $cArgs[] = null; - } - if(isset($args[0]) and isset($args[0]['aggregate'])) { - $cArgs[] = strtoupper($args[0]['aggregate']); - } - $args = $cArgs; - break; - case 'mget': - if(isset($args[0]) && ! is_array($args[0])) { - $args = array($args); - } - break; - case 'lrem': - $args = array($args[0], $args[2], $args[1]); - break; - case 'eval': - case 'evalsha': - if (isset($args[1]) && is_array($args[1])) { - $cKeys = $args[1]; - } elseif (isset($args[1]) && is_string($args[1])) { - $cKeys = array($args[1]); - } else { - $cKeys = array(); - } - if (isset($args[2]) && is_array($args[2])) { - $cArgs = $args[2]; - } elseif (isset($args[2]) && is_string($args[2])) { - $cArgs = array($args[2]); - } else { - $cArgs = array(); - } - $args = array($args[0], array_merge($cKeys, $cArgs), count($cKeys)); - break; - case 'subscribe': - case 'psubscribe': - break; - case 'scan': - case 'sscan': - case 'hscan': - case 'zscan': - // allow phpredis to see the caller's reference - //$param_ref =& $args[0]; - break; - default: - // Flatten arguments - $args = self::_flattenArguments($args); - } - - try { - // Proxy pipeline mode to the phpredis library - if($name == 'pipeline' || $name == 'multi') { - if($this->isMulti) { - return $this; - } else { - $this->isMulti = TRUE; - $this->redisMulti = call_user_func_array(array($this->redis, $name), $args); - return $this; - } - } - else if($name == 'exec' || $name == 'discard') { - $this->isMulti = FALSE; - $response = $this->redisMulti->$name(); - $this->redisMulti = NULL; - #echo "> $name : ".substr(print_r($response, TRUE),0,100)."\n"; - return $response; - } - - // Use aliases to be compatible with phpredis wrapper - if(isset($this->wrapperMethods[$name])) { - $name = $this->wrapperMethods[$name]; - } - - // Multi and pipeline return self for chaining - if($this->isMulti) { - call_user_func_array(array($this->redisMulti, $name), $args); - return $this; - } - - // Send request, retry one time when using persistent connections on the first request only - $this->requests++; - try { - $response = call_user_func_array(array($this->redis, $name), $args); - } catch (\RedisException $e) { - if ($this->persistent && $this->requests == 1 && $e->getMessage() == 'read error on connection') { - $this->close(true); - $this->connect(); - $response = call_user_func_array(array($this->redis, $name), $args); - } else { - throw $e; - } - } - } - // Wrap exceptions - catch(\RedisException $e) { - $code = 0; - if ( ! ($result = $this->redis->IsConnected())) { - $this->close(true); - $code = CredisException::CODE_DISCONNECTED; - } - throw new CredisException($e->getMessage(), $code, $e); - } - - #echo "> $name : ".substr(print_r($response, TRUE),0,100)."\n"; - - // change return values where it is too difficult to minim in standalone mode - switch($name) - { - case 'type': - $typeMap = array( - self::TYPE_NONE, - self::TYPE_STRING, - self::TYPE_SET, - self::TYPE_LIST, - self::TYPE_ZSET, - self::TYPE_HASH, - ); - $response = $typeMap[$response]; - break; - - // Handle scripting errors - case 'eval': - case 'evalsha': - case 'script': - $error = $this->redis->getLastError(); - $this->redis->clearLastError(); - if ($error && substr($error,0,8) == 'NOSCRIPT') { - $response = NULL; - } else if ($error) { - throw new CredisException($error); - } - break; - case 'exists': - // smooth over phpredis-v4 vs earlier difference to match documented credis return results - $response = (int) $response; - break; - case 'ping': - if ($response) { - if ($response === true) { - $response = isset($args[0]) ? $args[0] : "PONG"; - } else if ($response[0] === '+') { - $response = substr($response, 1); - } - } - break; - case 'auth': - if (is_bool($response) && $response === true){ - $this->redis->clearLastError(); - } - default: - $error = $this->redis->getLastError(); - $this->redis->clearLastError(); - if ($error) { - throw new CredisException(rtrim($error)); - } - break; - } - } - - return $response; - } - - protected function write_command($command) - { - // Reconnect on lost connection (Redis server "timeout" exceeded since last command) - if(feof($this->redis)) { - // If a watch or transaction was in progress and connection was lost, throw error rather than reconnect - // since transaction/watch state will be lost. - if(($this->isMulti && ! $this->usePipeline) || $this->isWatching) { - $this->close(true); - throw new CredisException('Lost connection to Redis server during watch or transaction.'); - } - $this->close(true); - $this->connect(); - if($this->authPassword) { - $this->auth($this->authPassword); - } - if($this->selectedDb != 0) { - $this->select($this->selectedDb); - } - } - - $commandLen = strlen($command); - $lastFailed = FALSE; - for ($written = 0; $written < $commandLen; $written += $fwrite) { - $fwrite = fwrite($this->redis, substr($command, $written)); - if ($fwrite === FALSE || ($fwrite == 0 && $lastFailed)) { - $this->close(true); - throw new CredisException('Failed to write entire command to stream'); - } - $lastFailed = $fwrite == 0; - } - } - - protected function read_reply($name = '', $returnQueued = false) - { - $reply = fgets($this->redis); - if($reply === FALSE) { - $info = stream_get_meta_data($this->redis); - $this->close(true); - if ($info['timed_out']) { - throw new CredisException('Read operation timed out.', CredisException::CODE_TIMED_OUT); - } else { - throw new CredisException('Lost connection to Redis server.', CredisException::CODE_DISCONNECTED); - } - } - $reply = rtrim($reply, CRLF); - #echo "> $name: $reply\n"; - $replyType = substr($reply, 0, 1); - switch ($replyType) { - /* Error reply */ - case '-': - if($this->isMulti || $this->usePipeline) { - $response = FALSE; - } else if ($name == 'evalsha' && substr($reply,0,9) == '-NOSCRIPT') { - $response = NULL; - } else { - throw new CredisException(substr($reply,0,4) == '-ERR' ? 'ERR '.substr($reply, 5) : substr($reply,1)); - } - break; - /* Inline reply */ - case '+': - $response = substr($reply, 1); - if($response == 'OK') { - return TRUE; - } - if($response == 'QUEUED') { - return $returnQueued ? null : true; - } - break; - /* Bulk reply */ - case '$': - if ($reply == '$-1') return FALSE; - $size = (int) substr($reply, 1); - $response = stream_get_contents($this->redis, $size + 2); - if( ! $response) { - $this->close(true); - throw new CredisException('Error reading reply.'); - } - $response = substr($response, 0, $size); - break; - /* Multi-bulk reply */ - case '*': - $count = substr($reply, 1); - if ($count == '-1') return FALSE; - - $response = array(); - for ($i = 0; $i < $count; $i++) { - $response[] = $this->read_reply(); - } - break; - /* Integer reply */ - case ':': - $response = intval(substr($reply, 1)); - break; - default: - throw new CredisException('Invalid response: '.print_r($reply, TRUE)); - break; - } - - return $response; - } - - protected function decode_reply($name, $response, array &$arguments = array() ) - { - // Smooth over differences between phpredis and standalone response - switch ($name) - { - case '': // Minor optimization for multi-bulk replies - break; - case 'config': - case 'hgetall': - $keys = $values = array(); - while ($response) - { - $keys[] = array_shift($response); - $values[] = array_shift($response); - } - $response = count($keys) ? array_combine($keys, $values) : array(); - break; - case 'info': - $lines = explode(CRLF, trim($response, CRLF)); - $response = array(); - foreach ($lines as $line) - { - if (!$line || substr($line, 0, 1) == '#') - { - continue; - } - list($key, $value) = explode(':', $line, 2); - $response[$key] = $value; - } - break; - case 'ttl': - if ($response === -1) - { - $response = false; - } - break; - case 'hmget': - if (count($arguments) != count($response)) - { - throw new CredisException( - 'hmget arguments and response do not match: ' . print_r($arguments, true) . ' ' . print_r( - $response, true - ) - ); - } - // rehydrate results into key => value form - $response = array_combine($arguments, $response); - break; - - case 'scan': - case 'sscan': - $arguments[0] = intval(array_shift($response)); - $response = empty($response[0]) ? array() : $response[0]; - break; - case 'hscan': - case 'zscan': - $arguments[0] = intval(array_shift($response)); - $response = empty($response[0]) ? array() : $response[0]; - if (!empty($response) && is_array($response)) - { - $count = count($response); - $out = array(); - for ($i = 0; $i < $count; $i += 2) - { - $out[$response[$i]] = $response[$i + 1]; - } - $response = $out; - } - break; - case 'zrangebyscore': - case 'zrevrangebyscore': - case 'zrange': - case 'zrevrange': - if (in_array('withscores', $arguments, true)) - { - // Map array of values into key=>score list like phpRedis does - $item = null; - $out = array(); - foreach ($response as $value) - { - if ($item == null) - { - $item = $value; - } - else - { - // 2nd value is the score - $out[$item] = (float)$value; - $item = null; - } - } - $response = $out; - } - break; - } - - return $response; - } - - /** - * Build the Redis unified protocol command - * - * @param array $args - * @return string - */ - private static function _prepare_command($args) - { - return sprintf('*%d%s%s%s', count($args), CRLF, implode(CRLF, array_map(array('self', '_map'), $args)), CRLF); - } - - private static function _map($arg) - { - return sprintf('$%d%s%s', strlen($arg), CRLF, $arg); - } - - /** - * Flatten arguments - * - * If an argument is an array, the key is inserted as argument followed by the array values - * array('zrangebyscore', '-inf', 123, array('limit' => array('0', '1'))) - * becomes - * array('zrangebyscore', '-inf', 123, 'limit', '0', '1') - * - * @param array $in - * @return array - */ - private static function _flattenArguments(array $arguments, &$out = array()) - { - foreach ($arguments as $key => $arg) { - if (!is_int($key)) { - $out[] = $key; - } - - if (is_array($arg)) { - self::_flattenArguments($arg, $out); - } else { - $out[] = $arg; - } - } - - return $out; - } -} diff --git a/system/engine/autoload.php b/system/engine/autoload.php index c1f5ea7..416c63c 100644 --- a/system/engine/autoload.php +++ b/system/engine/autoload.php @@ -22,7 +22,8 @@ spl_autoload_register(function ($class) { 'Request', 'Mail', 'Translate'. - 'Encryption' + 'Encryption', + 'Render' ]; if(in_array($class, $legacy)){ @@ -76,7 +77,8 @@ spl_autoload_register(function ($class) { 'interfaces\\action', 'traits\\action', 'interfaces\\databases', - 'exception' + 'exception', + 'render' ]; if($namespace[0] == "Phacil" && in_array($classNative, $allowed)){ @@ -190,6 +192,22 @@ require_once(DIR_SYSTEM . 'engine/action.php'); $composer = defined('DIR_VENDOR') ? DIR_VENDOR : DIR_SYSTEM . 'vendor/autoload.php'; if (file_exists($composer)) { + /** + * fix for Polyfill Mbstring in older PHP versions + */ + if (!function_exists('mb_convert_variables')) { + function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) + { + return Symfony\Polyfill\Mbstring\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $v0, $a, $b, $c, $d, $e, $f); + } + } + if (extension_loaded('mbstring')) { + $GLOBALS['__composer_autoload_files']['0e6d7bf4a5811bfa5cf40c5ccd6fae6a'] = 'noLoad'; + } + /** + * End fix + */ + $autoloadComposer = (include_once $composer); //return; } \ No newline at end of file diff --git a/system/engine/controller.php b/system/engine/controller.php index f129a7b..7dfd53f 100644 --- a/system/engine/controller.php +++ b/system/engine/controller.php @@ -180,7 +180,7 @@ abstract class Controller { * @return never * @final */ - final protected function redirect($url, int $status = 302) { + final protected function redirect($url, $status = 302) { $this->registry->response->redirect($url, $status); } @@ -293,165 +293,18 @@ abstract class Controller { $templateFileInfo = pathinfo($templatePath .$this->template); $templateType = $templateFileInfo['extension']; - switch($templateType) { - case 'tpl': - extract($this->data); + $tpl = new \Phacil\Framework\Render($templateType, $templatePath, $this->template, $this->data, $this->twig); - ob_start(); - require($templatePath . $this->template); - - $this->output = ob_get_contents(); - - ob_end_clean(); - break; - - case 'phtml': - extract($this->data); - - ob_start(); - require($templatePath . $this->template); - - $this->output = ob_get_contents(); - - ob_end_clean(); - break; - - case 'twig': - require_once(DIR_SYSTEM."templateEngines/Twig/autoload.php"); - - /** - * @var array - */ - $config = array( - 'autoescape' => false, - 'cache' => DIR_CACHE."twig/", - 'debug' => (defined('DEBUG')) ? DEBUG : false - ); - $TwigLoaderFilesystem = constant('\TwigLoaderFilesystem'); - $Twig_Environment = constant('\TwigEnvironment'); - $Twig_SimpleFilter = constant('\TwigSimpleFilter'); - $Twig_Extension_Debug = constant('\TwigExtensionDebug'); - - /** - * @var \TwigLoaderFilesystem - */ - $loader = new $TwigLoaderFilesystem ($templatePath); - - /** - * @var \TwigEnvironment - */ - $twig = new $Twig_Environment($loader, $config); - - if($config['debug']) { - $twig->addExtension(new $Twig_Extension_Debug()); - } - - /** - * @var \transExtension - */ - $twig->addExtension(new \transExtension()); - - $twig->addFilter(new $Twig_SimpleFilter('translate', function ($str) { - // do something different from the built-in date filter - return traduzir($str); - })); - - $twig->addFilter(new $Twig_SimpleFilter('config', function ($str) { - // do something different from the built-in date filter - return $this->config->get($str); - })); - - foreach ($this->twig as $key => $item) { - $twig->addFilter(new $Twig_SimpleFilter($key, $item)); - } - - $template = $twig->load($this->template); - - $this->output = $template->render($this->data); - break; - - - case 'mustache': - require_once(DIR_SYSTEM."templateEngines/Mustache/autoload.php"); - - \Mustache_Autoloader::register(); - - /** - * @var \Mustache_Engine - */ - $mustache = new \Mustache_Engine(array( - //'template_class_prefix' => '__MyTemplates_', - 'cache' => DIR_CACHE.'mustache', - 'cache_file_mode' => 0666, // Please, configure your umask instead of doing this :) - //'cache_lambda_templates' => true, - 'loader' => new \Mustache_Loader_FilesystemLoader($templatePath), - //'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'), - 'helpers' => array('translate' => function($text) { - if (class_exists('Translate')) { - $trans = new Translate(); - return ($trans->translation($text)); - } else { - return $text; - }// do something translatey here... - }), - /*'escape' => function($value) { - return $value; - },*/ - //'charset' => 'ISO-8859-1', - //'logger' => new Mustache_Logger_StreamLogger('php://stderr'), - //'strict_callables' => true, - //'pragmas' => [Mustache_Engine::PRAGMA_FILTERS], - )); - - $tpl = $mustache->loadTemplate($this->template); - $this->output = $tpl->render($this->data); - break; - - case 'smarty': - require_once(DIR_SYSTEM."templateEngines/smarty/autoload.php"); - - /** - * @var \Smarty - */ - $smarty = new \Smarty(); - - $smarty->setTemplateDir($templatePath); - $smarty->setCompileDir(DIR_CACHE."Smarty/compile/"); - //$smarty->setConfigDir('/web/www.example.com/guestbook/configs/'); - $smarty->setCacheDir(DIR_CACHE."Smarty/cache/"); - - $smarty->registerPlugin("block","translate", "translate"); - - $smarty->assign($this->data); - - $smarty->caching = \Smarty::CACHING_LIFETIME_CURRENT; - - //** un-comment the following line to show the debug console - $smarty->debugging = (defined('DEBUG')) ? DEBUG : false; - - $this->output = $smarty->display($this->template); - break; - - default: - extract($this->data); - - ob_start(); - require($templatePath . $this->template); - - $this->output = ob_get_contents(); - - ob_end_clean(); - break; + $this->registry->response->addHeader('Content-Type', $this->contentType); - } + $this->output = $tpl->render(); - $this->registry->response->addHeader('Content-Type', $this->contentType); + unset($tpl); return $this->output; } else { - trigger_error('Error: Could not load template ' . $templatePath . $this->template . '!'); - exit(); + throw new Exception('Error: Could not load template ' . $templatePath . $this->template . '!'); } } diff --git a/system/engine/log.php b/system/engine/log.php index 9304101..5bcb552 100644 --- a/system/engine/log.php +++ b/system/engine/log.php @@ -108,7 +108,7 @@ final class Log { * @return false|string * @since 2.0.0 */ - public function tail($filepath = null, int $lines = 10, bool $adaptive = true) + public function tail($filepath = null, $lines = 10, $adaptive = true) { // Open file @@ -173,7 +173,7 @@ final class Log { * @return false|string * @since 2.0.0 */ - public function head($filepath = null, int $lines = 10, bool $adaptive = true) + public function head($filepath = null, $lines = 10, $adaptive = true) { // Open file diff --git a/system/engine/render.php b/system/engine/render.php new file mode 100644 index 0000000..7bb91a8 --- /dev/null +++ b/system/engine/render.php @@ -0,0 +1,204 @@ +data = $data; + + $this->template = $template; + + $this->templatePath = $templatePath; + + $this->templateType = $templateType; + + $this->extras = $extras; + } + + /** + * + * @return mixed + */ + public function render(){ + $templateFunc = $this->templateType; + + if(method_exists($this,$templateFunc)) + $this->$templateFunc(); + + return $this->output; + } + + /** + * + * @return void + */ + protected function templateDefault(){ + extract($this->data); + + ob_start(); + require($this->templatePath . $this->template); + + $this->output = ob_get_contents(); + + ob_end_clean(); + } + + protected function tpl(){ + $this->templateDefault(); + } + + protected function phtml () { + $this->templateDefault(); + } + + /** + * Twig render + * @return void + */ + protected function twig () { + require_once(DIR_SYSTEM . "templateEngines/Twig/autoload.php"); + + /** + * @var array + */ + $config = array( + 'autoescape' => false, + 'cache' => DIR_CACHE . "twig/", + 'debug' => (defined('DEBUG')) ? DEBUG : false + ); + $TwigLoaderFilesystem = constant('\TwigLoaderFilesystem'); + $Twig_Environment = constant('\TwigEnvironment'); + $Twig_SimpleFilter = constant('\TwigSimpleFilter'); + $Twig_Extension_Debug = constant('\TwigExtensionDebug'); + + /** + * @var \TwigLoaderFilesystem + */ + $loader = new $TwigLoaderFilesystem($this->templatePath); + + /** + * @var \TwigEnvironment + */ + $twig = new $Twig_Environment($loader, $config); + + if ($config['debug']) { + $twig->addExtension(new $Twig_Extension_Debug()); + } + + /** + * @var \transExtension + */ + $twig->addExtension(new \transExtension()); + + $twig->addFilter(new $Twig_SimpleFilter('translate', function ($str) { + // do something different from the built-in date filter + return traduzir($str); + })); + + $twig->addFilter(new $Twig_SimpleFilter('config', function ($str) { + // do something different from the built-in date filter + return $this->config->get($str); + })); + + foreach ($this->extras as $key => $item) { + $twig->addFilter(new $Twig_SimpleFilter($key, $item)); + } + + $template = $twig->load($this->template); + + $this->output = $template->render($this->data); + } + + /** + * Mustache render + * @return void + * @throws \TypeError + * @throws \Mustache_Exception_UnknownTemplateException + * @throws \RuntimeException + */ + protected function mustache(){ + \Mustache_Autoloader::register(); + + /** + * @var \Mustache_Engine + */ + $mustache = new \Mustache_Engine(array( + 'cache' => DIR_CACHE . 'mustache', + 'cache_file_mode' => 0666, + 'loader' => new \Mustache_Loader_FilesystemLoader($this->templatePath), + 'helpers' => array('translate' => function ($text) { + if (class_exists('Translate')) { + $trans = new Translate(); + return ($trans->translation($text)); + } else { + return $text; + } // do something translate here... + }) + )); + + $tpl = $mustache->loadTemplate($this->template); + $this->output = $tpl->render($this->data); + } + + /** + * Smarty 3 render + * @return void + * @throws \SmartyException + * @throws \Exception + */ + protected function smarty() { + /** + * @var \Smarty + */ + $smarty = new \Smarty(); + + $smarty->setTemplateDir($this->templatePath); + $smarty->setCompileDir(DIR_CACHE . "Smarty/compile/"); + + $smarty->setCacheDir(DIR_CACHE . "Smarty/cache/"); + + $smarty->registerPlugin("block", "translate", "translate"); + + $smarty->assign($this->data); + + $smarty->caching = \Smarty::CACHING_LIFETIME_CURRENT; + + $smarty->debugging = (defined('DEBUG')) ? DEBUG : false; + + $this->output = $smarty->display($this->template); + } + } + diff --git a/system/engine/response.php b/system/engine/response.php index cf96810..c319fa0 100644 --- a/system/engine/response.php +++ b/system/engine/response.php @@ -53,7 +53,7 @@ final class Response { * @param int $status * @return never */ - public function redirect($url, int $status = 302) + public function redirect($url, $status = 302) { header('Status: ' . $status); header('Location: ' . $url); diff --git a/system/templateEngines/Twig/autoload.php b/system/templateEngines/Twig/autoload.php index 4788cdf..f3d2b58 100644 --- a/system/templateEngines/Twig/autoload.php +++ b/system/templateEngines/Twig/autoload.php @@ -13,17 +13,19 @@ namespace { define('TwigSimpleFilter', '\Twig\TwigFilter'); define('TwigExtensionDebug', '\Twig\Extension\DebugExtension'); - if (version_compare(phpversion(), '7.2.0', '>') == false) { + if (version_compare(phpversion(), '7.2.5', '>') == false) { define('TwigFolderLoad', 'Twig2x'); } else { - define('TwigFolderLoad', 'Twig3x'); + //define('TwigFolderLoad', 'Twig3x'); } } - include_once TwigFolderLoad."/autoload.php"; + if(defined('TwigFolderLoad')){ + include_once TwigFolderLoad."/autoload.php"; + } - if(TwigFolderLoad == 'Twig1x') { + if(defined('TwigFolderLoad') && TwigFolderLoad == 'Twig1x') { if (file_exists(__DIR__ . "/Extension/ExacTITranslate1x.php")) include __DIR__ . "/Extension/ExacTITranslate1x.php"; } else { if (file_exists(__DIR__ . "/Extension/ExacTITranslate.php")) include __DIR__ . "/Extension/ExacTITranslate.php"; diff --git a/system/vendor/autoload.php b/system/vendor/autoload.php new file mode 100644 index 0000000..7836faf --- /dev/null +++ b/system/vendor/autoload.php @@ -0,0 +1,7 @@ + + * @copyright 2011 Colin Mollenhour + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @package Credis_Client + */ + +if( ! defined('CRLF')) define('CRLF', sprintf('%s%s', chr(13), chr(10))); + +/** + * Credis-specific errors, wraps native Redis errors + */ +class CredisException extends Exception +{ + + const CODE_TIMED_OUT = 1; + const CODE_DISCONNECTED = 2; + + public function __construct($message, $code = 0, $exception = NULL) + { + if ($exception && get_class($exception) == 'RedisException' && strpos($message,'read error on connection') === 0) { + $code = CredisException::CODE_DISCONNECTED; + } + parent::__construct($message, $code, $exception); + } + +} + +/** + * Credis_Client, a lightweight Redis PHP standalone client and phpredis wrapper + * + * Server/Connection: + * @method Credis_Client pipeline() + * @method Credis_Client multi() + * @method Credis_Client watch(string ...$keys) + * @method Credis_Client unwatch() + * @method array exec() + * @method string|Credis_Client flushAll() + * @method string|Credis_Client flushDb() + * @method array|Credis_Client info(string $section = null) + * @method bool|array|Credis_Client config(string $setGet, string $key, string $value = null) + * @method array|Credis_Client role() + * @method array|Credis_Client time() + * @method int|Credis_Client dbsize() + * + * Keys: + * @method int|Credis_Client del(string $key) + * @method int|Credis_Client exists(string $key) + * @method int|Credis_Client expire(string $key, int $seconds) + * @method int|Credis_Client expireAt(string $key, int $timestamp) + * @method array|Credis_Client keys(string $key) + * @method int|Credis_Client persist(string $key) + * @method bool|Credis_Client rename(string $key, string $newKey) + * @method bool|Credis_Client renameNx(string $key, string $newKey) + * @method array|Credis_Client sort(string $key, string $arg1, string $valueN = null) + * @method int|Credis_Client ttl(string $key) + * @method string|Credis_Client type(string $key) + * + * Scalars: + * @method int|Credis_Client append(string $key, string $value) + * @method int|Credis_Client decr(string $key) + * @method int|Credis_Client decrBy(string $key, int $decrement) + * @method bool|string|Credis_Client get(string $key) + * @method int|Credis_Client getBit(string $key, int $offset) + * @method string|Credis_Client getRange(string $key, int $start, int $end) + * @method string|Credis_Client getSet(string $key, string $value) + * @method int|Credis_Client incr(string $key) + * @method int|Credis_Client incrBy(string $key, int $decrement) + * @method array|Credis_Client mGet(array $keys) + * @method bool|Credis_Client mSet(array $keysValues) + * @method int|Credis_Client mSetNx(array $keysValues) + * @method bool|Credis_Client set(string $key, string $value, int | array $options = null) + * @method int|Credis_Client setBit(string $key, int $offset, int $value) + * @method bool|Credis_Client setEx(string $key, int $seconds, string $value) + * @method int|Credis_Client setNx(string $key, string $value) + * @method int |Credis_Client setRange(string $key, int $offset, int $value) + * @method int|Credis_Client strLen(string $key) + * + * Sets: + * @method int|Credis_Client sAdd(string $key, mixed $value, string $valueN = null) + * @method int|Credis_Client sRem(string $key, mixed $value, string $valueN = null) + * @method array|Credis_Client sMembers(string $key) + * @method array|Credis_Client sUnion(mixed $keyOrArray, string $valueN = null) + * @method array|Credis_Client sInter(mixed $keyOrArray, string $valueN = null) + * @method array |Credis_Client sDiff(mixed $keyOrArray, string $valueN = null) + * @method string|Credis_Client sPop(string $key) + * @method int|Credis_Client sCard(string $key) + * @method int|Credis_Client sIsMember(string $key, string $member) + * @method int|Credis_Client sMove(string $source, string $dest, string $member) + * @method string|array|Credis_Client sRandMember(string $key, int $count = null) + * @method int|Credis_Client sUnionStore(string $dest, string $key1, string $key2 = null) + * @method int|Credis_Client sInterStore(string $dest, string $key1, string $key2 = null) + * @method int|Credis_Client sDiffStore(string $dest, string $key1, string $key2 = null) + * + * Hashes: + * @method bool|int|Credis_Client hSet(string $key, string $field, string $value) + * @method bool|Credis_Client hSetNx(string $key, string $field, string $value) + * @method bool|string|Credis_Client hGet(string $key, string $field) + * @method bool|int|Credis_Client hLen(string $key) + * @method bool|Credis_Client hDel(string $key, string $field) + * @method array|Credis_Client hKeys(string $key, string $field) + * @method array|Credis_Client hVals(string $key) + * @method array|Credis_Client hGetAll(string $key) + * @method bool|Credis_Client hExists(string $key, string $field) + * @method int|Credis_Client hIncrBy(string $key, string $field, int $value) + * @method float|Credis_Client hIncrByFloat(string $key, string $member, float $value) + * @method bool|Credis_Client hMSet(string $key, array $keysValues) + * @method array|Credis_Client hMGet(string $key, array $fields) + * + * Lists: + * @method array|null|Credis_Client blPop(string $keyN, int $timeout) + * @method array|null|Credis_Client brPop(string $keyN, int $timeout) + * @method array|null |Credis_Client brPoplPush(string $source, string $destination, int $timeout) + * @method string|null|Credis_Client lIndex(string $key, int $index) + * @method int|Credis_Client lInsert(string $key, string $beforeAfter, string $pivot, string $value) + * @method int|Credis_Client lLen(string $key) + * @method string|null|Credis_Client lPop(string $key) + * @method int|Credis_Client lPush(string $key, mixed $value, mixed $valueN = null) + * @method int|Credis_Client lPushX(string $key, mixed $value) + * @method array|Credis_Client lRange(string $key, int $start, int $stop) + * @method int|Credis_Client lRem(string $key, int $count, mixed $value) + * @method bool|Credis_Client lSet(string $key, int $index, mixed $value) + * @method bool|Credis_Client lTrim(string $key, int $start, int $stop) + * @method string|null|Credis_Client rPop(string $key) + * @method string|null|Credis_Client rPoplPush(string $source, string $destination) + * @method int|Credis_Client rPush(string $key, mixed $value, mixed $valueN = null) + * @method int |Credis_Client rPushX(string $key, mixed $value) + * + * Sorted Sets: + * @method int|Credis_Client zAdd(string $key, double $score, string $value) + * @method int|Credis_Client zCard(string $key) + * @method int|Credis_Client zSize(string $key) + * @method int|Credis_Client zCount(string $key, mixed $start, mixed $stop) + * @method int|Credis_Client zIncrBy(string $key, double $value, string $member) + * @method array|Credis_Client zRangeByScore(string $key, mixed $start, mixed $stop, array $args = null) + * @method array|Credis_Client zRevRangeByScore(string $key, mixed $start, mixed $stop, array $args = null) + * @method int|Credis_Client zRemRangeByScore(string $key, mixed $start, mixed $stop) + * @method array|Credis_Client zRange(string $key, mixed $start, mixed $stop, array $args = null) + * @method array|Credis_Client zRevRange(string $key, mixed $start, mixed $stop, array $args = null) + * @method int|Credis_Client zRank(string $key, string $member) + * @method int|Credis_Client zRevRank(string $key, string $member) + * @method int|Credis_Client zRem(string $key, string $member) + * @method int|Credis_Client zDelete(string $key, string $member) + * TODO + * + * Pub/Sub + * @method int |Credis_Client publish(string $channel, string $message) + * @method int|array|Credis_Client pubsub(string $subCommand, $arg = null) + * + * Scripting: + * @method string|int|Credis_Client script(string $command, string $arg1 = null) + * @method string|int|array|bool|Credis_Client eval(string $script, array $keys = null, array $args = null) + * @method string|int|array|bool|Credis_Client evalSha(string $script, array $keys = null, array $args = null) + */ +class Credis_Client { + + const VERSION = '1.11.4'; + + const TYPE_STRING = 'string'; + const TYPE_LIST = 'list'; + const TYPE_SET = 'set'; + const TYPE_ZSET = 'zset'; + const TYPE_HASH = 'hash'; + const TYPE_NONE = 'none'; + + const FREAD_BLOCK_SIZE = 8192; + + /** + * Socket connection to the Redis server or Redis library instance + * @var resource|Redis + */ + protected $redis; + protected $redisMulti; + + /** + * Host of the Redis server + * @var string + */ + protected $host; + + /** + * Scheme of the Redis server (tcp, tls, unix) + * @var string + */ + protected $scheme; + + /** + * Port on which the Redis server is running + * @var integer|null + */ + protected $port; + + /** + * Timeout for connecting to Redis server + * @var float + */ + protected $timeout; + + /** + * Timeout for reading response from Redis server + * @var float + */ + protected $readTimeout; + + /** + * Unique identifier for persistent connections + * @var string + */ + protected $persistent; + + /** + * @var bool + */ + protected $closeOnDestruct = TRUE; + + /** + * @var bool + */ + protected $connected = FALSE; + + /** + * @var bool + */ + protected $standalone; + + /** + * @var int + */ + protected $maxConnectRetries = 0; + + /** + * @var int + */ + protected $connectFailures = 0; + + /** + * @var bool + */ + protected $usePipeline = FALSE; + + /** + * @var array + */ + protected $commandNames; + + /** + * @var string + */ + protected $commands; + + /** + * @var bool + */ + protected $isMulti = FALSE; + + /** + * @var bool + */ + protected $isWatching = FALSE; + + /** + * @var string + */ + protected $authUsername; + + /** + * @var string + */ + protected $authPassword; + + /** + * @var int + */ + protected $selectedDb = 0; + + /** + * Aliases for backwards compatibility with phpredis + * @var array + */ + protected $wrapperMethods = array('delete' => 'del', 'getkeys' => 'keys', 'sremove' => 'srem'); + + /** + * @var array + */ + protected $renamedCommands; + + /** + * @var int + */ + protected $requests = 0; + + /** + * @var bool + */ + protected $subscribed = false; + + + /** + * Creates a Redisent connection to the Redis server on host {@link $host} and port {@link $port}. + * $host may also be a path to a unix socket or a string in the form of tcp://[hostname]:[port] or unix://[path] + * + * @param string $host The hostname of the Redis server + * @param integer $port The port number of the Redis server + * @param float $timeout Timeout period in seconds + * @param string $persistent Flag to establish persistent connection + * @param int $db The selected datbase of the Redis server + * @param string $password The authentication password of the Redis server + * @param string $username The authentication username of the Redis server + */ + public function __construct($host = '127.0.0.1', $port = 6379, $timeout = null, $persistent = '', $db = 0, $password = null, $username = null) + { + $this->host = (string) $host; + $this->port = (int) $port; + $this->scheme = null; + $this->timeout = $timeout; + $this->persistent = (string) $persistent; + $this->standalone = ! extension_loaded('redis'); + $this->authPassword = $password; + $this->authUsername = $username; + $this->selectedDb = (int)$db; + $this->convertHost(); + // PHP Redis extension support TLS/ACL AUTH since 5.3.0 + if (( + $this->scheme === 'tls' + || $this->authUsername !== null + ) + && !$this->standalone && version_compare(phpversion('redis'),'5.3.0','<')){ + $this->standalone = true; + } + } + + public function __destruct() + { + if ($this->closeOnDestruct) { + $this->close(); + } + } + + /** + * @return bool + */ + public function isSubscribed() + { + return $this->subscribed; + } + + /** + * Return the host of the Redis instance + * @return string + */ + public function getHost() + { + return $this->host; + } + /** + * Return the port of the Redis instance + * @return int|null + */ + public function getPort() + { + return $this->port; + } + + /** + * Return the selected database + * @return int + */ + public function getSelectedDb() + { + return $this->selectedDb; + } + /** + * @return string + */ + public function getPersistence() + { + return $this->persistent; + } + /** + * @throws CredisException + * @return Credis_Client + */ + public function forceStandalone() + { + if ($this->standalone) { + return $this; + } + if($this->connected) { + throw new CredisException('Cannot force Credis_Client to use standalone PHP driver after a connection has already been established.'); + } + $this->standalone = TRUE; + return $this; + } + + /** + * @param int $retries + * @return Credis_Client + */ + public function setMaxConnectRetries($retries) + { + $this->maxConnectRetries = $retries; + return $this; + } + + /** + * @param bool $flag + * @return Credis_Client + */ + public function setCloseOnDestruct($flag) + { + $this->closeOnDestruct = $flag; + return $this; + } + protected function convertHost() + { + if (preg_match('#^(tcp|tls|unix)://(.*)$#', $this->host, $matches)) { + if($matches[1] == 'tcp' || $matches[1] == 'tls') { + $this->scheme = $matches[1]; + if ( ! preg_match('#^([^:]+)(:([0-9]+))?(/(.+))?$#', $matches[2], $matches)) { + throw new CredisException('Invalid host format; expected '.$this->scheme.'://host[:port][/persistence_identifier]'); + } + $this->host = $matches[1]; + $this->port = (int) (isset($matches[3]) ? $matches[3] : $this->port); + $this->persistent = isset($matches[5]) ? $matches[5] : $this->persistent; + } else { + $this->host = $matches[2]; + $this->port = NULL; + $this->scheme = 'unix'; + if (substr($this->host,0,1) != '/') { + throw new CredisException('Invalid unix socket format; expected unix:///path/to/redis.sock'); + } + } + } + if ($this->port !== NULL && substr($this->host,0,1) == '/') { + $this->port = NULL; + $this->scheme = 'unix'; + } + if (!$this->scheme) { + $this->scheme = 'tcp'; + } + } + /** + * @throws CredisException + * @return Credis_Client + */ + public function connect() + { + if ($this->connected) { + return $this; + } + $this->close(true); + + if ($this->standalone) { + $flags = STREAM_CLIENT_CONNECT; + $remote_socket = $this->port === NULL + ? $this->scheme.'://'.$this->host + : $this->scheme.'://'.$this->host.':'.$this->port; + if ($this->persistent && $this->port !== NULL) { + // Persistent connections to UNIX sockets are not supported + $remote_socket .= '/'.$this->persistent; + $flags = $flags | STREAM_CLIENT_PERSISTENT; + } + $result = $this->redis = @stream_socket_client($remote_socket, $errno, $errstr, $this->timeout !== null ? $this->timeout : 2.5, $flags); + } + else { + if ( ! $this->redis) { + $this->redis = new Redis; + } + $socketTimeout = $this->timeout ? $this->timeout : 0.0; + try + { + $result = $this->persistent + ? $this->redis->pconnect($this->host, (int)$this->port, $socketTimeout, $this->persistent) + : $this->redis->connect($this->host, (int)$this->port, $socketTimeout); + } + catch(Exception $e) + { + // Some applications will capture the php error that phpredis can sometimes generate and throw it as an Exception + $result = false; + $errno = 1; + $errstr = $e->getMessage(); + } + } + + // Use recursion for connection retries + if ( ! $result) { + $this->connectFailures++; + if ($this->connectFailures <= $this->maxConnectRetries) { + return $this->connect(); + } + $failures = $this->connectFailures; + $this->connectFailures = 0; + throw new CredisException("Connection to Redis {$this->host}:{$this->port} failed after $failures failures." . (isset($errno) && isset($errstr) ? "Last Error : ({$errno}) {$errstr}" : "")); + } + + $this->connectFailures = 0; + $this->connected = TRUE; + + // Set read timeout + if ($this->readTimeout) { + $this->setReadTimeout($this->readTimeout); + } + if($this->authPassword) { + $this->auth($this->authPassword, $this->authUsername); + } + if($this->selectedDb !== 0) { + $this->select($this->selectedDb); + } + return $this; + } + /** + * @return bool + */ + public function isConnected() + { + return $this->connected; + } + /** + * Set the read timeout for the connection. Use 0 to disable timeouts entirely (or use a very long timeout + * if not supported). + * + * @param int $timeout 0 (or -1) for no timeout, otherwise number of seconds + * @throws CredisException + * @return Credis_Client + */ + public function setReadTimeout($timeout) + { + if ($timeout < -1) { + throw new CredisException('Timeout values less than -1 are not accepted.'); + } + $this->readTimeout = $timeout; + if ($this->isConnected()) { + if ($this->standalone) { + $timeout = $timeout <= 0 ? 315360000 : $timeout; // Ten-year timeout + stream_set_blocking($this->redis, TRUE); + stream_set_timeout($this->redis, (int) floor($timeout), ($timeout - floor($timeout)) * 1000000); + } else if (defined('Redis::OPT_READ_TIMEOUT')) { + // supported in phpredis 2.2.3 + // a timeout value of -1 means reads will not timeout + $timeout = $timeout == 0 ? -1 : $timeout; + $this->redis->setOption(Redis::OPT_READ_TIMEOUT, $timeout); + } + } + return $this; + } + + /** + * @return bool + */ + public function close($force = FALSE) + { + $result = TRUE; + if ($this->redis && ($force || $this->connected && ! $this->persistent)) { + try { + if (is_callable(array($this->redis, 'close'))) { + $this->redis->close(); + } else { + @fclose($this->redis); + $this->redis = null; + } + } catch (Exception $e) { + ; // Ignore exceptions on close + } + $this->connected = $this->usePipeline = $this->isMulti = $this->isWatching = FALSE; + } + return $result; + } + + /** + * Enabled command renaming and provide mapping method. Supported methods are: + * + * 1. renameCommand('foo') // Salted md5 hash for all commands -> md5('foo'.$command) + * 2. renameCommand(function($command){ return 'my'.$command; }); // Callable + * 3. renameCommand('get', 'foo') // Single command -> alias + * 4. renameCommand(['get' => 'foo', 'set' => 'bar']) // Full map of [command -> alias] + * + * @param string|callable|array $command + * @param string|null $alias + * @return $this + */ + public function renameCommand($command, $alias = NULL) + { + if ( ! $this->standalone) { + $this->forceStandalone(); + } + if ($alias === NULL) { + $this->renamedCommands = $command; + } else { + if ( ! $this->renamedCommands) { + $this->renamedCommands = array(); + } + $this->renamedCommands[$command] = $alias; + } + return $this; + } + + /** + * @param $command + * @return string + */ + public function getRenamedCommand($command) + { + static $map; + + // Command renaming not enabled + if ($this->renamedCommands === NULL) { + return $command; + } + + // Initialize command map + if ($map === NULL) { + if (is_array($this->renamedCommands)) { + $map = $this->renamedCommands; + } else { + $map = array(); + } + } + + // Generate and return cached result + if ( ! isset($map[$command])) { + // String means all commands are hashed with salted md5 + if (is_string($this->renamedCommands)) { + $map[$command] = md5($this->renamedCommands.$command); + } + // Would already be set in $map if it was intended to be renamed + else if (is_array($this->renamedCommands)) { + return $command; + } + // User-supplied function + else if (is_callable($this->renamedCommands)) { + $map[$command] = call_user_func($this->renamedCommands, $command); + } + } + return $map[$command]; + } + + /** + * @param string $password + * @param string|null $username + * @return bool + */ + public function auth($password, $username = null) + { + if ($username !== null) { + $response = $this->__call('auth', array($username, $password)); + $this->authUsername= $username; + } else { + $response = $this->__call('auth', array($password)); + } + $this->authPassword = $password; + return $response; + } + + /** + * @param int $index + * @return bool + */ + public function select($index) + { + $response = $this->__call('select', array($index)); + $this->selectedDb = (int) $index; + return $response; + } + + /** + * @param string|array $pattern + * @return array + */ + public function pUnsubscribe() + { + list($command, $channel, $subscribedChannels) = $this->__call('punsubscribe', func_get_args()); + $this->subscribed = $subscribedChannels > 0; + return array($command, $channel, $subscribedChannels); + } + + /** + * @param int $Iterator + * @param string $pattern + * @param int $count + * @return bool|array + */ + public function scan(&$Iterator, $pattern = null, $count = null) + { + return $this->__call('scan', array(&$Iterator, $pattern, $count)); + } + + /** + * @param int $Iterator + * @param string $field + * @param string $pattern + * @param int $count + * @return bool|array + */ + public function hscan(&$Iterator, $field, $pattern = null, $count = null) + { + return $this->__call('hscan', array($field, &$Iterator, $pattern, $count)); + } + + /** + * @param int $Iterator + * @param string $field + * @param string $pattern + * @param int $Iterator + * @return bool|array + */ + public function sscan(&$Iterator, $field, $pattern = null, $count = null) + { + return $this->__call('sscan', array($field, &$Iterator, $pattern, $count)); + } + + /** + * @param int $Iterator + * @param string $field + * @param string $pattern + * @param int $Iterator + * @return bool|array + */ + public function zscan(&$Iterator, $field, $pattern = null, $count = null) + { + return $this->__call('zscan', array($field, &$Iterator, $pattern, $count)); + } + + /** + * @param string|array $patterns + * @param $callback + * @return $this|array|bool|Credis_Client|mixed|null|string + * @throws CredisException + */ + public function pSubscribe($patterns, $callback) + { + if ( ! $this->standalone) { + return $this->__call('pSubscribe', array((array)$patterns, $callback)); + } + + // Standalone mode: use infinite loop to subscribe until timeout + $patternCount = is_array($patterns) ? count($patterns) : 1; + while ($patternCount--) { + if (isset($status)) { + list($command, $pattern, $status) = $this->read_reply(); + } else { + list($command, $pattern, $status) = $this->__call('psubscribe', array($patterns)); + } + $this->subscribed = $status > 0; + if ( ! $status) { + throw new CredisException('Invalid pSubscribe response.'); + } + } + while ($this->subscribed) { + list($type, $pattern, $channel, $message) = $this->read_reply(); + if ($type != 'pmessage') { + throw new CredisException('Received non-pmessage reply.'); + } + $callback($this, $pattern, $channel, $message); + } + return null; + } + + /** + * @param string|array $pattern + * @return array + */ + public function unsubscribe() + { + list($command, $channel, $subscribedChannels) = $this->__call('unsubscribe', func_get_args()); + $this->subscribed = $subscribedChannels > 0; + return array($command, $channel, $subscribedChannels); + } + + /** + * @param string|array $channels + * @param $callback + * @throws CredisException + * @return $this|array|bool|Credis_Client|mixed|null|string + */ + public function subscribe($channels, $callback) + { + if ( ! $this->standalone) { + return $this->__call('subscribe', array((array)$channels, $callback)); + } + + // Standalone mode: use infinite loop to subscribe until timeout + $channelCount = is_array($channels) ? count($channels) : 1; + while ($channelCount--) { + if (isset($status)) { + list($command, $channel, $status) = $this->read_reply(); + } else { + list($command, $channel, $status) = $this->__call('subscribe', array($channels)); + } + $this->subscribed = $status > 0; + if ( ! $status) { + throw new CredisException('Invalid subscribe response.'); + } + } + while ($this->subscribed) { + list($type, $channel, $message) = $this->read_reply(); + if ($type != 'message') { + throw new CredisException('Received non-message reply.'); + } + $callback($this, $channel, $message); + } + return null; + } + + /** + * @param string|null $name + * @return string|Credis_Client + */ + public function ping($name = null) + { + return $this->__call('ping', $name ? array($name) : array()); + } + + /** + * @param string $command + * @param array $args + * + * @return array|Credis_Client + */ + public function rawCommand($command, array $args) + { + if($this->standalone) + { + return $this->__call($command, $args); + } + else + { + \array_unshift($args, $command); + return $this->__call('rawCommand', $args); + } + } + + public function __call($name, $args) + { + // Lazy connection + $this->connect(); + + $name = strtolower($name); + + // Send request via native PHP + if($this->standalone) + { + $trackedArgs = array(); + switch ($name) { + case 'eval': + case 'evalsha': + $script = array_shift($args); + $keys = (array) array_shift($args); + $eArgs = (array) array_shift($args); + $args = array($script, count($keys), $keys, $eArgs); + break; + case 'zinterstore': + case 'zunionstore': + $dest = array_shift($args); + $keys = (array) array_shift($args); + $weights = array_shift($args); + $aggregate = array_shift($args); + $args = array($dest, count($keys), $keys); + if ($weights) { + $args[] = (array) $weights; + } + if ($aggregate) { + $args[] = $aggregate; + } + break; + case 'set': + // The php redis module has different behaviour with ttl + // https://github.com/phpredis/phpredis#set + if (count($args) === 3 && is_int($args[2])) { + $args = array($args[0], $args[1], array('EX', $args[2])); + } elseif (count($args) === 3 && is_array($args[2])) { + $tmp_args = $args; + $args = array($tmp_args[0], $tmp_args[1]); + foreach ($tmp_args[2] as $k=>$v) { + if (is_string($k)) { + $args[] = array($k,$v); + } elseif (is_int($k)) { + $args[] = $v; + } + } + unset($tmp_args); + } + break; + case 'scan': + $trackedArgs = array(&$args[0]); + if (empty($trackedArgs[0])) + { + $trackedArgs[0] = 0; + } + $eArgs = array($trackedArgs[0]); + if (!empty($args[1])) + { + $eArgs[] = 'MATCH'; + $eArgs[] = $args[1]; + } + if (!empty($args[2])) + { + $eArgs[] = 'COUNT'; + $eArgs[] = $args[2]; + } + $args = $eArgs; + break; + case 'sscan': + case 'zscan': + case 'hscan': + $trackedArgs = array(&$args[1]); + if (empty($trackedArgs[0])) + { + $trackedArgs[0] = 0; + } + $eArgs = array($args[0],$trackedArgs[0]); + if (!empty($args[2])) + { + $eArgs[] = 'MATCH'; + $eArgs[] = $args[2]; + } + if (!empty($args[3])) + { + $eArgs[] = 'COUNT'; + $eArgs[] = $args[3]; + } + $args = $eArgs; + break; + case 'zrangebyscore': + case 'zrevrangebyscore': + case 'zrange': + case 'zrevrange': + if (isset($args[3]) && is_array($args[3])) { + // map options + $cArgs = array(); + if (!empty($args[3]['withscores'])) { + $cArgs[] = 'withscores'; + } + if (($name == 'zrangebyscore' || $name == 'zrevrangebyscore') && array_key_exists('limit', $args[3])) { + $cArgs[] = array('limit' => $args[3]['limit']); + } + $args[3] = $cArgs; + $trackedArgs = $cArgs; + } + break; + case 'mget': + if (isset($args[0]) && is_array($args[0])) + { + $args = array_values($args[0]); + } + break; + case 'hmset': + if (isset($args[1]) && is_array($args[1])) + { + $cArgs = array(); + foreach($args[1] as $id => $value) + { + $cArgs[] = $id; + $cArgs[] = $value; + } + $args[1] = $cArgs; + } + break; + case 'zsize': + $name = 'zcard'; + break; + case 'zdelete': + $name = 'zrem'; + break; + case 'hmget': + // hmget needs to track the keys for rehydrating the results + if (isset($args[1])) + { + $trackedArgs = $args[1]; + } + break; + } + // Flatten arguments + $args = self::_flattenArguments($args); + + // In pipeline mode + if($this->usePipeline) + { + if($name === 'pipeline') { + throw new CredisException('A pipeline is already in use and only one pipeline is supported.'); + } + else if($name === 'exec') { + if($this->isMulti) { + $this->commandNames[] = array($name, $trackedArgs); + $this->commands .= self::_prepare_command(array($this->getRenamedCommand($name))); + } + + // Write request + if($this->commands) { + $this->write_command($this->commands); + } + $this->commands = NULL; + + // Read response + $queuedResponses = array(); + $response = array(); + foreach($this->commandNames as $command) { + list($name, $arguments) = $command; + $result = $this->read_reply($name, true); + if ($result !== null) + { + $result = $this->decode_reply($name, $result, $arguments); + } + else + { + $queuedResponses[] = $command; + } + $response[] = $result; + } + + if($this->isMulti) { + $response = array_pop($response); + foreach($queuedResponses as $key => $command) + { + list($name, $arguments) = $command; + $response[$key] = $this->decode_reply($name, $response[$key], $arguments); + } + } + + $this->commandNames = NULL; + $this->usePipeline = $this->isMulti = FALSE; + return $response; + } + else if ($name === 'discard') + { + $this->commands = NULL; + $this->commandNames = NULL; + $this->usePipeline = $this->isMulti = FALSE; + } + else { + if($name === 'multi') { + $this->isMulti = TRUE; + } + array_unshift($args, $this->getRenamedCommand($name)); + $this->commandNames[] = array($name, $trackedArgs); + $this->commands .= self::_prepare_command($args); + return $this; + } + } + + // Start pipeline mode + if($name === 'pipeline') + { + $this->usePipeline = TRUE; + $this->commandNames = array(); + $this->commands = ''; + return $this; + } + + // If unwatching, allow reconnect with no error thrown + if($name === 'unwatch') { + $this->isWatching = FALSE; + } + + // Non-pipeline mode + array_unshift($args, $this->getRenamedCommand($name)); + $command = self::_prepare_command($args); + $this->write_command($command); + $response = $this->read_reply($name); + $response = $this->decode_reply($name, $response, $trackedArgs); + + // Watch mode disables reconnect so error is thrown + if($name == 'watch') { + $this->isWatching = TRUE; + } + // Transaction mode + else if($this->isMulti && ($name == 'exec' || $name == 'discard')) { + $this->isMulti = FALSE; + } + // Started transaction + else if($this->isMulti || $name == 'multi') { + $this->isMulti = TRUE; + $response = $this; + } + } + + // Send request via phpredis client + else + { + // Tweak arguments + switch($name) { + case 'get': // optimize common cases + case 'set': + case 'hget': + case 'hset': + case 'setex': + case 'mset': + case 'msetnx': + case 'hmset': + case 'hmget': + case 'del': + case 'zrangebyscore': + case 'zrevrangebyscore': + break; + case 'zrange': + case 'zrevrange': + if (isset($args[3]) && is_array($args[3])) + { + $cArgs = $args[3]; + $args[3] = !empty($cArgs['withscores']); + } + $args = self::_flattenArguments($args); + break; + case 'zinterstore': + case 'zunionstore': + $cArgs = array(); + $cArgs[] = array_shift($args); // destination + $cArgs[] = array_shift($args); // keys + if(isset($args[0]) and isset($args[0]['weights'])) { + $cArgs[] = (array) $args[0]['weights']; + } else { + $cArgs[] = null; + } + if(isset($args[0]) and isset($args[0]['aggregate'])) { + $cArgs[] = strtoupper($args[0]['aggregate']); + } + $args = $cArgs; + break; + case 'mget': + if(isset($args[0]) && ! is_array($args[0])) { + $args = array($args); + } + break; + case 'lrem': + $args = array($args[0], $args[2], $args[1]); + break; + case 'eval': + case 'evalsha': + if (isset($args[1]) && is_array($args[1])) { + $cKeys = $args[1]; + } elseif (isset($args[1]) && is_string($args[1])) { + $cKeys = array($args[1]); + } else { + $cKeys = array(); + } + if (isset($args[2]) && is_array($args[2])) { + $cArgs = $args[2]; + } elseif (isset($args[2]) && is_string($args[2])) { + $cArgs = array($args[2]); + } else { + $cArgs = array(); + } + $args = array($args[0], array_merge($cKeys, $cArgs), count($cKeys)); + break; + case 'subscribe': + case 'psubscribe': + break; + case 'scan': + case 'sscan': + case 'hscan': + case 'zscan': + // allow phpredis to see the caller's reference + //$param_ref =& $args[0]; + break; + case 'auth': + // For phpredis pre-v5.3, the type signature is string, not array|string + $args = (is_array($args) && count($args) === 1) ? $args : array($args); + break; + default: + // Flatten arguments + $args = self::_flattenArguments($args); + } + + try { + // Proxy pipeline mode to the phpredis library + if($name == 'pipeline' || $name == 'multi') { + if($this->isMulti) { + return $this; + } else { + $this->isMulti = TRUE; + $this->redisMulti = call_user_func_array(array($this->redis, $name), $args); + return $this; + } + } + else if($name == 'exec' || $name == 'discard') { + $this->isMulti = FALSE; + $response = $this->redisMulti->$name(); + $this->redisMulti = NULL; + #echo "> $name : ".substr(print_r($response, TRUE),0,100)."\n"; + return $response; + } + + // Use aliases to be compatible with phpredis wrapper + if(isset($this->wrapperMethods[$name])) { + $name = $this->wrapperMethods[$name]; + } + + // Multi and pipeline return self for chaining + if($this->isMulti) { + call_user_func_array(array($this->redisMulti, $name), $args); + return $this; + } + + + // Send request, retry one time when using persistent connections on the first request only + $this->requests++; + try { + $response = call_user_func_array(array($this->redis, $name), $args); + } catch (RedisException $e) { + if ($this->persistent && $this->requests == 1 && $e->getMessage() == 'read error on connection') { + $this->close(true); + $this->connect(); + $response = call_user_func_array(array($this->redis, $name), $args); + } else { + throw $e; + } + } + } + // Wrap exceptions + catch(RedisException $e) { + $code = 0; + if ( ! ($result = $this->redis->IsConnected())) { + $this->close(true); + $code = CredisException::CODE_DISCONNECTED; + } + throw new CredisException($e->getMessage(), $code, $e); + } + + #echo "> $name : ".substr(print_r($response, TRUE),0,100)."\n"; + + // change return values where it is too difficult to minim in standalone mode + switch($name) + { + case 'type': + $typeMap = array( + self::TYPE_NONE, + self::TYPE_STRING, + self::TYPE_SET, + self::TYPE_LIST, + self::TYPE_ZSET, + self::TYPE_HASH, + ); + $response = $typeMap[$response]; + break; + + // Handle scripting errors + case 'eval': + case 'evalsha': + case 'script': + $error = $this->redis->getLastError(); + $this->redis->clearLastError(); + if ($error && substr($error,0,8) == 'NOSCRIPT') { + $response = NULL; + } else if ($error) { + throw new CredisException($error); + } + break; + case 'exists': + // smooth over phpredis-v4 vs earlier difference to match documented credis return results + $response = (int) $response; + break; + case 'ping': + if ($response) { + if ($response === true) { + $response = isset($args[0]) ? $args[0] : "PONG"; + } else if ($response[0] === '+') { + $response = substr($response, 1); + } + } + break; + case 'auth': + if (is_bool($response) && $response === true){ + $this->redis->clearLastError(); + } + default: + $error = $this->redis->getLastError(); + $this->redis->clearLastError(); + if ($error) { + throw new CredisException(rtrim($error)); + } + break; + } + } + + return $response; + } + + protected function write_command($command) + { + // Reconnect on lost connection (Redis server "timeout" exceeded since last command) + if(feof($this->redis)) { + // If a watch or transaction was in progress and connection was lost, throw error rather than reconnect + // since transaction/watch state will be lost. + if(($this->isMulti && ! $this->usePipeline) || $this->isWatching) { + $this->close(true); + throw new CredisException('Lost connection to Redis server during watch or transaction.'); + } + $this->close(true); + $this->connect(); + if($this->authPassword) { + $this->auth($this->authPassword); + } + if($this->selectedDb != 0) { + $this->select($this->selectedDb); + } + } + + $commandLen = strlen($command); + $lastFailed = FALSE; + for ($written = 0; $written < $commandLen; $written += $fwrite) { + $fwrite = fwrite($this->redis, substr($command, $written)); + if ($fwrite === FALSE || ($fwrite == 0 && $lastFailed)) { + $this->close(true); + throw new CredisException('Failed to write entire command to stream'); + } + $lastFailed = $fwrite == 0; + } + } + + protected function read_reply($name = '', $returnQueued = false) + { + $reply = fgets($this->redis); + if($reply === FALSE) { + $info = stream_get_meta_data($this->redis); + $this->close(true); + if ($info['timed_out']) { + throw new CredisException('Read operation timed out.', CredisException::CODE_TIMED_OUT); + } else { + throw new CredisException('Lost connection to Redis server.', CredisException::CODE_DISCONNECTED); + } + } + $reply = rtrim($reply, CRLF); + #echo "> $name: $reply\n"; + $replyType = substr($reply, 0, 1); + switch ($replyType) { + /* Error reply */ + case '-': + if($this->isMulti || $this->usePipeline) { + $response = FALSE; + } else if ($name == 'evalsha' && substr($reply,0,9) == '-NOSCRIPT') { + $response = NULL; + } else { + throw new CredisException(substr($reply,0,4) == '-ERR' ? 'ERR '.substr($reply, 5) : substr($reply,1)); + } + break; + /* Inline reply */ + case '+': + $response = substr($reply, 1); + if($response == 'OK') { + return TRUE; + } + if($response == 'QUEUED') { + return $returnQueued ? null : true; + } + break; + /* Bulk reply */ + case '$': + if ($reply == '$-1') return FALSE; + $size = (int) substr($reply, 1); + $response = stream_get_contents($this->redis, $size + 2); + if( ! $response) { + $this->close(true); + throw new CredisException('Error reading reply.'); + } + $response = substr($response, 0, $size); + break; + /* Multi-bulk reply */ + case '*': + $count = substr($reply, 1); + if ($count == '-1') return FALSE; + + $response = array(); + for ($i = 0; $i < $count; $i++) { + $response[] = $this->read_reply(); + } + break; + /* Integer reply */ + case ':': + $response = intval(substr($reply, 1)); + break; + default: + throw new CredisException('Invalid response: '.print_r($reply, TRUE)); + break; + } + + return $response; + } + + protected function decode_reply($name, $response, array &$arguments = array() ) + { + // Smooth over differences between phpredis and standalone response + switch ($name) + { + case '': // Minor optimization for multi-bulk replies + break; + case 'config': + case 'hgetall': + $keys = $values = array(); + while ($response) + { + $keys[] = array_shift($response); + $values[] = array_shift($response); + } + $response = count($keys) ? array_combine($keys, $values) : array(); + break; + case 'info': + $lines = explode(CRLF, trim($response, CRLF)); + $response = array(); + foreach ($lines as $line) + { + if (!$line || substr($line, 0, 1) == '#') + { + continue; + } + list($key, $value) = explode(':', $line, 2); + $response[$key] = $value; + } + break; + case 'ttl': + if ($response === -1) + { + $response = false; + } + break; + case 'hmget': + if (count($arguments) != count($response)) + { + throw new CredisException( + 'hmget arguments and response do not match: ' . print_r($arguments, true) . ' ' . print_r( + $response, true + ) + ); + } + // rehydrate results into key => value form + $response = array_combine($arguments, $response); + break; + + case 'scan': + case 'sscan': + $arguments[0] = intval(array_shift($response)); + $response = empty($response[0]) ? array() : $response[0]; + break; + case 'hscan': + case 'zscan': + $arguments[0] = intval(array_shift($response)); + $response = empty($response[0]) ? array() : $response[0]; + if (!empty($response) && is_array($response)) + { + $count = count($response); + $out = array(); + for ($i = 0; $i < $count; $i += 2) + { + $out[$response[$i]] = $response[$i + 1]; + } + $response = $out; + } + break; + case 'zrangebyscore': + case 'zrevrangebyscore': + case 'zrange': + case 'zrevrange': + if (in_array('withscores', $arguments, true)) + { + // Map array of values into key=>score list like phpRedis does + $item = null; + $out = array(); + foreach ($response as $value) + { + if ($item == null) + { + $item = $value; + } + else + { + // 2nd value is the score + $out[$item] = (float)$value; + $item = null; + } + } + $response = $out; + } + break; + } + + return $response; + } + + /** + * Build the Redis unified protocol command + * + * @param array $args + * @return string + */ + private static function _prepare_command($args) + { + return sprintf('*%d%s%s%s', count($args), CRLF, implode(CRLF, array_map(array('self', '_map'), $args)), CRLF); + } + + private static function _map($arg) + { + return sprintf('$%d%s%s', strlen($arg), CRLF, $arg); + } + + /** + * Flatten arguments + * + * If an argument is an array, the key is inserted as argument followed by the array values + * array('zrangebyscore', '-inf', 123, array('limit' => array('0', '1'))) + * becomes + * array('zrangebyscore', '-inf', 123, 'limit', '0', '1') + * + * @param array $in + * @return array + */ + private static function _flattenArguments(array $arguments, &$out = array()) + { + foreach ($arguments as $key => $arg) { + if (!is_int($key)) { + $out[] = $key; + } + + if (is_array($arg)) { + self::_flattenArguments($arg, $out); + } else { + $out[] = $arg; + } + } + + return $out; + } +} diff --git a/system/vendor/colinmollenhour/credis/Cluster.php b/system/vendor/colinmollenhour/credis/Cluster.php new file mode 100644 index 0000000..eda43b8 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/Cluster.php @@ -0,0 +1,343 @@ + + * @copyright 2009 Justin Poliey + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @package Credis + */ + +/** + * A generalized Credis_Client interface for a cluster of Redis servers + * + * @deprecated + */ +class Credis_Cluster +{ + /** + * Collection of Credis_Client objects attached to Redis servers + * @var Credis_Client[] + */ + protected $clients; + /** + * If a server is set as master, all write commands go to that one + * @var Credis_Client + */ + protected $masterClient; + /** + * Aliases of Credis_Client objects attached to Redis servers, used to route commands to specific servers + * @see Credis_Cluster::to + * @var array + */ + protected $aliases; + + /** + * Hash ring of Redis server nodes + * @var array + */ + protected $ring; + + /** + * Individual nodes of pointers to Redis servers on the hash ring + * @var array + */ + protected $nodes; + + /** + * The commands that are not subject to hashing + * @var array + * @access protected + */ + protected $dont_hash; + + /** + * Currently working cluster-wide database number. + * @var int + */ + protected $selectedDb = 0; + + /** + * Creates an interface to a cluster of Redis servers + * Each server should be in the format: + * array( + * 'host' => hostname, + * 'port' => port, + * 'db' => db, + * 'password' => password, + * 'timeout' => timeout, + * 'alias' => alias, + * 'persistent' => persistence_identifier, + * 'master' => master + * 'write_only'=> true/false + * ) + * + * @param array $servers The Redis servers in the cluster. + * @param int $replicas + * @param bool $standAlone + * @throws CredisException + */ + public function __construct($servers, $replicas = 128, $standAlone = false) + { + $this->clients = array(); + $this->masterClient = null; + $this->aliases = array(); + $this->ring = array(); + $this->replicas = (int)$replicas; + $client = null; + foreach ($servers as $server) + { + if(is_array($server)){ + $client = new Credis_Client( + $server['host'], + $server['port'], + isset($server['timeout']) ? $server['timeout'] : 2.5, + isset($server['persistent']) ? $server['persistent'] : '', + isset($server['db']) ? $server['db'] : 0, + isset($server['password']) ? $server['password'] : null + ); + if (isset($server['alias'])) { + $this->aliases[$server['alias']] = $client; + } + if(isset($server['master']) && $server['master'] === true){ + $this->masterClient = $client; + if(isset($server['write_only']) && $server['write_only'] === true){ + continue; + } + } + } elseif($server instanceof Credis_Client){ + $client = $server; + } else { + throw new CredisException('Server should either be an array or an instance of Credis_Client'); + } + if($standAlone) { + $client->forceStandalone(); + } + $this->clients[] = $client; + for ($replica = 0; $replica <= $this->replicas; $replica++) { + $md5num = hexdec(substr(md5($client->getHost().':'.$client->getPort().'-'.$replica),0,7)); + $this->ring[$md5num] = count($this->clients)-1; + } + } + ksort($this->ring, SORT_NUMERIC); + $this->nodes = array_keys($this->ring); + $this->dont_hash = array_flip(array( + 'RANDOMKEY', 'DBSIZE', 'PIPELINE', 'EXEC', + 'SELECT', 'MOVE', 'FLUSHDB', 'FLUSHALL', + 'SAVE', 'BGSAVE', 'LASTSAVE', 'SHUTDOWN', + 'INFO', 'MONITOR', 'SLAVEOF' + )); + if($this->masterClient !== null && count($this->clients()) == 0){ + $this->clients[] = $this->masterClient; + for ($replica = 0; $replica <= $this->replicas; $replica++) { + $md5num = hexdec(substr(md5($this->masterClient->getHost().':'.$this->masterClient->getHost().'-'.$replica),0,7)); + $this->ring[$md5num] = count($this->clients)-1; + } + $this->nodes = array_keys($this->ring); + } + } + + /** + * @param Credis_Client $masterClient + * @param bool $writeOnly + * @return Credis_Cluster + */ + public function setMasterClient(Credis_Client $masterClient, $writeOnly=false) + { + if(!$masterClient instanceof Credis_Client){ + throw new CredisException('Master client should be an instance of Credis_Client'); + } + $this->masterClient = $masterClient; + if (!isset($this->aliases['master'])) { + $this->aliases['master'] = $masterClient; + } + if(!$writeOnly){ + $this->clients[] = $this->masterClient; + for ($replica = 0; $replica <= $this->replicas; $replica++) { + $md5num = hexdec(substr(md5($this->masterClient->getHost().':'.$this->masterClient->getHost().'-'.$replica),0,7)); + $this->ring[$md5num] = count($this->clients)-1; + } + $this->nodes = array_keys($this->ring); + } + return $this; + } + /** + * Get a client by index or alias. + * + * @param string|int $alias + * @throws CredisException + * @return Credis_Client + */ + public function client($alias) + { + if (is_int($alias) && isset($this->clients[$alias])) { + return $this->clients[$alias]; + } + else if (isset($this->aliases[$alias])) { + return $this->aliases[$alias]; + } + throw new CredisException("Client $alias does not exist."); + } + + /** + * Get an array of all clients + * + * @return array|Credis_Client[] + */ + public function clients() + { + return $this->clients; + } + + /** + * Execute a command on all clients + * + * @return array + */ + public function all() + { + $args = func_get_args(); + $name = array_shift($args); + $results = array(); + foreach($this->clients as $client) { + $results[] = call_user_func_array([$client, $name], $args); + } + return $results; + } + + /** + * Get the client that the key would hash to. + * + * @param string $key + * @return \Credis_Client + */ + public function byHash($key) + { + return $this->clients[$this->hash($key)]; + } + + /** + * @param int $index + * @return void + */ + public function select($index) + { + $this->selectedDb = (int) $index; + } + + /** + * Execute a Redis command on the cluster with automatic consistent hashing and read/write splitting + * + * @param string $name + * @param array $args + * @return mixed + */ + public function __call($name, $args) + { + if($this->masterClient !== null && !$this->isReadOnlyCommand($name)){ + $client = $this->masterClient; + }elseif (count($this->clients()) == 1 || isset($this->dont_hash[strtoupper($name)]) || !isset($args[0])) { + $client = $this->clients[0]; + } + else { + $hashKey = $args[0]; + if (is_array($hashKey)) { + $hashKey = join('|', $hashKey); + } + $client = $this->byHash($hashKey); + } + // Ensure that current client is working on the same database as expected. + if ($client->getSelectedDb() != $this->selectedDb) { + $client->select($this->selectedDb); + } + return call_user_func_array([$client, $name], $args); + } + + /** + * Get client index for a key by searching ring with binary search + * + * @param string $key The key to hash + * @return int The index of the client object associated with the hash of the key + */ + public function hash($key) + { + $needle = hexdec(substr(md5($key),0,7)); + $server = $min = 0; + $max = count($this->nodes) - 1; + while ($max >= $min) { + $position = (int) (($min + $max) / 2); + $server = $this->nodes[$position]; + if ($needle < $server) { + $max = $position - 1; + } + else if ($needle > $server) { + $min = $position + 1; + } + else { + break; + } + } + return $this->ring[$server]; + } + + public function isReadOnlyCommand($command) + { + static $readOnlyCommands = array( + 'DBSIZE' => true, + 'INFO' => true, + 'MONITOR' => true, + 'EXISTS' => true, + 'TYPE' => true, + 'KEYS' => true, + 'SCAN' => true, + 'RANDOMKEY' => true, + 'TTL' => true, + 'GET' => true, + 'MGET' => true, + 'SUBSTR' => true, + 'STRLEN' => true, + 'GETRANGE' => true, + 'GETBIT' => true, + 'LLEN' => true, + 'LRANGE' => true, + 'LINDEX' => true, + 'SCARD' => true, + 'SISMEMBER' => true, + 'SINTER' => true, + 'SUNION' => true, + 'SDIFF' => true, + 'SMEMBERS' => true, + 'SSCAN' => true, + 'SRANDMEMBER' => true, + 'ZRANGE' => true, + 'ZREVRANGE' => true, + 'ZRANGEBYSCORE' => true, + 'ZREVRANGEBYSCORE' => true, + 'ZCARD' => true, + 'ZSCORE' => true, + 'ZCOUNT' => true, + 'ZRANK' => true, + 'ZREVRANK' => true, + 'ZSCAN' => true, + 'HGET' => true, + 'HMGET' => true, + 'HEXISTS' => true, + 'HLEN' => true, + 'HKEYS' => true, + 'HVALS' => true, + 'HGETALL' => true, + 'HSCAN' => true, + 'PING' => true, + 'AUTH' => true, + 'SELECT' => true, + 'ECHO' => true, + 'QUIT' => true, + 'OBJECT' => true, + 'BITCOUNT' => true, + 'TIME' => true, + 'SORT' => true, + ); + return array_key_exists(strtoupper($command), $readOnlyCommands); + } +} + diff --git a/system/vendor/colinmollenhour/credis/LICENSE b/system/vendor/colinmollenhour/credis/LICENSE new file mode 100644 index 0000000..c0a2f41 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2009 Justin Poliey +Copyright (c) 2011 Colin Mollenhour + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/system/vendor/colinmollenhour/credis/Module.php b/system/vendor/colinmollenhour/credis/Module.php new file mode 100644 index 0000000..70b9ba9 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/Module.php @@ -0,0 +1,68 @@ + + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @package Credis_Module + */ +class Credis_Module +{ + const MODULE_COUNTING_BLOOM_FILTER = 'CBF'; + + /** @var Credis_Client */ + protected $client; + + /** @var string */ + protected $moduleName; + + /** + * @param Credis_Client $client + * @param string $module + */ + public function __construct(Credis_Client $client, $module = null) + { + $client->forceStandalone(); // Redis Modules command not currently supported by phpredis + $this->client = $client; + + if (isset($module)) { + $this->setModule($module); + } + } + + /** + * Clean up client on destruct + */ + public function __destruct() + { + $this->client->close(); + } + + /** + * @param $moduleName + * @return $this + */ + public function setModule($moduleName) + { + $this->moduleName = (string) $moduleName; + + return $this; + } + + /** + * @param string $name + * @param string $args + * @return mixed + */ + public function __call($name, $args) + { + if ($this->moduleName === null) { + throw new \LogicException('Module must be set.'); + } + + return call_user_func(array($this->client, sprintf('%s.%s', $this->moduleName, $name)), $args); + } +} diff --git a/system/vendor/colinmollenhour/credis/README.markdown b/system/vendor/colinmollenhour/credis/README.markdown new file mode 100644 index 0000000..bf1c8e9 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/README.markdown @@ -0,0 +1,206 @@ +![Build Status](https://github.com/colinmollenhour/credis/actions/workflows/ci.yml/badge.svg) + +# Credis + +Credis is a lightweight interface to the [Redis](http://redis.io/) key-value store which wraps the [phpredis](https://github.com/nicolasff/phpredis) +library when available for better performance. This project was forked from one of the many redisent forks. + +## Getting Started + +Credis_Client uses methods named the same as Redis commands, and translates return values to the appropriate +PHP equivalents. + +```php +require 'Credis/Client.php'; +$redis = new Credis_Client('localhost'); +$redis->set('awesome', 'absolutely'); +echo sprintf('Is Credis awesome? %s.\n', $redis->get('awesome')); + +// When arrays are given as arguments they are flattened automatically +$redis->rpush('particles', array('proton','electron','neutron')); +$particles = $redis->lrange('particles', 0, -1); +``` +Redis error responses will be wrapped in a CredisException class and thrown. + +Credis_Client also supports transparent command renaming. Write code using the original command names and the +client will send the aliased commands to the server transparently. Specify the renamed commands using a prefix +for md5, a callable function, individual aliases, or an array map of aliases. See "Redis Security":http://redis.io/topics/security for more info. + +## Supported connection string formats + +```php +$redis = new Credis_Client(/* connection string */); +``` + +### Unix socket connection string + +`unix:///path/to/redis.sock` + +### TCP connection string + +`tcp://host[:port][/persistence_identifier]` + +### TLS connection string + +`tls://host[:port][/persistence_identifier]` + +#### Enable transport level security (TLS) + +Use TLS connection string `tls://127.0.0.1:6379` instead of TCP connection `tcp://127.0.0.1:6379` string in order to enable transport level security. + +```php +require 'Credis/Client.php'; +$redis = new Credis_Client('tls://127.0.0.1:6379'); +$redis->set('awesome', 'absolutely'); +echo sprintf('Is Credis awesome? %s.\n', $redis->get('awesome')); + +// When arrays are given as arguments they are flattened automatically +$redis->rpush('particles', array('proton','electron','neutron')); +$particles = $redis->lrange('particles', 0, -1); +``` + +## Clustering your servers + +Credis also includes a way for developers to fully utilize the scalability of Redis with multiple servers and [consistent hashing](http://en.wikipedia.org/wiki/Consistent_hashing). +Using the [Credis_Cluster](Cluster.php) class, you can use Credis the same way, except that keys will be hashed across multiple servers. +Here is how to set up a cluster: + +### Basic clustering example +```php + '127.0.0.1', 'port' => 6379, 'alias'=>'alpha'), + array('host' => '127.0.0.1', 'port' => 6380, 'alias'=>'beta') +)); +$cluster->set('key','value'); +echo "Alpha: ".$cluster->client('alpha')->get('key').PHP_EOL; +echo "Beta: ".$cluster->client('beta')->get('key').PHP_EOL; +``` + +### Explicit definition of replicas + +The consistent hashing strategy stores keys on a so called "ring". The position of each key is relative to the position of its target node. The target node that has the closest position will be the selected node for that specific key. + +To avoid an uneven distribution of keys (especially on small clusters), it is common to duplicate target nodes. Based on the number of replicas, each target node will exist *n times* on the "ring". + +The following example explicitly sets the number of replicas to 5. Both Redis instances will have 5 copies. The default value is 128. + +```php + '127.0.0.1', 'port' => 6379, 'alias'=>'alpha'), + array('host' => '127.0.0.1', 'port' => 6380, 'alias'=>'beta') + ), 5 +); +$cluster->set('key','value'); +echo "Alpha: ".$cluster->client('alpha')->get('key').PHP_EOL; +echo "Beta: ".$cluster->client('beta')->get('key').PHP_EOL; +``` + +## Master/slave replication + +The [Credis_Cluster](Cluster.php) class can also be used for [master/slave replication](http://redis.io/topics/replication). +Credis_Cluster will automatically perform *read/write splitting* and send the write requests exclusively to the master server. +Read requests will be handled by all servers unless you set the *write_only* flag to true in the connection string of the master server. + +### Redis server settings for master/slave replication + +Setting up master/slave replication is simple and only requires adding the following line to the config of the slave server: + +``` +slaveof 127.0.0.1 6379 +``` + +### Basic master/slave example +```php + '127.0.0.1', 'port' => 6379, 'alias'=>'master', 'master'=>true), + array('host' => '127.0.0.1', 'port' => 6380, 'alias'=>'slave') +)); +$cluster->set('key','value'); +echo $cluster->get('key').PHP_EOL; +echo $cluster->client('slave')->get('key').PHP_EOL; + +$cluster->client('master')->set('key2','value'); +echo $cluster->client('slave')->get('key2').PHP_EOL; +``` + +### No read on master + +The following example illustrates how to disable reading on the master server. This will cause the master server only to be used for writing. +This should only happen when you have enough write calls to create a certain load on the master server. Otherwise this is an inefficient usage of server resources. + +```php + '127.0.0.1', 'port' => 6379, 'alias'=>'master', 'master'=>true, 'write_only'=>true), + array('host' => '127.0.0.1', 'port' => 6380, 'alias'=>'slave') +)); +$cluster->set('key','value'); +echo $cluster->get('key').PHP_EOL; +``` +## Automatic failover with Sentinel + +[Redis Sentinel](http://redis.io/topics/sentinel) is a system that can monitor Redis instances. You register master servers and Sentinel automatically detects its slaves. + +When a master server dies, Sentinel will make sure one of the slaves is promoted to be the new master. This autofailover mechanism will also demote failed masters to avoid data inconsistency. + +The [Credis_Sentinel](Sentinel.php) class interacts with the *Redis Sentinel* instance(s) and acts as a proxy. Sentinel will automatically create [Credis_Cluster](Cluster.php) objects and will set the master and slaves accordingly. + +Sentinel uses the same protocol as Redis. In the example below we register the Sentinel server running on port *26379* and assign it to the [Credis_Sentinel](Sentinel.php) object. +We then ask Sentinel the hostname and port for the master server known as *mymaster*. By calling the *getCluster* method we immediately get a [Credis_Cluster](Cluster.php) object that allows us to perform basic Redis calls. + +```php +getMasterAddressByName('mymaster'); +$cluster = $sentinel->getCluster('mymaster'); + +echo 'Writing to master: '.$masterAddress[0].' on port '.$masterAddress[1].PHP_EOL; +$cluster->set('key','value'); +echo $cluster->get('key').PHP_EOL; +``` +### Additional parameters + +Because [Credis_Sentinel](Sentinel.php) will create [Credis_Cluster](Cluster.php) objects using the *"getCluster"* or *"createCluster"* methods, additional parameters can be passed. + +First of all there's the *"write_only"* flag. You can also define the selected database and the number of replicas. And finally there's a *"selectRandomSlave"* option. + +The *"selectRandomSlave"* flag is used in setups for masters that have multiple slaves. The Credis_Sentinel will either select one random slave to be used when creating the Credis_Cluster object or to pass them all and use the built-in hashing. + +The example below shows how to use these 3 options. It selects database 2, sets the number of replicas to 10, it doesn't select a random slave and doesn't allow reading on the master server. + +```php +getCluster('mymaster',2,10,false,true); +$cluster->set('key','value'); +echo $cluster->get('key').PHP_EOL; +``` + +## About + +© 2011 [Colin Mollenhour](http://colin.mollenhour.com) +© 2009 [Justin Poliey](http://justinpoliey.com) diff --git a/system/vendor/colinmollenhour/credis/Sentinel.php b/system/vendor/colinmollenhour/credis/Sentinel.php new file mode 100644 index 0000000..5a7c2a4 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/Sentinel.php @@ -0,0 +1,367 @@ + + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @package Credis_Sentinel + */ +class Credis_Sentinel +{ + /** + * Contains a client that connects to a Sentinel node. + * Sentinel uses the same protocol as Redis which makes using Credis_Client convenient. + * @var Credis_Client + */ + protected $_client; + + /** + * Contains an active instance of Credis_Cluster per master pool + * @var array + */ + protected $_cluster = array(); + + /** + * Contains an active instance of Credis_Client representing a master + * @var array + */ + protected $_master = array(); + + /** + * Contains an array Credis_Client objects representing all slaves per master pool + * @var array + */ + protected $_slaves = array(); + + /** + * Use the phpredis extension or the standalone implementation + * @var bool + * @deprecated + */ + protected $_standAlone = false; + + /** + * Store the AUTH password used by Credis_Client instances + * @var string + */ + protected $_password = ''; + + /** + * Connect with a Sentinel node. Sentinel will do the master and slave discovery + * + * @param Credis_Client $client + * @param string $password (deprecated - use setClientPassword) + * @throws CredisException + */ + public function __construct(Credis_Client $client, $password = NULL) + { + if(!$client instanceof Credis_Client){ + throw new CredisException('Sentinel client should be an instance of Credis_Client'); + } + $client->forceStandalone(); // SENTINEL command not currently supported by phpredis + $this->_client = $client; + $this->_password = $password; + $this->_timeout = NULL; + $this->_persistent = ''; + $this->_db = 0; + } + + /** + * Clean up client on destruct + */ + public function __destruct() + { + $this->_client->close(); + } + + /** + * @param float $timeout + * @return $this + */ + public function setClientTimeout($timeout) + { + $this->_timeout = $timeout; + return $this; + } + + /** + * @param string $persistent + * @return $this + */ + public function setClientPersistent($persistent) + { + $this->_persistent = $persistent; + return $this; + } + + /** + * @param int $db + * @return $this + */ + public function setClientDatabase($db) + { + $this->_db = $db; + return $this; + } + + /** + * @param null|string $password + * @return $this + */ + public function setClientPassword($password) + { + $this->_password = $password; + return $this; + } + + /** + * @return Credis_Sentinel + * @deprecated + */ + public function forceStandalone() + { + $this->_standAlone = true; + return $this; + } + + /** + * Discover the master node automatically and return an instance of Credis_Client that connects to the master + * + * @param string $name + * @return Credis_Client + * @throws CredisException + */ + public function createMasterClient($name) + { + $master = $this->getMasterAddressByName($name); + if(!isset($master[0]) || !isset($master[1])){ + throw new CredisException('Master not found'); + } + return new Credis_Client($master[0], $master[1], $this->_timeout, $this->_persistent, $this->_db, $this->_password); + } + + /** + * If a Credis_Client object exists for a master, return it. Otherwise create one and return it + * @param string $name + * @return Credis_Client + */ + public function getMasterClient($name) + { + if(!isset($this->_master[$name])){ + $this->_master[$name] = $this->createMasterClient($name); + } + return $this->_master[$name]; + } + + /** + * Discover the slave nodes automatically and return an array of Credis_Client objects + * + * @param string $name + * @return Credis_Client[] + * @throws CredisException + */ + public function createSlaveClients($name) + { + $slaves = $this->slaves($name); + $workingSlaves = array(); + foreach($slaves as $slave) { + if(!isset($slave[9])){ + throw new CredisException('Can\' retrieve slave status'); + } + if(!strstr($slave[9],'s_down') && !strstr($slave[9],'disconnected')) { + $workingSlaves[] = new Credis_Client($slave[3], $slave[5], $this->_timeout, $this->_persistent, $this->_db, $this->_password); + } + } + return $workingSlaves; + } + + /** + * If an array of Credis_Client objects exist for a set of slaves, return them. Otherwise create and return them + * @param string $name + * @return Credis_Client[] + */ + public function getSlaveClients($name) + { + if(!isset($this->_slaves[$name])){ + $this->_slaves[$name] = $this->createSlaveClients($name); + } + return $this->_slaves[$name]; + } + + /** + * Returns a Redis cluster object containing a random slave and the master + * When $selectRandomSlave is true, only one random slave is passed. + * When $selectRandomSlave is false, all clients are passed and hashing is applied in Credis_Cluster + * When $writeOnly is false, the master server will also be used for read commands. + * When $masterOnly is true, only the master server will also be used for both read and write commands. $writeOnly will be ignored and forced to set to false. + * @param string $name + * @param int $db + * @param int $replicas + * @param bool $selectRandomSlave + * @param bool $writeOnly + * @param bool $masterOnly + * @return Credis_Cluster + * @throws CredisException + * @deprecated + */ + public function createCluster($name, $db=0, $replicas=128, $selectRandomSlave=true, $writeOnly=false, $masterOnly=false) + { + $clients = array(); + $workingClients = array(); + $master = $this->master($name); + if(strstr($master[9],'s_down') || strstr($master[9],'disconnected')) { + throw new CredisException('The master is down'); + } + if (!$masterOnly) { + $slaves = $this->slaves($name); + foreach($slaves as $slave){ + if(!strstr($slave[9],'s_down') && !strstr($slave[9],'disconnected')) { + $workingClients[] = array('host'=>$slave[3],'port'=>$slave[5],'master'=>false,'db'=>$db,'password'=>$this->_password); + } + } + if(count($workingClients)>0){ + if($selectRandomSlave){ + if(!$writeOnly){ + $workingClients[] = array('host'=>$master[3],'port'=>$master[5],'master'=>false,'db'=>$db,'password'=>$this->_password); + } + $clients[] = $workingClients[rand(0,count($workingClients)-1)]; + } else { + $clients = $workingClients; + } + } + } else { + $writeOnly = false; + } + $clients[] = array('host'=>$master[3],'port'=>$master[5], 'db'=>$db ,'master'=>true,'write_only'=>$writeOnly,'password'=>$this->_password); + return new Credis_Cluster($clients,$replicas,$this->_standAlone); + } + + /** + * If a Credis_Cluster object exists, return it. Otherwise create one and return it. + * @param string $name + * @param int $db + * @param int $replicas + * @param bool $selectRandomSlave + * @param bool $writeOnly + * @param bool $masterOnly + * @return Credis_Cluster + * @throws CredisException + * @deprecated + */ + public function getCluster($name, $db=0, $replicas=128, $selectRandomSlave=true, $writeOnly=false, $masterOnly=false) + { + if(!isset($this->_cluster[$name])){ + $this->_cluster[$name] = $this->createCluster($name, $db, $replicas, $selectRandomSlave, $writeOnly, $masterOnly); + } + return $this->_cluster[$name]; + } + + /** + * Catch-all method + * @param string $name + * @param array $args + * @return mixed + */ + public function __call($name, $args) + { + array_unshift($args,$name); + return call_user_func(array($this->_client,'sentinel'),$args); + } + + /** + * get information block for the sentinel instance + * + * @param string|NUll $section + * + * @return array + */ + public function info($section = null) + { + if ($section) + { + return $this->_client->info($section); + } + return $this->_client->info(); + } + + /** + * Return information about all registered master servers + * @return mixed + */ + public function masters() + { + return $this->_client->sentinel('masters'); + } + + /** + * Return all information for slaves that are associated with a single master + * @param string $name + * @return mixed + */ + public function slaves($name) + { + return $this->_client->sentinel('slaves',$name); + } + + /** + * Get the information for a specific master + * @param string $name + * @return mixed + */ + public function master($name) + { + return $this->_client->sentinel('master',$name); + } + + /** + * Get the hostname and port for a specific master + * @param string $name + * @return mixed + */ + public function getMasterAddressByName($name) + { + return $this->_client->sentinel('get-master-addr-by-name',$name); + } + + /** + * Check if the Sentinel is still responding + * @return string|Credis_Client + */ + public function ping() + { + return $this->_client->ping(); + } + + /** + * Perform an auto-failover which will re-elect another master and make the current master a slave + * @param string $name + * @return mixed + */ + public function failover($name) + { + return $this->_client->sentinel('failover',$name); + } + + /** + * @return string + */ + public function getHost() + { + return $this->_client->getHost(); + } + + /** + * @return int + */ + public function getPort() + { + return $this->_client->getPort(); + } +} diff --git a/system/vendor/colinmollenhour/credis/composer.json b/system/vendor/colinmollenhour/credis/composer.json new file mode 100644 index 0000000..2b781e6 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/composer.json @@ -0,0 +1,27 @@ +{ + "name": "colinmollenhour/credis", + "type": "library", + "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", + "homepage": "https://github.com/colinmollenhour/credis", + "license": "MIT", + "authors": [ + { + "name": "Colin Mollenhour", + "email": "colin@mollenhour.com" + } + ], + "require": { + "php": ">=5.6.0" + }, + "suggest": { + "ext-redis": "Improved performance for communicating with redis" + }, + "autoload": { + "classmap": [ + "Client.php", + "Cluster.php", + "Sentinel.php", + "Module.php" + ] + } +} diff --git a/system/vendor/colinmollenhour/credis/phpunit_local.sh b/system/vendor/colinmollenhour/credis/phpunit_local.sh new file mode 100644 index 0000000..218d1c7 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/phpunit_local.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# This script runs unit tests locally in environment similar to Travis-CI +# It runs tests in different PHP versions with suitable PHPUnite version. +# +# You can see results of unit tests execution in console. +# Also all execution logs are saved to files phpunit_.log +# +# Prerequisites for running unit tests on local machine: +# - docker +# - docker-compose +# +# You can find definition of all test environments in folder testenv/ +# This folder is not automatically synced with .travis.yml +# If you add new PHP version to .travis.yml then you'll need to adjust files in testenv/ + +cd testenv + +# build containers and run tests +docker-compose build && docker-compose up + +# save logs to log file +docker-compose logs --no-color --timestamps | sort >"../phpunit_$(date '+%Y%m%d-%H%M%S').log" + +# remove containers +docker-compose rm -f diff --git a/system/vendor/colinmollenhour/credis/testenv/docker-compose.yml b/system/vendor/colinmollenhour/credis/testenv/docker-compose.yml new file mode 100644 index 0000000..c527d8f --- /dev/null +++ b/system/vendor/colinmollenhour/credis/testenv/docker-compose.yml @@ -0,0 +1,32 @@ +version: '2' +services: + + php-56: + build: env/php-5.6/ + volumes: + - ../:/src/ + + php-70: + build: env/php-7.0/ + volumes: + - ../:/src/ + + php-71: + build: env/php-7.1/ + volumes: + - ../:/src/ + + php-72: + build: env/php-7.2/ + volumes: + - ../:/src/ + + php-73: + build: env/php-7.3/ + volumes: + - ../:/src/ + + php-74: + build: env/php-7.4/ + volumes: + - ../:/src/ diff --git a/system/vendor/colinmollenhour/credis/testenv/env/php-5.6/Dockerfile b/system/vendor/colinmollenhour/credis/testenv/env/php-5.6/Dockerfile new file mode 100644 index 0000000..c6378a4 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/testenv/env/php-5.6/Dockerfile @@ -0,0 +1,24 @@ +FROM php:5.6 +ENV phpunit_verison 5.7 +ENV redis_version 4.0.11 + +RUN apt-get update && \ + apt-get install -y wget + +RUN wget https://phar.phpunit.de/phpunit-${phpunit_verison}.phar && \ + chmod +x phpunit-${phpunit_verison}.phar && \ + mv phpunit-${phpunit_verison}.phar /usr/local/bin/phpunit + +# install php extension +RUN yes '' | pecl install -f redis-4.3.0 && \ + docker-php-ext-enable redis + +# install redis server +RUN wget http://download.redis.io/releases/redis-${redis_version}.tar.gz && \ + tar -xzf redis-${redis_version}.tar.gz && \ + make -s -C redis-${redis_version} -j + +CMD PATH=$PATH:/usr/local/bin/:/redis-${redis_version}/src/ && \ + cp -rp /src /app && \ + cd /app && \ + phpunit diff --git a/system/vendor/colinmollenhour/credis/testenv/env/php-7.0/Dockerfile b/system/vendor/colinmollenhour/credis/testenv/env/php-7.0/Dockerfile new file mode 100644 index 0000000..82dfef9 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/testenv/env/php-7.0/Dockerfile @@ -0,0 +1,25 @@ +FROM php:7.0 +ENV phpunit_verison 6.5 +ENV redis_version 6.0.8 + +RUN apt-get update && \ + apt-get install -y wget libssl-dev + +RUN wget https://phar.phpunit.de/phpunit-${phpunit_verison}.phar && \ + chmod +x phpunit-${phpunit_verison}.phar && \ + mv phpunit-${phpunit_verison}.phar /usr/local/bin/phpunit + +# install php extension +RUN yes '' | pecl install -f redis && \ + docker-php-ext-enable redis + +# install redis server +RUN wget http://download.redis.io/releases/redis-${redis_version}.tar.gz && \ + tar -xzf redis-${redis_version}.tar.gz && \ + export BUILD_TLS=yes && \ + make -s -C redis-${redis_version} -j + +CMD PATH=$PATH:/usr/local/bin/:/redis-${redis_version}/src/ && \ + cp -rp /src /app && \ + cd /app && \ + phpunit diff --git a/system/vendor/colinmollenhour/credis/testenv/env/php-7.1/Dockerfile b/system/vendor/colinmollenhour/credis/testenv/env/php-7.1/Dockerfile new file mode 100644 index 0000000..e75a4c0 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/testenv/env/php-7.1/Dockerfile @@ -0,0 +1,25 @@ +FROM php:7.1 +ENV phpunit_verison 7.5 +ENV redis_version 6.0.8 + +RUN apt-get update && \ + apt-get install -y wget libssl-dev + +RUN wget https://phar.phpunit.de/phpunit-${phpunit_verison}.phar && \ + chmod +x phpunit-${phpunit_verison}.phar && \ + mv phpunit-${phpunit_verison}.phar /usr/local/bin/phpunit + +# install php extension +RUN yes '' | pecl install -f redis && \ + docker-php-ext-enable redis + +# install redis server +RUN wget http://download.redis.io/releases/redis-${redis_version}.tar.gz && \ + tar -xzf redis-${redis_version}.tar.gz && \ + export BUILD_TLS=yes && \ + make -s -C redis-${redis_version} -j + +CMD PATH=$PATH:/usr/local/bin/:/redis-${redis_version}/src/ && \ + cp -rp /src /app && \ + cd /app && \ + phpunit diff --git a/system/vendor/colinmollenhour/credis/testenv/env/php-7.2/Dockerfile b/system/vendor/colinmollenhour/credis/testenv/env/php-7.2/Dockerfile new file mode 100644 index 0000000..0e34aab --- /dev/null +++ b/system/vendor/colinmollenhour/credis/testenv/env/php-7.2/Dockerfile @@ -0,0 +1,25 @@ +FROM php:7.2 +ENV phpunit_verison 7.5 +ENV redis_version 6.0.8 + +RUN apt-get update && \ + apt-get install -y wget libssl-dev + +RUN wget https://phar.phpunit.de/phpunit-${phpunit_verison}.phar && \ + chmod +x phpunit-${phpunit_verison}.phar && \ + mv phpunit-${phpunit_verison}.phar /usr/local/bin/phpunit + +# install php extension +RUN yes '' | pecl install -f redis && \ + docker-php-ext-enable redis + +# install redis server +RUN wget http://download.redis.io/releases/redis-${redis_version}.tar.gz && \ + tar -xzf redis-${redis_version}.tar.gz && \ + export BUILD_TLS=yes && \ + make -s -C redis-${redis_version} -j + +CMD PATH=$PATH:/usr/local/bin/:/redis-${redis_version}/src/ && \ + cp -rp /src /app && \ + cd /app && \ + phpunit diff --git a/system/vendor/colinmollenhour/credis/testenv/env/php-7.3/Dockerfile b/system/vendor/colinmollenhour/credis/testenv/env/php-7.3/Dockerfile new file mode 100644 index 0000000..279ffa9 --- /dev/null +++ b/system/vendor/colinmollenhour/credis/testenv/env/php-7.3/Dockerfile @@ -0,0 +1,25 @@ +FROM php:7.3 +ENV phpunit_verison 7.5 +ENV redis_version 6.0.8 + +RUN apt-get update && \ + apt-get install -y wget libssl-dev + +RUN wget https://phar.phpunit.de/phpunit-${phpunit_verison}.phar && \ + chmod +x phpunit-${phpunit_verison}.phar && \ + mv phpunit-${phpunit_verison}.phar /usr/local/bin/phpunit + +# install php extension +RUN yes '' | pecl install -f redis && \ + docker-php-ext-enable redis + +# install redis server +RUN wget http://download.redis.io/releases/redis-${redis_version}.tar.gz && \ + tar -xzf redis-${redis_version}.tar.gz && \ + export BUILD_TLS=yes && \ + make -s -C redis-${redis_version} -j + +CMD PATH=$PATH:/usr/local/bin/:/redis-${redis_version}/src/ && \ + cp -rp /src /app && \ + cd /app && \ + phpunit diff --git a/system/vendor/colinmollenhour/credis/testenv/env/php-7.4/Dockerfile b/system/vendor/colinmollenhour/credis/testenv/env/php-7.4/Dockerfile new file mode 100644 index 0000000..5de537e --- /dev/null +++ b/system/vendor/colinmollenhour/credis/testenv/env/php-7.4/Dockerfile @@ -0,0 +1,25 @@ +FROM php:7.4 +ENV phpunit_verison 7.5 +ENV redis_version 6.0.8 + +RUN apt-get update && \ + apt-get install -y wget libssl-dev + +RUN wget https://phar.phpunit.de/phpunit-${phpunit_verison}.phar && \ + chmod +x phpunit-${phpunit_verison}.phar && \ + mv phpunit-${phpunit_verison}.phar /usr/local/bin/phpunit + +# install php extension +RUN yes '' | pecl install -f redis && \ + docker-php-ext-enable redis + +# install redis server +RUN wget http://download.redis.io/releases/redis-${redis_version}.tar.gz && \ + tar -xzf redis-${redis_version}.tar.gz && \ + export BUILD_TLS=yes && \ + make -s -C redis-${redis_version} -j + +CMD PATH=$PATH:/usr/local/bin/:/redis-${redis_version}/src/ && \ + cp -rp /src /app && \ + cd /app && \ + phpunit diff --git a/system/vendor/composer/ClassLoader.php b/system/vendor/composer/ClassLoader.php new file mode 100644 index 0000000..03b9bb9 --- /dev/null +++ b/system/vendor/composer/ClassLoader.php @@ -0,0 +1,445 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/system/vendor/composer/LICENSE b/system/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/system/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/system/vendor/composer/autoload_classmap.php b/system/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..819b789 --- /dev/null +++ b/system/vendor/composer/autoload_classmap.php @@ -0,0 +1,187 @@ + $vendorDir . '/colinmollenhour/credis/Client.php', + 'Credis_Client' => $vendorDir . '/colinmollenhour/credis/Client.php', + 'Credis_Cluster' => $vendorDir . '/colinmollenhour/credis/Cluster.php', + 'Credis_Module' => $vendorDir . '/colinmollenhour/credis/Module.php', + 'Credis_Sentinel' => $vendorDir . '/colinmollenhour/credis/Sentinel.php', + 'Smarty' => $vendorDir . '/smarty/smarty/libs/Smarty.class.php', + 'SmartyBC' => $vendorDir . '/smarty/smarty/libs/SmartyBC.class.php', + 'SmartyCompilerException' => $vendorDir . '/smarty/smarty/libs/sysplugins/smartycompilerexception.php', + 'SmartyException' => $vendorDir . '/smarty/smarty/libs/sysplugins/smartyexception.php', + 'Smarty_Autoloader' => $vendorDir . '/smarty/smarty/libs/Autoloader.php', + 'Smarty_CacheResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_cacheresource.php', + 'Smarty_CacheResource_Custom' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php', + 'Smarty_CacheResource_KeyValueStore' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php', + 'Smarty_Data' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_data.php', + 'Smarty_Internal_Block' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_block.php', + 'Smarty_Internal_CacheResource_File' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php', + 'Smarty_Internal_CompileBase' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php', + 'Smarty_Internal_Compile_Append' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php', + 'Smarty_Internal_Compile_Assign' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php', + 'Smarty_Internal_Compile_Block' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php', + 'Smarty_Internal_Compile_Block_Child' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php', + 'Smarty_Internal_Compile_Block_Parent' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php', + 'Smarty_Internal_Compile_Blockclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php', + 'Smarty_Internal_Compile_Break' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php', + 'Smarty_Internal_Compile_Call' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php', + 'Smarty_Internal_Compile_Capture' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php', + 'Smarty_Internal_Compile_CaptureClose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php', + 'Smarty_Internal_Compile_Child' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php', + 'Smarty_Internal_Compile_Config_Load' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php', + 'Smarty_Internal_Compile_Continue' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php', + 'Smarty_Internal_Compile_Debug' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php', + 'Smarty_Internal_Compile_Else' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Elseif' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Eval' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php', + 'Smarty_Internal_Compile_Extends' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php', + 'Smarty_Internal_Compile_For' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php', + 'Smarty_Internal_Compile_Forclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php', + 'Smarty_Internal_Compile_Foreach' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php', + 'Smarty_Internal_Compile_Foreachclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php', + 'Smarty_Internal_Compile_Foreachelse' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php', + 'Smarty_Internal_Compile_Forelse' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php', + 'Smarty_Internal_Compile_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php', + 'Smarty_Internal_Compile_Functionclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php', + 'Smarty_Internal_Compile_If' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Ifclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Include' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php', + 'Smarty_Internal_Compile_Include_Php' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php', + 'Smarty_Internal_Compile_Insert' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php', + 'Smarty_Internal_Compile_Ldelim' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php', + 'Smarty_Internal_Compile_Make_Nocache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php', + 'Smarty_Internal_Compile_Nocache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php', + 'Smarty_Internal_Compile_Nocacheclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php', + 'Smarty_Internal_Compile_Parent' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php', + 'Smarty_Internal_Compile_Private_Block_Plugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php', + 'Smarty_Internal_Compile_Private_ForeachSection' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php', + 'Smarty_Internal_Compile_Private_Function_Plugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php', + 'Smarty_Internal_Compile_Private_Modifier' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php', + 'Smarty_Internal_Compile_Private_Object_Block_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php', + 'Smarty_Internal_Compile_Private_Object_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php', + 'Smarty_Internal_Compile_Private_Php' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php', + 'Smarty_Internal_Compile_Private_Print_Expression' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php', + 'Smarty_Internal_Compile_Private_Registered_Block' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php', + 'Smarty_Internal_Compile_Private_Registered_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php', + 'Smarty_Internal_Compile_Private_Special_Variable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php', + 'Smarty_Internal_Compile_Rdelim' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php', + 'Smarty_Internal_Compile_Section' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php', + 'Smarty_Internal_Compile_Sectionclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php', + 'Smarty_Internal_Compile_Sectionelse' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php', + 'Smarty_Internal_Compile_Setfilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php', + 'Smarty_Internal_Compile_Setfilterclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php', + 'Smarty_Internal_Compile_Shared_Inheritance' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php', + 'Smarty_Internal_Compile_While' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php', + 'Smarty_Internal_Compile_Whileclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php', + 'Smarty_Internal_Config_File_Compiler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php', + 'Smarty_Internal_Configfilelexer' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php', + 'Smarty_Internal_Configfileparser' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php', + 'Smarty_Internal_Data' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_data.php', + 'Smarty_Internal_Debug' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_debug.php', + 'Smarty_Internal_ErrorHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php', + 'Smarty_Internal_Extension_Handler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php', + 'Smarty_Internal_Method_AddAutoloadFilters' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php', + 'Smarty_Internal_Method_AddDefaultModifiers' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php', + 'Smarty_Internal_Method_Append' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php', + 'Smarty_Internal_Method_AppendByRef' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php', + 'Smarty_Internal_Method_AssignByRef' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php', + 'Smarty_Internal_Method_AssignGlobal' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php', + 'Smarty_Internal_Method_ClearAllAssign' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php', + 'Smarty_Internal_Method_ClearAllCache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php', + 'Smarty_Internal_Method_ClearAssign' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php', + 'Smarty_Internal_Method_ClearCache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php', + 'Smarty_Internal_Method_ClearCompiledTemplate' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php', + 'Smarty_Internal_Method_ClearConfig' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php', + 'Smarty_Internal_Method_CompileAllConfig' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php', + 'Smarty_Internal_Method_CompileAllTemplates' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php', + 'Smarty_Internal_Method_ConfigLoad' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php', + 'Smarty_Internal_Method_CreateData' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php', + 'Smarty_Internal_Method_GetAutoloadFilters' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php', + 'Smarty_Internal_Method_GetConfigVariable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php', + 'Smarty_Internal_Method_GetConfigVars' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php', + 'Smarty_Internal_Method_GetDebugTemplate' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php', + 'Smarty_Internal_Method_GetDefaultModifiers' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php', + 'Smarty_Internal_Method_GetGlobal' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php', + 'Smarty_Internal_Method_GetRegisteredObject' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php', + 'Smarty_Internal_Method_GetStreamVariable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php', + 'Smarty_Internal_Method_GetTags' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php', + 'Smarty_Internal_Method_GetTemplateVars' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php', + 'Smarty_Internal_Method_Literals' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php', + 'Smarty_Internal_Method_LoadFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php', + 'Smarty_Internal_Method_LoadPlugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php', + 'Smarty_Internal_Method_MustCompile' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php', + 'Smarty_Internal_Method_RegisterCacheResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php', + 'Smarty_Internal_Method_RegisterClass' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php', + 'Smarty_Internal_Method_RegisterDefaultConfigHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php', + 'Smarty_Internal_Method_RegisterDefaultPluginHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php', + 'Smarty_Internal_Method_RegisterDefaultTemplateHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php', + 'Smarty_Internal_Method_RegisterFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php', + 'Smarty_Internal_Method_RegisterObject' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php', + 'Smarty_Internal_Method_RegisterPlugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php', + 'Smarty_Internal_Method_RegisterResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php', + 'Smarty_Internal_Method_SetAutoloadFilters' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php', + 'Smarty_Internal_Method_SetDebugTemplate' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php', + 'Smarty_Internal_Method_SetDefaultModifiers' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php', + 'Smarty_Internal_Method_UnloadFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php', + 'Smarty_Internal_Method_UnregisterCacheResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php', + 'Smarty_Internal_Method_UnregisterFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php', + 'Smarty_Internal_Method_UnregisterObject' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php', + 'Smarty_Internal_Method_UnregisterPlugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php', + 'Smarty_Internal_Method_UnregisterResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php', + 'Smarty_Internal_Nocache_Insert' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php', + 'Smarty_Internal_ParseTree' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php', + 'Smarty_Internal_ParseTree_Code' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php', + 'Smarty_Internal_ParseTree_Dq' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php', + 'Smarty_Internal_ParseTree_DqContent' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php', + 'Smarty_Internal_ParseTree_Tag' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php', + 'Smarty_Internal_ParseTree_Template' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php', + 'Smarty_Internal_ParseTree_Text' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php', + 'Smarty_Internal_Resource_Eval' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php', + 'Smarty_Internal_Resource_Extends' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php', + 'Smarty_Internal_Resource_File' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php', + 'Smarty_Internal_Resource_Php' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php', + 'Smarty_Internal_Resource_Registered' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_registered.php', + 'Smarty_Internal_Resource_Stream' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php', + 'Smarty_Internal_Resource_String' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php', + 'Smarty_Internal_Runtime_CacheModify' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php', + 'Smarty_Internal_Runtime_CacheResourceFile' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php', + 'Smarty_Internal_Runtime_Capture' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php', + 'Smarty_Internal_Runtime_CodeFrame' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php', + 'Smarty_Internal_Runtime_FilterHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php', + 'Smarty_Internal_Runtime_Foreach' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php', + 'Smarty_Internal_Runtime_GetIncludePath' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php', + 'Smarty_Internal_Runtime_Inheritance' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php', + 'Smarty_Internal_Runtime_Make_Nocache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php', + 'Smarty_Internal_Runtime_TplFunction' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php', + 'Smarty_Internal_Runtime_UpdateCache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php', + 'Smarty_Internal_Runtime_UpdateScope' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php', + 'Smarty_Internal_Runtime_WriteFile' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php', + 'Smarty_Internal_SmartyTemplateCompiler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php', + 'Smarty_Internal_Template' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_template.php', + 'Smarty_Internal_TemplateBase' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php', + 'Smarty_Internal_TemplateCompilerBase' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php', + 'Smarty_Internal_Templatelexer' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php', + 'Smarty_Internal_Templateparser' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php', + 'Smarty_Internal_TestInstall' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php', + 'Smarty_Internal_Undefined' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php', + 'Smarty_Resource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource.php', + 'Smarty_Resource_Custom' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource_custom.php', + 'Smarty_Resource_Recompiled' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php', + 'Smarty_Resource_Uncompiled' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php', + 'Smarty_Security' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_security.php', + 'Smarty_Template_Cached' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_cached.php', + 'Smarty_Template_Compiled' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_compiled.php', + 'Smarty_Template_Config' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_config.php', + 'Smarty_Template_Resource_Base' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php', + 'Smarty_Template_Source' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_source.php', + 'Smarty_Undefined_Variable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php', + 'Smarty_Variable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_variable.php', + 'TPC_yyStackEntry' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php', + 'TP_yyStackEntry' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php', +); diff --git a/system/vendor/composer/autoload_files.php b/system/vendor/composer/autoload_files.php new file mode 100644 index 0000000..480f00c --- /dev/null +++ b/system/vendor/composer/autoload_files.php @@ -0,0 +1,11 @@ + $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', +); diff --git a/system/vendor/composer/autoload_namespaces.php b/system/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..74176c7 --- /dev/null +++ b/system/vendor/composer/autoload_namespaces.php @@ -0,0 +1,10 @@ + array($vendorDir . '/mustache/mustache/src'), +); diff --git a/system/vendor/composer/autoload_psr4.php b/system/vendor/composer/autoload_psr4.php new file mode 100644 index 0000000..4570fbf --- /dev/null +++ b/system/vendor/composer/autoload_psr4.php @@ -0,0 +1,12 @@ + array($vendorDir . '/twig/twig/src'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), +); diff --git a/system/vendor/composer/autoload_real.php b/system/vendor/composer/autoload_real.php new file mode 100644 index 0000000..a9b774d --- /dev/null +++ b/system/vendor/composer/autoload_real.php @@ -0,0 +1,73 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit7e317f01bc8a34d224e1b16b9d2ff721::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInit7e317f01bc8a34d224e1b16b9d2ff721::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire7e317f01bc8a34d224e1b16b9d2ff721($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequire7e317f01bc8a34d224e1b16b9d2ff721($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/system/vendor/composer/autoload_static.php b/system/vendor/composer/autoload_static.php new file mode 100644 index 0000000..562883b --- /dev/null +++ b/system/vendor/composer/autoload_static.php @@ -0,0 +1,242 @@ + __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'T' => + array ( + 'Twig\\' => 5, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Ctype\\' => 23, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Twig\\' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/src', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + ); + + public static $prefixesPsr0 = array ( + 'M' => + array ( + 'Mustache' => + array ( + 0 => __DIR__ . '/..' . '/mustache/mustache/src', + ), + ), + ); + + public static $classMap = array ( + 'CredisException' => __DIR__ . '/..' . '/colinmollenhour/credis/Client.php', + 'Credis_Client' => __DIR__ . '/..' . '/colinmollenhour/credis/Client.php', + 'Credis_Cluster' => __DIR__ . '/..' . '/colinmollenhour/credis/Cluster.php', + 'Credis_Module' => __DIR__ . '/..' . '/colinmollenhour/credis/Module.php', + 'Credis_Sentinel' => __DIR__ . '/..' . '/colinmollenhour/credis/Sentinel.php', + 'Smarty' => __DIR__ . '/..' . '/smarty/smarty/libs/Smarty.class.php', + 'SmartyBC' => __DIR__ . '/..' . '/smarty/smarty/libs/SmartyBC.class.php', + 'SmartyCompilerException' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smartycompilerexception.php', + 'SmartyException' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smartyexception.php', + 'Smarty_Autoloader' => __DIR__ . '/..' . '/smarty/smarty/libs/Autoloader.php', + 'Smarty_CacheResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_cacheresource.php', + 'Smarty_CacheResource_Custom' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php', + 'Smarty_CacheResource_KeyValueStore' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php', + 'Smarty_Data' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_data.php', + 'Smarty_Internal_Block' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_block.php', + 'Smarty_Internal_CacheResource_File' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php', + 'Smarty_Internal_CompileBase' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php', + 'Smarty_Internal_Compile_Append' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php', + 'Smarty_Internal_Compile_Assign' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php', + 'Smarty_Internal_Compile_Block' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php', + 'Smarty_Internal_Compile_Block_Child' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php', + 'Smarty_Internal_Compile_Block_Parent' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php', + 'Smarty_Internal_Compile_Blockclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php', + 'Smarty_Internal_Compile_Break' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php', + 'Smarty_Internal_Compile_Call' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php', + 'Smarty_Internal_Compile_Capture' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php', + 'Smarty_Internal_Compile_CaptureClose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php', + 'Smarty_Internal_Compile_Child' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php', + 'Smarty_Internal_Compile_Config_Load' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php', + 'Smarty_Internal_Compile_Continue' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php', + 'Smarty_Internal_Compile_Debug' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php', + 'Smarty_Internal_Compile_Else' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Elseif' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Eval' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php', + 'Smarty_Internal_Compile_Extends' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php', + 'Smarty_Internal_Compile_For' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php', + 'Smarty_Internal_Compile_Forclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php', + 'Smarty_Internal_Compile_Foreach' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php', + 'Smarty_Internal_Compile_Foreachclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php', + 'Smarty_Internal_Compile_Foreachelse' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php', + 'Smarty_Internal_Compile_Forelse' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php', + 'Smarty_Internal_Compile_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php', + 'Smarty_Internal_Compile_Functionclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php', + 'Smarty_Internal_Compile_If' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Ifclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php', + 'Smarty_Internal_Compile_Include' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php', + 'Smarty_Internal_Compile_Include_Php' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php', + 'Smarty_Internal_Compile_Insert' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php', + 'Smarty_Internal_Compile_Ldelim' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php', + 'Smarty_Internal_Compile_Make_Nocache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php', + 'Smarty_Internal_Compile_Nocache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php', + 'Smarty_Internal_Compile_Nocacheclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php', + 'Smarty_Internal_Compile_Parent' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php', + 'Smarty_Internal_Compile_Private_Block_Plugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php', + 'Smarty_Internal_Compile_Private_ForeachSection' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php', + 'Smarty_Internal_Compile_Private_Function_Plugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php', + 'Smarty_Internal_Compile_Private_Modifier' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php', + 'Smarty_Internal_Compile_Private_Object_Block_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php', + 'Smarty_Internal_Compile_Private_Object_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php', + 'Smarty_Internal_Compile_Private_Php' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php', + 'Smarty_Internal_Compile_Private_Print_Expression' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php', + 'Smarty_Internal_Compile_Private_Registered_Block' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php', + 'Smarty_Internal_Compile_Private_Registered_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php', + 'Smarty_Internal_Compile_Private_Special_Variable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php', + 'Smarty_Internal_Compile_Rdelim' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php', + 'Smarty_Internal_Compile_Section' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php', + 'Smarty_Internal_Compile_Sectionclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php', + 'Smarty_Internal_Compile_Sectionelse' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php', + 'Smarty_Internal_Compile_Setfilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php', + 'Smarty_Internal_Compile_Setfilterclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php', + 'Smarty_Internal_Compile_Shared_Inheritance' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php', + 'Smarty_Internal_Compile_While' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php', + 'Smarty_Internal_Compile_Whileclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php', + 'Smarty_Internal_Config_File_Compiler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php', + 'Smarty_Internal_Configfilelexer' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php', + 'Smarty_Internal_Configfileparser' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php', + 'Smarty_Internal_Data' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_data.php', + 'Smarty_Internal_Debug' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_debug.php', + 'Smarty_Internal_ErrorHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php', + 'Smarty_Internal_Extension_Handler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php', + 'Smarty_Internal_Method_AddAutoloadFilters' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php', + 'Smarty_Internal_Method_AddDefaultModifiers' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php', + 'Smarty_Internal_Method_Append' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php', + 'Smarty_Internal_Method_AppendByRef' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php', + 'Smarty_Internal_Method_AssignByRef' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php', + 'Smarty_Internal_Method_AssignGlobal' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php', + 'Smarty_Internal_Method_ClearAllAssign' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php', + 'Smarty_Internal_Method_ClearAllCache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php', + 'Smarty_Internal_Method_ClearAssign' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php', + 'Smarty_Internal_Method_ClearCache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php', + 'Smarty_Internal_Method_ClearCompiledTemplate' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php', + 'Smarty_Internal_Method_ClearConfig' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php', + 'Smarty_Internal_Method_CompileAllConfig' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php', + 'Smarty_Internal_Method_CompileAllTemplates' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php', + 'Smarty_Internal_Method_ConfigLoad' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php', + 'Smarty_Internal_Method_CreateData' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php', + 'Smarty_Internal_Method_GetAutoloadFilters' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php', + 'Smarty_Internal_Method_GetConfigVariable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php', + 'Smarty_Internal_Method_GetConfigVars' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php', + 'Smarty_Internal_Method_GetDebugTemplate' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php', + 'Smarty_Internal_Method_GetDefaultModifiers' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php', + 'Smarty_Internal_Method_GetGlobal' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php', + 'Smarty_Internal_Method_GetRegisteredObject' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php', + 'Smarty_Internal_Method_GetStreamVariable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php', + 'Smarty_Internal_Method_GetTags' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php', + 'Smarty_Internal_Method_GetTemplateVars' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php', + 'Smarty_Internal_Method_Literals' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php', + 'Smarty_Internal_Method_LoadFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php', + 'Smarty_Internal_Method_LoadPlugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php', + 'Smarty_Internal_Method_MustCompile' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php', + 'Smarty_Internal_Method_RegisterCacheResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php', + 'Smarty_Internal_Method_RegisterClass' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php', + 'Smarty_Internal_Method_RegisterDefaultConfigHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php', + 'Smarty_Internal_Method_RegisterDefaultPluginHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php', + 'Smarty_Internal_Method_RegisterDefaultTemplateHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php', + 'Smarty_Internal_Method_RegisterFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php', + 'Smarty_Internal_Method_RegisterObject' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php', + 'Smarty_Internal_Method_RegisterPlugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php', + 'Smarty_Internal_Method_RegisterResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php', + 'Smarty_Internal_Method_SetAutoloadFilters' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php', + 'Smarty_Internal_Method_SetDebugTemplate' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php', + 'Smarty_Internal_Method_SetDefaultModifiers' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php', + 'Smarty_Internal_Method_UnloadFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php', + 'Smarty_Internal_Method_UnregisterCacheResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php', + 'Smarty_Internal_Method_UnregisterFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php', + 'Smarty_Internal_Method_UnregisterObject' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php', + 'Smarty_Internal_Method_UnregisterPlugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php', + 'Smarty_Internal_Method_UnregisterResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php', + 'Smarty_Internal_Nocache_Insert' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php', + 'Smarty_Internal_ParseTree' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php', + 'Smarty_Internal_ParseTree_Code' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php', + 'Smarty_Internal_ParseTree_Dq' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php', + 'Smarty_Internal_ParseTree_DqContent' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php', + 'Smarty_Internal_ParseTree_Tag' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php', + 'Smarty_Internal_ParseTree_Template' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php', + 'Smarty_Internal_ParseTree_Text' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php', + 'Smarty_Internal_Resource_Eval' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php', + 'Smarty_Internal_Resource_Extends' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php', + 'Smarty_Internal_Resource_File' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php', + 'Smarty_Internal_Resource_Php' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php', + 'Smarty_Internal_Resource_Registered' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_registered.php', + 'Smarty_Internal_Resource_Stream' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php', + 'Smarty_Internal_Resource_String' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php', + 'Smarty_Internal_Runtime_CacheModify' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php', + 'Smarty_Internal_Runtime_CacheResourceFile' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php', + 'Smarty_Internal_Runtime_Capture' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php', + 'Smarty_Internal_Runtime_CodeFrame' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php', + 'Smarty_Internal_Runtime_FilterHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php', + 'Smarty_Internal_Runtime_Foreach' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php', + 'Smarty_Internal_Runtime_GetIncludePath' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php', + 'Smarty_Internal_Runtime_Inheritance' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php', + 'Smarty_Internal_Runtime_Make_Nocache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php', + 'Smarty_Internal_Runtime_TplFunction' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php', + 'Smarty_Internal_Runtime_UpdateCache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php', + 'Smarty_Internal_Runtime_UpdateScope' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php', + 'Smarty_Internal_Runtime_WriteFile' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php', + 'Smarty_Internal_SmartyTemplateCompiler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php', + 'Smarty_Internal_Template' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_template.php', + 'Smarty_Internal_TemplateBase' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php', + 'Smarty_Internal_TemplateCompilerBase' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php', + 'Smarty_Internal_Templatelexer' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php', + 'Smarty_Internal_Templateparser' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php', + 'Smarty_Internal_TestInstall' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php', + 'Smarty_Internal_Undefined' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php', + 'Smarty_Resource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource.php', + 'Smarty_Resource_Custom' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource_custom.php', + 'Smarty_Resource_Recompiled' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php', + 'Smarty_Resource_Uncompiled' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php', + 'Smarty_Security' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_security.php', + 'Smarty_Template_Cached' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_cached.php', + 'Smarty_Template_Compiled' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_compiled.php', + 'Smarty_Template_Config' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_config.php', + 'Smarty_Template_Resource_Base' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php', + 'Smarty_Template_Source' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_source.php', + 'Smarty_Undefined_Variable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php', + 'Smarty_Variable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_variable.php', + 'TPC_yyStackEntry' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php', + 'TP_yyStackEntry' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit7e317f01bc8a34d224e1b16b9d2ff721::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit7e317f01bc8a34d224e1b16b9d2ff721::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit7e317f01bc8a34d224e1b16b9d2ff721::$prefixesPsr0; + $loader->classMap = ComposerStaticInit7e317f01bc8a34d224e1b16b9d2ff721::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/system/vendor/composer/installed.json b/system/vendor/composer/installed.json new file mode 100644 index 0000000..f679c4e --- /dev/null +++ b/system/vendor/composer/installed.json @@ -0,0 +1,405 @@ +[ + { + "name": "colinmollenhour/credis", + "version": "v1.13.0", + "version_normalized": "1.13.0.0", + "source": { + "type": "git", + "url": "https://github.com/colinmollenhour/credis.git", + "reference": "afec8e58ec93d2291c127fa19709a048f28641e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/afec8e58ec93d2291c127fa19709a048f28641e5", + "reference": "afec8e58ec93d2291c127fa19709a048f28641e5", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "suggest": { + "ext-redis": "Improved performance for communicating with redis" + }, + "time": "2022-04-07T14:57:22+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "Client.php", + "Cluster.php", + "Sentinel.php", + "Module.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Colin Mollenhour", + "email": "colin@mollenhour.com" + } + ], + "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", + "homepage": "https://github.com/colinmollenhour/credis", + "support": { + "issues": "https://github.com/colinmollenhour/credis/issues", + "source": "https://github.com/colinmollenhour/credis/tree/v1.13.0" + } + }, + { + "name": "mustache/mustache", + "version": "v2.14.1", + "version_normalized": "2.14.1.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/mustache.php.git", + "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/579ffa5c96e1d292c060b3dd62811ff01ad8c24e", + "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~1.11", + "phpunit/phpunit": "~3.7|~4.0|~5.0" + }, + "time": "2022-01-21T06:08:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Mustache": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "A Mustache implementation in PHP.", + "homepage": "https://github.com/bobthecow/mustache.php", + "keywords": [ + "mustache", + "templating" + ] + }, + { + "name": "smarty/smarty", + "version": "v3.1.44", + "version_normalized": "3.1.44.0", + "source": { + "type": "git", + "url": "https://github.com/smarty-php/smarty.git", + "reference": "99085d8dc65eeb5e55ae3cba74d3dc6b3bb0205e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/99085d8dc65eeb5e55ae3cba74d3dc6b3bb0205e", + "reference": "99085d8dc65eeb5e55ae3cba74d3dc6b3bb0205e", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^6.5 || ^5.7 || ^4.8", + "smarty/smarty-lexer": "^3.1" + }, + "time": "2022-01-17T23:12:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "libs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Monte Ohrt", + "email": "monte@ohrt.com" + }, + { + "name": "Uwe Tews", + "email": "uwe.tews@googlemail.com" + }, + { + "name": "Rodney Rehm", + "email": "rodney.rehm@medialize.de" + } + ], + "description": "Smarty - the compiling PHP template engine", + "homepage": "http://www.smarty.net", + "keywords": [ + "templating" + ] + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2021-10-20T20:35:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ] + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2021-11-30T18:21:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ] + }, + { + "name": "twig/twig", + "version": "v3.3.10", + "version_normalized": "3.3.10.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "8442df056c51b706793adf80a9fd363406dd3674" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/8442df056c51b706793adf80a9fd363406dd3674", + "reference": "8442df056c51b706793adf80a9fd363406dd3674", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + }, + "time": "2022-04-06T06:47:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.3.10" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ] + } +] diff --git a/system/vendor/mustache/mustache/.gitattributes b/system/vendor/mustache/mustache/.gitattributes new file mode 100644 index 0000000..95b7ab4 --- /dev/null +++ b/system/vendor/mustache/mustache/.gitattributes @@ -0,0 +1,8 @@ +/test export-ignore +/CONTRIBUTING.md export-ignore +/.php_cs export-ignore +/phpunit.xml.dist export-ignore +/.travis.yml export-ignore +/.styleci.yml export-ignore +/.gitmodules export-ignore +/.gitignore export-ignore diff --git a/system/vendor/mustache/mustache/LICENSE b/system/vendor/mustache/mustache/LICENSE new file mode 100644 index 0000000..e0aecc9 --- /dev/null +++ b/system/vendor/mustache/mustache/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010-2015 Justin Hileman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/system/vendor/mustache/mustache/README.md b/system/vendor/mustache/mustache/README.md new file mode 100644 index 0000000..1560192 --- /dev/null +++ b/system/vendor/mustache/mustache/README.md @@ -0,0 +1,73 @@ +Mustache.php +============ + +A [Mustache](https://mustache.github.io/) implementation in PHP. + +[![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache) +[![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php) +[![StyleCI](https://styleci.io/repos/569670/shield)](https://styleci.io/repos/569670) +[![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache) + + +Usage +----- + +A quick example: + +```php + ENT_QUOTES)); +echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!" +``` + + +And a more in-depth example -- this is the canonical Mustache template: + +```html+jinja +Hello {{name}} +You have just won {{value}} dollars! +{{#in_ca}} +Well, {{taxed_value}} dollars, after taxes. +{{/in_ca}} +``` + + +Create a view "context" object -- which could also be an associative array, but those don't do functions quite as well: + +```php +value - ($this->value * 0.4); + } + + public $in_ca = true; +} +``` + + +And render it: + +```php + ENT_QUOTES)); +$chris = new Chris; +echo $m->render($template, $chris); +``` + +*Note:* we recommend using `ENT_QUOTES` as a default of [entity_flags](https://github.com/bobthecow/mustache.php/wiki#entity_flags) to decrease the chance of Cross-site scripting vulnerability. + +And That's Not All! +------------------- + +Read [the Mustache.php documentation](https://github.com/bobthecow/mustache.php/wiki/Home) for more information. + + +See Also +-------- + + * [mustache(5)](http://mustache.github.io/mustache.5.html) man page. + * [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md). diff --git a/system/vendor/mustache/mustache/composer.json b/system/vendor/mustache/mustache/composer.json new file mode 100644 index 0000000..d0514f3 --- /dev/null +++ b/system/vendor/mustache/mustache/composer.json @@ -0,0 +1,25 @@ +{ + "name": "mustache/mustache", + "description": "A Mustache implementation in PHP.", + "keywords": ["templating", "mustache"], + "homepage": "https://github.com/bobthecow/mustache.php", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "phpunit/phpunit": "~3.7|~4.0|~5.0", + "friendsofphp/php-cs-fixer": "~1.11" + }, + "autoload": { + "psr-0": { "Mustache": "src/" } + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Autoloader.php b/system/vendor/mustache/mustache/src/Mustache/Autoloader.php new file mode 100644 index 0000000..e8ea3f4 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Autoloader.php @@ -0,0 +1,88 @@ +baseDir = $realDir; + } else { + $this->baseDir = $baseDir; + } + } + + /** + * Register a new instance as an SPL autoloader. + * + * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..') + * + * @return Mustache_Autoloader Registered Autoloader instance + */ + public static function register($baseDir = null) + { + $key = $baseDir ? $baseDir : 0; + + if (!isset(self::$instances[$key])) { + self::$instances[$key] = new self($baseDir); + } + + $loader = self::$instances[$key]; + spl_autoload_register(array($loader, 'autoload')); + + return $loader; + } + + /** + * Autoload Mustache classes. + * + * @param string $class + */ + public function autoload($class) + { + if ($class[0] === '\\') { + $class = substr($class, 1); + } + + if (strpos($class, 'Mustache') !== 0) { + return; + } + + $file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class)); + if (is_file($file)) { + require $file; + } + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Cache.php b/system/vendor/mustache/mustache/src/Mustache/Cache.php new file mode 100644 index 0000000..3292efa --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Cache.php @@ -0,0 +1,43 @@ +logger; + } + + /** + * Set a logger instance. + * + * @param Mustache_Logger|Psr\Log\LoggerInterface $logger + */ + public function setLogger($logger = null) + { + if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) { + throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.'); + } + + $this->logger = $logger; + } + + /** + * Add a log record if logging is enabled. + * + * @param string $level The logging level + * @param string $message The log message + * @param array $context The log context + */ + protected function log($level, $message, array $context = array()) + { + if (isset($this->logger)) { + $this->logger->log($level, $message, $context); + } + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php b/system/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php new file mode 100644 index 0000000..3e742b7 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php @@ -0,0 +1,161 @@ +cache($className, $compiledSource); + * + * The FilesystemCache benefits from any opcode caching that may be setup in your environment. So do that, k? + */ +class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache +{ + private $baseDir; + private $fileMode; + + /** + * Filesystem cache constructor. + * + * @param string $baseDir Directory for compiled templates + * @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask + */ + public function __construct($baseDir, $fileMode = null) + { + $this->baseDir = $baseDir; + $this->fileMode = $fileMode; + } + + /** + * Load the class from cache using `require_once`. + * + * @param string $key + * + * @return bool + */ + public function load($key) + { + $fileName = $this->getCacheFilename($key); + if (!is_file($fileName)) { + return false; + } + + require_once $fileName; + + return true; + } + + /** + * Cache and load the compiled class. + * + * @param string $key + * @param string $value + */ + public function cache($key, $value) + { + $fileName = $this->getCacheFilename($key); + + $this->log( + Mustache_Logger::DEBUG, + 'Writing to template cache: "{fileName}"', + array('fileName' => $fileName) + ); + + $this->writeFile($fileName, $value); + $this->load($key); + } + + /** + * Build the cache filename. + * Subclasses should override for custom cache directory structures. + * + * @param string $name + * + * @return string + */ + protected function getCacheFilename($name) + { + return sprintf('%s/%s.php', $this->baseDir, $name); + } + + /** + * Create cache directory. + * + * @throws Mustache_Exception_RuntimeException If unable to create directory + * + * @param string $fileName + * + * @return string + */ + private function buildDirectoryForFilename($fileName) + { + $dirName = dirname($fileName); + if (!is_dir($dirName)) { + $this->log( + Mustache_Logger::INFO, + 'Creating Mustache template cache directory: "{dirName}"', + array('dirName' => $dirName) + ); + + @mkdir($dirName, 0777, true); + // @codeCoverageIgnoreStart + if (!is_dir($dirName)) { + throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName)); + } + // @codeCoverageIgnoreEnd + } + + return $dirName; + } + + /** + * Write cache file. + * + * @throws Mustache_Exception_RuntimeException If unable to write file + * + * @param string $fileName + * @param string $value + */ + private function writeFile($fileName, $value) + { + $dirName = $this->buildDirectoryForFilename($fileName); + + $this->log( + Mustache_Logger::DEBUG, + 'Caching compiled template to "{fileName}"', + array('fileName' => $fileName) + ); + + $tempFile = tempnam($dirName, basename($fileName)); + if (false !== @file_put_contents($tempFile, $value)) { + if (@rename($tempFile, $fileName)) { + $mode = isset($this->fileMode) ? $this->fileMode : (0666 & ~umask()); + @chmod($fileName, $mode); + + return; + } + + // @codeCoverageIgnoreStart + $this->log( + Mustache_Logger::ERROR, + 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"', + array('tempName' => $tempFile, 'fileName' => $fileName) + ); + // @codeCoverageIgnoreEnd + } + + // @codeCoverageIgnoreStart + throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName)); + // @codeCoverageIgnoreEnd + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php b/system/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php new file mode 100644 index 0000000..ed9eec9 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php @@ -0,0 +1,47 @@ +log( + Mustache_Logger::WARNING, + 'Template cache disabled, evaluating "{className}" class at runtime', + array('className' => $key) + ); + eval('?>' . $value); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Compiler.php b/system/vendor/mustache/mustache/src/Mustache/Compiler.php new file mode 100644 index 0000000..93a295a --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Compiler.php @@ -0,0 +1,689 @@ +pragmas = $this->defaultPragmas; + $this->sections = array(); + $this->blocks = array(); + $this->source = $source; + $this->indentNextLine = true; + $this->customEscape = $customEscape; + $this->entityFlags = $entityFlags; + $this->charset = $charset; + $this->strictCallables = $strictCallables; + + return $this->writeCode($tree, $name); + } + + /** + * Enable pragmas across all templates, regardless of the presence of pragma + * tags in the individual templates. + * + * @internal Users should set global pragmas in Mustache_Engine, not here :) + * + * @param string[] $pragmas + */ + public function setPragmas(array $pragmas) + { + $this->pragmas = array(); + foreach ($pragmas as $pragma) { + $this->pragmas[$pragma] = true; + } + $this->defaultPragmas = $this->pragmas; + } + + /** + * Helper function for walking the Mustache token parse tree. + * + * @throws Mustache_Exception_SyntaxException upon encountering unknown token types + * + * @param array $tree Parse tree of Mustache tokens + * @param int $level (default: 0) + * + * @return string Generated PHP source code + */ + private function walk(array $tree, $level = 0) + { + $code = ''; + $level++; + foreach ($tree as $node) { + switch ($node[Mustache_Tokenizer::TYPE]) { + case Mustache_Tokenizer::T_PRAGMA: + $this->pragmas[$node[Mustache_Tokenizer::NAME]] = true; + break; + + case Mustache_Tokenizer::T_SECTION: + $code .= $this->section( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(), + $node[Mustache_Tokenizer::INDEX], + $node[Mustache_Tokenizer::END], + $node[Mustache_Tokenizer::OTAG], + $node[Mustache_Tokenizer::CTAG], + $level + ); + break; + + case Mustache_Tokenizer::T_INVERTED: + $code .= $this->invertedSection( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(), + $level + ); + break; + + case Mustache_Tokenizer::T_PARTIAL: + $code .= $this->partial( + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '', + $level + ); + break; + + case Mustache_Tokenizer::T_PARENT: + $code .= $this->parent( + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '', + $node[Mustache_Tokenizer::NODES], + $level + ); + break; + + case Mustache_Tokenizer::T_BLOCK_ARG: + $code .= $this->blockArg( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + $node[Mustache_Tokenizer::INDEX], + $node[Mustache_Tokenizer::END], + $node[Mustache_Tokenizer::OTAG], + $node[Mustache_Tokenizer::CTAG], + $level + ); + break; + + case Mustache_Tokenizer::T_BLOCK_VAR: + $code .= $this->blockVar( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + $node[Mustache_Tokenizer::INDEX], + $node[Mustache_Tokenizer::END], + $node[Mustache_Tokenizer::OTAG], + $node[Mustache_Tokenizer::CTAG], + $level + ); + break; + + case Mustache_Tokenizer::T_COMMENT: + break; + + case Mustache_Tokenizer::T_ESCAPED: + case Mustache_Tokenizer::T_UNESCAPED: + case Mustache_Tokenizer::T_UNESCAPED_2: + $code .= $this->variable( + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(), + $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_ESCAPED, + $level + ); + break; + + case Mustache_Tokenizer::T_TEXT: + $code .= $this->text($node[Mustache_Tokenizer::VALUE], $level); + break; + + default: + throw new Mustache_Exception_SyntaxException(sprintf('Unknown token type: %s', $node[Mustache_Tokenizer::TYPE]), $node); + } + } + + return $code; + } + + const KLASS = 'lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context); + $buffer = \'\'; + %s + + return $buffer; + } + %s + %s + }'; + + const KLASS_NO_LAMBDAS = 'walk($tree); + $sections = implode("\n", $this->sections); + $blocks = implode("\n", $this->blocks); + $klass = empty($this->sections) && empty($this->blocks) ? self::KLASS_NO_LAMBDAS : self::KLASS; + + $callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : ''; + + return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections, $blocks); + } + + const BLOCK_VAR = ' + $blockFunction = $context->findInBlock(%s); + if (is_callable($blockFunction)) { + $buffer .= call_user_func($blockFunction, $context); + %s} + '; + + const BLOCK_VAR_ELSE = '} else {%s'; + + /** + * Generate Mustache Template inheritance block variable PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param int $start Section start offset + * @param int $end Section end offset + * @param string $otag Current Mustache opening tag + * @param string $ctag Current Mustache closing tag + * @param int $level + * + * @return string Generated PHP source code + */ + private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level) + { + $id = var_export($id, true); + + $else = $this->walk($nodes, $level); + if ($else !== '') { + $else = sprintf($this->prepare(self::BLOCK_VAR_ELSE, $level + 1, false, true), $else); + } + + return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $else); + } + + const BLOCK_ARG = '%s => array($this, \'block%s\'),'; + + /** + * Generate Mustache Template inheritance block argument PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param int $start Section start offset + * @param int $end Section end offset + * @param string $otag Current Mustache opening tag + * @param string $ctag Current Mustache closing tag + * @param int $level + * + * @return string Generated PHP source code + */ + private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level) + { + $key = $this->block($nodes); + $id = var_export($id, true); + + return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key); + } + + const BLOCK_FUNCTION = ' + public function block%s($context) + { + $indent = $buffer = \'\';%s + + return $buffer; + } + '; + + /** + * Generate Mustache Template inheritance block function PHP source. + * + * @param array $nodes Array of child tokens + * + * @return string key of new block function + */ + private function block($nodes) + { + $code = $this->walk($nodes, 0); + $key = ucfirst(md5($code)); + + if (!isset($this->blocks[$key])) { + $this->blocks[$key] = sprintf($this->prepare(self::BLOCK_FUNCTION, 0), $key, $code); + } + + return $key; + } + + const SECTION_CALL = ' + $value = $context->%s(%s);%s + $buffer .= $this->section%s($context, $indent, $value); + '; + + const SECTION = ' + private function section%s(Mustache_Context $context, $indent, $value) + { + $buffer = \'\'; + + if (%s) { + $source = %s; + $result = (string) call_user_func($value, $source, %s); + if (strpos($result, \'{{\') === false) { + $buffer .= $result; + } else { + $buffer .= $this->mustache + ->loadLambda($result%s) + ->renderInternal($context); + } + } elseif (!empty($value)) { + $values = $this->isIterable($value) ? $value : array($value); + foreach ($values as $value) { + $context->push($value); + %s + $context->pop(); + } + } + + return $buffer; + } + '; + + /** + * Generate Mustache Template section PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param string[] $filters Array of filters + * @param int $start Section start offset + * @param int $end Section end offset + * @param string $otag Current Mustache opening tag + * @param string $ctag Current Mustache closing tag + * @param int $level + * + * @return string Generated section PHP source code + */ + private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level) + { + $source = var_export(substr($this->source, $start, $end - $start), true); + $callable = $this->getCallable(); + + if ($otag !== '{{' || $ctag !== '}}') { + $delimTag = var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true); + $helper = sprintf('$this->lambdaHelper->withDelimiters(%s)', $delimTag); + $delims = ', ' . $delimTag; + } else { + $helper = '$this->lambdaHelper'; + $delims = ''; + } + + $key = ucfirst(md5($delims . "\n" . $source)); + + if (!isset($this->sections[$key])) { + $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $helper, $delims, $this->walk($nodes, 2)); + } + + $method = $this->getFindMethod($id); + $id = var_export($id, true); + $filters = $this->getFilters($filters, $level); + + return sprintf($this->prepare(self::SECTION_CALL, $level), $method, $id, $filters, $key); + } + + const INVERTED_SECTION = ' + $value = $context->%s(%s);%s + if (empty($value)) { + %s + } + '; + + /** + * Generate Mustache Template inverted section PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param string[] $filters Array of filters + * @param int $level + * + * @return string Generated inverted section PHP source code + */ + private function invertedSection($nodes, $id, $filters, $level) + { + $method = $this->getFindMethod($id); + $id = var_export($id, true); + $filters = $this->getFilters($filters, $level); + + return sprintf($this->prepare(self::INVERTED_SECTION, $level), $method, $id, $filters, $this->walk($nodes, $level)); + } + + const PARTIAL_INDENT = ', $indent . %s'; + const PARTIAL = ' + if ($partial = $this->mustache->loadPartial(%s)) { + $buffer .= $partial->renderInternal($context%s); + } + '; + + /** + * Generate Mustache Template partial call PHP source. + * + * @param string $id Partial name + * @param string $indent Whitespace indent to apply to partial + * @param int $level + * + * @return string Generated partial call PHP source code + */ + private function partial($id, $indent, $level) + { + if ($indent !== '') { + $indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true)); + } else { + $indentParam = ''; + } + + return sprintf( + $this->prepare(self::PARTIAL, $level), + var_export($id, true), + $indentParam + ); + } + + const PARENT = ' + if ($parent = $this->mustache->loadPartial(%s)) { + $context->pushBlockContext(array(%s + )); + $buffer .= $parent->renderInternal($context, $indent); + $context->popBlockContext(); + } + '; + + const PARENT_NO_CONTEXT = ' + if ($parent = $this->mustache->loadPartial(%s)) { + $buffer .= $parent->renderInternal($context, $indent); + } + '; + + /** + * Generate Mustache Template inheritance parent call PHP source. + * + * @param string $id Parent tag name + * @param string $indent Whitespace indent to apply to parent + * @param array $children Child nodes + * @param int $level + * + * @return string Generated PHP source code + */ + private function parent($id, $indent, array $children, $level) + { + $realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs')); + + if (empty($realChildren)) { + return sprintf($this->prepare(self::PARENT_NO_CONTEXT, $level), var_export($id, true)); + } + + return sprintf( + $this->prepare(self::PARENT, $level), + var_export($id, true), + $this->walk($realChildren, $level + 1) + ); + } + + /** + * Helper method for filtering out non-block-arg tokens. + * + * @param array $node + * + * @return bool True if $node is a block arg token + */ + private static function onlyBlockArgs(array $node) + { + return $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_BLOCK_ARG; + } + + const VARIABLE = ' + $value = $this->resolveValue($context->%s(%s), $context);%s + $buffer .= %s($value === null ? \'\' : %s); + '; + + /** + * Generate Mustache Template variable interpolation PHP source. + * + * @param string $id Variable name + * @param string[] $filters Array of filters + * @param bool $escape Escape the variable value for output? + * @param int $level + * + * @return string Generated variable interpolation PHP source + */ + private function variable($id, $filters, $escape, $level) + { + $method = $this->getFindMethod($id); + $id = ($method !== 'last') ? var_export($id, true) : ''; + $filters = $this->getFilters($filters, $level); + $value = $escape ? $this->getEscape() : '$value'; + + return sprintf($this->prepare(self::VARIABLE, $level), $method, $id, $filters, $this->flushIndent(), $value); + } + + const FILTER = ' + $filter = $context->%s(%s); + if (!(%s)) { + throw new Mustache_Exception_UnknownFilterException(%s); + } + $value = call_user_func($filter, $value);%s + '; + + /** + * Generate Mustache Template variable filtering PHP source. + * + * @param string[] $filters Array of filters + * @param int $level + * + * @return string Generated filter PHP source + */ + private function getFilters(array $filters, $level) + { + if (empty($filters)) { + return ''; + } + + $name = array_shift($filters); + $method = $this->getFindMethod($name); + $filter = ($method !== 'last') ? var_export($name, true) : ''; + $callable = $this->getCallable('$filter'); + $msg = var_export($name, true); + + return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $callable, $msg, $this->getFilters($filters, $level)); + } + + const LINE = '$buffer .= "\n";'; + const TEXT = '$buffer .= %s%s;'; + + /** + * Generate Mustache Template output Buffer call PHP source. + * + * @param string $text + * @param int $level + * + * @return string Generated output Buffer call PHP source + */ + private function text($text, $level) + { + $indentNextLine = (substr($text, -1) === "\n"); + $code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true)); + $this->indentNextLine = $indentNextLine; + + return $code; + } + + /** + * Prepare PHP source code snippet for output. + * + * @param string $text + * @param int $bonus Additional indent level (default: 0) + * @param bool $prependNewline Prepend a newline to the snippet? (default: true) + * @param bool $appendNewline Append a newline to the snippet? (default: false) + * + * @return string PHP source code snippet + */ + private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false) + { + $text = ($prependNewline ? "\n" : '') . trim($text); + if ($prependNewline) { + $bonus++; + } + if ($appendNewline) { + $text .= "\n"; + } + + return preg_replace("/\n( {8})?/", "\n" . str_repeat(' ', $bonus * 4), $text); + } + + const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)'; + const CUSTOM_ESCAPE = 'call_user_func($this->mustache->getEscape(), %s)'; + + /** + * Get the current escaper. + * + * @param string $value (default: '$value') + * + * @return string Either a custom callback, or an inline call to `htmlspecialchars` + */ + private function getEscape($value = '$value') + { + if ($this->customEscape) { + return sprintf(self::CUSTOM_ESCAPE, $value); + } + + return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true)); + } + + /** + * Select the appropriate Context `find` method for a given $id. + * + * The return value will be one of `find`, `findDot`, `findAnchoredDot` or `last`. + * + * @see Mustache_Context::find + * @see Mustache_Context::findDot + * @see Mustache_Context::last + * + * @param string $id Variable name + * + * @return string `find` method name + */ + private function getFindMethod($id) + { + if ($id === '.') { + return 'last'; + } + + if (isset($this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) && $this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) { + if (substr($id, 0, 1) === '.') { + return 'findAnchoredDot'; + } + } + + if (strpos($id, '.') === false) { + return 'find'; + } + + return 'findDot'; + } + + const IS_CALLABLE = '!is_string(%s) && is_callable(%s)'; + const STRICT_IS_CALLABLE = 'is_object(%s) && is_callable(%s)'; + + /** + * Helper function to compile strict vs lax "is callable" logic. + * + * @param string $variable (default: '$value') + * + * @return string "is callable" logic + */ + private function getCallable($variable = '$value') + { + $tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE; + + return sprintf($tpl, $variable, $variable); + } + + const LINE_INDENT = '$indent . '; + + /** + * Get the current $indent prefix to write to the buffer. + * + * @return string "$indent . " or "" + */ + private function flushIndent() + { + if (!$this->indentNextLine) { + return ''; + } + + $this->indentNextLine = false; + + return self::LINE_INDENT; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Context.php b/system/vendor/mustache/mustache/src/Mustache/Context.php new file mode 100644 index 0000000..69c02e0 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Context.php @@ -0,0 +1,242 @@ +stack = array($context); + } + } + + /** + * Push a new Context frame onto the stack. + * + * @param mixed $value Object or array to use for context + */ + public function push($value) + { + array_push($this->stack, $value); + } + + /** + * Push a new Context frame onto the block context stack. + * + * @param mixed $value Object or array to use for block context + */ + public function pushBlockContext($value) + { + array_push($this->blockStack, $value); + } + + /** + * Pop the last Context frame from the stack. + * + * @return mixed Last Context frame (object or array) + */ + public function pop() + { + return array_pop($this->stack); + } + + /** + * Pop the last block Context frame from the stack. + * + * @return mixed Last block Context frame (object or array) + */ + public function popBlockContext() + { + return array_pop($this->blockStack); + } + + /** + * Get the last Context frame. + * + * @return mixed Last Context frame (object or array) + */ + public function last() + { + return end($this->stack); + } + + /** + * Find a variable in the Context stack. + * + * Starting with the last Context frame (the context of the innermost section), and working back to the top-level + * rendering context, look for a variable with the given name: + * + * * If the Context frame is an associative array which contains the key $id, returns the value of that element. + * * If the Context frame is an object, this will check first for a public method, then a public property named + * $id. Failing both of these, it will try `__isset` and `__get` magic methods. + * * If a value named $id is not found in any Context frame, returns an empty string. + * + * @param string $id Variable name + * + * @return mixed Variable value, or '' if not found + */ + public function find($id) + { + return $this->findVariableInStack($id, $this->stack); + } + + /** + * Find a 'dot notation' variable in the Context stack. + * + * Note that dot notation traversal bubbles through scope differently than the regular find method. After finding + * the initial chunk of the dotted name, each subsequent chunk is searched for only within the value of the previous + * result. For example, given the following context stack: + * + * $data = array( + * 'name' => 'Fred', + * 'child' => array( + * 'name' => 'Bob' + * ), + * ); + * + * ... and the Mustache following template: + * + * {{ child.name }} + * + * ... the `name` value is only searched for within the `child` value of the global Context, not within parent + * Context frames. + * + * @param string $id Dotted variable selector + * + * @return mixed Variable value, or '' if not found + */ + public function findDot($id) + { + $chunks = explode('.', $id); + $first = array_shift($chunks); + $value = $this->findVariableInStack($first, $this->stack); + + foreach ($chunks as $chunk) { + if ($value === '') { + return $value; + } + + $value = $this->findVariableInStack($chunk, array($value)); + } + + return $value; + } + + /** + * Find an 'anchored dot notation' variable in the Context stack. + * + * This is the same as findDot(), except it looks in the top of the context + * stack for the first value, rather than searching the whole context stack + * and starting from there. + * + * @see Mustache_Context::findDot + * + * @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id + * + * @param string $id Dotted variable selector + * + * @return mixed Variable value, or '' if not found + */ + public function findAnchoredDot($id) + { + $chunks = explode('.', $id); + $first = array_shift($chunks); + if ($first !== '') { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected id for findAnchoredDot: %s', $id)); + } + + $value = $this->last(); + + foreach ($chunks as $chunk) { + if ($value === '') { + return $value; + } + + $value = $this->findVariableInStack($chunk, array($value)); + } + + return $value; + } + + /** + * Find an argument in the block context stack. + * + * @param string $id + * + * @return mixed Variable value, or '' if not found + */ + public function findInBlock($id) + { + foreach ($this->blockStack as $context) { + if (array_key_exists($id, $context)) { + return $context[$id]; + } + } + + return ''; + } + + /** + * Helper function to find a variable in the Context stack. + * + * @see Mustache_Context::find + * + * @param string $id Variable name + * @param array $stack Context stack + * + * @return mixed Variable value, or '' if not found + */ + private function findVariableInStack($id, array $stack) + { + for ($i = count($stack) - 1; $i >= 0; $i--) { + $frame = &$stack[$i]; + + switch (gettype($frame)) { + case 'object': + if (!($frame instanceof Closure)) { + // Note that is_callable() *will not work here* + // See https://github.com/bobthecow/mustache.php/wiki/Magic-Methods + if (method_exists($frame, $id)) { + return $frame->$id(); + } + + if (isset($frame->$id)) { + return $frame->$id; + } + + if ($frame instanceof ArrayAccess && isset($frame[$id])) { + return $frame[$id]; + } + } + break; + + case 'array': + if (array_key_exists($id, $frame)) { + return $frame[$id]; + } + break; + } + } + + return ''; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Engine.php b/system/vendor/mustache/mustache/src/Mustache/Engine.php new file mode 100644 index 0000000..5e96e41 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Engine.php @@ -0,0 +1,829 @@ + true, + self::PRAGMA_BLOCKS => true, + self::PRAGMA_ANCHORED_DOT => true, + ); + + // Template cache + private $templates = array(); + + // Environment + private $templateClassPrefix = '__Mustache_'; + private $cache; + private $lambdaCache; + private $cacheLambdaTemplates = false; + private $loader; + private $partialsLoader; + private $helpers; + private $escape; + private $entityFlags = ENT_COMPAT; + private $charset = 'UTF-8'; + private $logger; + private $strictCallables = false; + private $pragmas = array(); + private $delimiters; + + // Services + private $tokenizer; + private $parser; + private $compiler; + + /** + * Mustache class constructor. + * + * Passing an $options array allows overriding certain Mustache options during instantiation: + * + * $options = array( + * // The class prefix for compiled templates. Defaults to '__Mustache_'. + * 'template_class_prefix' => '__MyTemplates_', + * + * // A Mustache cache instance or a cache directory string for compiled templates. + * // Mustache will not cache templates unless this is set. + * 'cache' => dirname(__FILE__).'/tmp/cache/mustache', + * + * // Override default permissions for cache files. Defaults to using the system-defined umask. It is + * // *strongly* recommended that you configure your umask properly rather than overriding permissions here. + * 'cache_file_mode' => 0666, + * + * // Optionally, enable caching for lambda section templates. This is generally not recommended, as lambda + * // sections are often too dynamic to benefit from caching. + * 'cache_lambda_templates' => true, + * + * // Customize the tag delimiters used by this engine instance. Note that overriding here changes the + * // delimiters used to parse all templates and partials loaded by this instance. To override just for a + * // single template, use an inline "change delimiters" tag at the start of the template file: + * // + * // {{=<% %>=}} + * // + * 'delimiters' => '<% %>', + * + * // A Mustache template loader instance. Uses a StringLoader if not specified. + * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'), + * + * // A Mustache loader instance for partials. + * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'), + * + * // An array of Mustache partials. Useful for quick-and-dirty string template loading, but not as + * // efficient or lazy as a Filesystem (or database) loader. + * 'partials' => array('foo' => file_get_contents(dirname(__FILE__).'/views/partials/foo.mustache')), + * + * // An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order + * // sections), or any other valid Mustache context value. They will be prepended to the context stack, + * // so they will be available in any template loaded by this Mustache instance. + * 'helpers' => array('i18n' => function ($text) { + * // do something translatey here... + * }), + * + * // An 'escape' callback, responsible for escaping double-mustache variables. + * 'escape' => function ($value) { + * return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8'); + * }, + * + * // Type argument for `htmlspecialchars`. Defaults to ENT_COMPAT. You may prefer ENT_QUOTES. + * 'entity_flags' => ENT_QUOTES, + * + * // Character set for `htmlspecialchars`. Defaults to 'UTF-8'. Use 'UTF-8'. + * 'charset' => 'ISO-8859-1', + * + * // A Mustache Logger instance. No logging will occur unless this is set. Using a PSR-3 compatible + * // logging library -- such as Monolog -- is highly recommended. A simple stream logger implementation is + * // available as well: + * 'logger' => new Mustache_Logger_StreamLogger('php://stderr'), + * + * // Only treat Closure instances and invokable classes as callable. If true, values like + * // `array('ClassName', 'methodName')` and `array($classInstance, 'methodName')`, which are traditionally + * // "callable" in PHP, are not called to resolve variables for interpolation or section contexts. This + * // helps protect against arbitrary code execution when user input is passed directly into the template. + * // This currently defaults to false, but will default to true in v3.0. + * 'strict_callables' => true, + * + * // Enable pragmas across all templates, regardless of the presence of pragma tags in the individual + * // templates. + * 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS], + * ); + * + * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable + * + * @param array $options (default: array()) + */ + public function __construct(array $options = array()) + { + if (isset($options['template_class_prefix'])) { + if ((string) $options['template_class_prefix'] === '') { + throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "template_class_prefix" must not be empty'); + } + + $this->templateClassPrefix = $options['template_class_prefix']; + } + + if (isset($options['cache'])) { + $cache = $options['cache']; + + if (is_string($cache)) { + $mode = isset($options['cache_file_mode']) ? $options['cache_file_mode'] : null; + $cache = new Mustache_Cache_FilesystemCache($cache, $mode); + } + + $this->setCache($cache); + } + + if (isset($options['cache_lambda_templates'])) { + $this->cacheLambdaTemplates = (bool) $options['cache_lambda_templates']; + } + + if (isset($options['loader'])) { + $this->setLoader($options['loader']); + } + + if (isset($options['partials_loader'])) { + $this->setPartialsLoader($options['partials_loader']); + } + + if (isset($options['partials'])) { + $this->setPartials($options['partials']); + } + + if (isset($options['helpers'])) { + $this->setHelpers($options['helpers']); + } + + if (isset($options['escape'])) { + if (!is_callable($options['escape'])) { + throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "escape" option must be callable'); + } + + $this->escape = $options['escape']; + } + + if (isset($options['entity_flags'])) { + $this->entityFlags = $options['entity_flags']; + } + + if (isset($options['charset'])) { + $this->charset = $options['charset']; + } + + if (isset($options['logger'])) { + $this->setLogger($options['logger']); + } + + if (isset($options['strict_callables'])) { + $this->strictCallables = $options['strict_callables']; + } + + if (isset($options['delimiters'])) { + $this->delimiters = $options['delimiters']; + } + + if (isset($options['pragmas'])) { + foreach ($options['pragmas'] as $pragma) { + if (!isset(self::$knownPragmas[$pragma])) { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Unknown pragma: "%s".', $pragma)); + } + $this->pragmas[$pragma] = true; + } + } + } + + /** + * Shortcut 'render' invocation. + * + * Equivalent to calling `$mustache->loadTemplate($template)->render($context);` + * + * @see Mustache_Engine::loadTemplate + * @see Mustache_Template::render + * + * @param string $template + * @param mixed $context (default: array()) + * + * @return string Rendered template + */ + public function render($template, $context = array()) + { + return $this->loadTemplate($template)->render($context); + } + + /** + * Get the current Mustache escape callback. + * + * @return callable|null + */ + public function getEscape() + { + return $this->escape; + } + + /** + * Get the current Mustache entitity type to escape. + * + * @return int + */ + public function getEntityFlags() + { + return $this->entityFlags; + } + + /** + * Get the current Mustache character set. + * + * @return string + */ + public function getCharset() + { + return $this->charset; + } + + /** + * Get the current globally enabled pragmas. + * + * @return array + */ + public function getPragmas() + { + return array_keys($this->pragmas); + } + + /** + * Set the Mustache template Loader instance. + * + * @param Mustache_Loader $loader + */ + public function setLoader(Mustache_Loader $loader) + { + $this->loader = $loader; + } + + /** + * Get the current Mustache template Loader instance. + * + * If no Loader instance has been explicitly specified, this method will instantiate and return + * a StringLoader instance. + * + * @return Mustache_Loader + */ + public function getLoader() + { + if (!isset($this->loader)) { + $this->loader = new Mustache_Loader_StringLoader(); + } + + return $this->loader; + } + + /** + * Set the Mustache partials Loader instance. + * + * @param Mustache_Loader $partialsLoader + */ + public function setPartialsLoader(Mustache_Loader $partialsLoader) + { + $this->partialsLoader = $partialsLoader; + } + + /** + * Get the current Mustache partials Loader instance. + * + * If no Loader instance has been explicitly specified, this method will instantiate and return + * an ArrayLoader instance. + * + * @return Mustache_Loader + */ + public function getPartialsLoader() + { + if (!isset($this->partialsLoader)) { + $this->partialsLoader = new Mustache_Loader_ArrayLoader(); + } + + return $this->partialsLoader; + } + + /** + * Set partials for the current partials Loader instance. + * + * @throws Mustache_Exception_RuntimeException If the current Loader instance is immutable + * + * @param array $partials (default: array()) + */ + public function setPartials(array $partials = array()) + { + if (!isset($this->partialsLoader)) { + $this->partialsLoader = new Mustache_Loader_ArrayLoader(); + } + + if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) { + throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance'); + } + + $this->partialsLoader->setTemplates($partials); + } + + /** + * Set an array of Mustache helpers. + * + * An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order sections), or + * any other valid Mustache context value. They will be prepended to the context stack, so they will be available in + * any template loaded by this Mustache instance. + * + * @throws Mustache_Exception_InvalidArgumentException if $helpers is not an array or Traversable + * + * @param array|Traversable $helpers + */ + public function setHelpers($helpers) + { + if (!is_array($helpers) && !$helpers instanceof Traversable) { + throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers'); + } + + $this->getHelpers()->clear(); + + foreach ($helpers as $name => $helper) { + $this->addHelper($name, $helper); + } + } + + /** + * Get the current set of Mustache helpers. + * + * @see Mustache_Engine::setHelpers + * + * @return Mustache_HelperCollection + */ + public function getHelpers() + { + if (!isset($this->helpers)) { + $this->helpers = new Mustache_HelperCollection(); + } + + return $this->helpers; + } + + /** + * Add a new Mustache helper. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + * @param mixed $helper + */ + public function addHelper($name, $helper) + { + $this->getHelpers()->add($name, $helper); + } + + /** + * Get a Mustache helper by name. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + * + * @return mixed Helper + */ + public function getHelper($name) + { + return $this->getHelpers()->get($name); + } + + /** + * Check whether this Mustache instance has a helper. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + * + * @return bool True if the helper is present + */ + public function hasHelper($name) + { + return $this->getHelpers()->has($name); + } + + /** + * Remove a helper by name. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + */ + public function removeHelper($name) + { + $this->getHelpers()->remove($name); + } + + /** + * Set the Mustache Logger instance. + * + * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface + * + * @param Mustache_Logger|Psr\Log\LoggerInterface $logger + */ + public function setLogger($logger = null) + { + if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) { + throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.'); + } + + if ($this->getCache()->getLogger() === null) { + $this->getCache()->setLogger($logger); + } + + $this->logger = $logger; + } + + /** + * Get the current Mustache Logger instance. + * + * @return Mustache_Logger|Psr\Log\LoggerInterface + */ + public function getLogger() + { + return $this->logger; + } + + /** + * Set the Mustache Tokenizer instance. + * + * @param Mustache_Tokenizer $tokenizer + */ + public function setTokenizer(Mustache_Tokenizer $tokenizer) + { + $this->tokenizer = $tokenizer; + } + + /** + * Get the current Mustache Tokenizer instance. + * + * If no Tokenizer instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Tokenizer + */ + public function getTokenizer() + { + if (!isset($this->tokenizer)) { + $this->tokenizer = new Mustache_Tokenizer(); + } + + return $this->tokenizer; + } + + /** + * Set the Mustache Parser instance. + * + * @param Mustache_Parser $parser + */ + public function setParser(Mustache_Parser $parser) + { + $this->parser = $parser; + } + + /** + * Get the current Mustache Parser instance. + * + * If no Parser instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Parser + */ + public function getParser() + { + if (!isset($this->parser)) { + $this->parser = new Mustache_Parser(); + } + + return $this->parser; + } + + /** + * Set the Mustache Compiler instance. + * + * @param Mustache_Compiler $compiler + */ + public function setCompiler(Mustache_Compiler $compiler) + { + $this->compiler = $compiler; + } + + /** + * Get the current Mustache Compiler instance. + * + * If no Compiler instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Compiler + */ + public function getCompiler() + { + if (!isset($this->compiler)) { + $this->compiler = new Mustache_Compiler(); + } + + return $this->compiler; + } + + /** + * Set the Mustache Cache instance. + * + * @param Mustache_Cache $cache + */ + public function setCache(Mustache_Cache $cache) + { + if (isset($this->logger) && $cache->getLogger() === null) { + $cache->setLogger($this->getLogger()); + } + + $this->cache = $cache; + } + + /** + * Get the current Mustache Cache instance. + * + * If no Cache instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Cache + */ + public function getCache() + { + if (!isset($this->cache)) { + $this->setCache(new Mustache_Cache_NoopCache()); + } + + return $this->cache; + } + + /** + * Get the current Lambda Cache instance. + * + * If 'cache_lambda_templates' is enabled, this is the default cache instance. Otherwise, it is a NoopCache. + * + * @see Mustache_Engine::getCache + * + * @return Mustache_Cache + */ + protected function getLambdaCache() + { + if ($this->cacheLambdaTemplates) { + return $this->getCache(); + } + + if (!isset($this->lambdaCache)) { + $this->lambdaCache = new Mustache_Cache_NoopCache(); + } + + return $this->lambdaCache; + } + + /** + * Helper method to generate a Mustache template class. + * + * This method must be updated any time options are added which make it so + * the same template could be parsed and compiled multiple different ways. + * + * @param string|Mustache_Source $source + * + * @return string Mustache Template class name + */ + public function getTemplateClassName($source) + { + // For the most part, adding a new option here should do the trick. + // + // Pick a value here which is unique for each possible way the template + // could be compiled... but not necessarily unique per option value. See + // escape below, which only needs to differentiate between 'custom' and + // 'default' escapes. + // + // Keep this list in alphabetical order :) + $chunks = array( + 'charset' => $this->charset, + 'delimiters' => $this->delimiters ? $this->delimiters : '{{ }}', + 'entityFlags' => $this->entityFlags, + 'escape' => isset($this->escape) ? 'custom' : 'default', + 'key' => ($source instanceof Mustache_Source) ? $source->getKey() : 'source', + 'pragmas' => $this->getPragmas(), + 'strictCallables' => $this->strictCallables, + 'version' => self::VERSION, + ); + + $key = json_encode($chunks); + + // Template Source instances have already provided their own source key. For strings, just include the whole + // source string in the md5 hash. + if (!$source instanceof Mustache_Source) { + $key .= "\n" . $source; + } + + return $this->templateClassPrefix . md5($key); + } + + /** + * Load a Mustache Template by name. + * + * @param string $name + * + * @return Mustache_Template + */ + public function loadTemplate($name) + { + return $this->loadSource($this->getLoader()->load($name)); + } + + /** + * Load a Mustache partial Template by name. + * + * This is a helper method used internally by Template instances for loading partial templates. You can most likely + * ignore it completely. + * + * @param string $name + * + * @return Mustache_Template + */ + public function loadPartial($name) + { + try { + if (isset($this->partialsLoader)) { + $loader = $this->partialsLoader; + } elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) { + $loader = $this->loader; + } else { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return $this->loadSource($loader->load($name)); + } catch (Mustache_Exception_UnknownTemplateException $e) { + // If the named partial cannot be found, log then return null. + $this->log( + Mustache_Logger::WARNING, + 'Partial not found: "{name}"', + array('name' => $e->getTemplateName()) + ); + } + } + + /** + * Load a Mustache lambda Template by source. + * + * This is a helper method used by Template instances to generate subtemplates for Lambda sections. You can most + * likely ignore it completely. + * + * @param string $source + * @param string $delims (default: null) + * + * @return Mustache_Template + */ + public function loadLambda($source, $delims = null) + { + if ($delims !== null) { + $source = $delims . "\n" . $source; + } + + return $this->loadSource($source, $this->getLambdaCache()); + } + + /** + * Instantiate and return a Mustache Template instance by source. + * + * Optionally provide a Mustache_Cache instance. This is used internally by Mustache_Engine::loadLambda to respect + * the 'cache_lambda_templates' configuration option. + * + * @see Mustache_Engine::loadTemplate + * @see Mustache_Engine::loadPartial + * @see Mustache_Engine::loadLambda + * + * @param string|Mustache_Source $source + * @param Mustache_Cache $cache (default: null) + * + * @return Mustache_Template + */ + private function loadSource($source, Mustache_Cache $cache = null) + { + $className = $this->getTemplateClassName($source); + + if (!isset($this->templates[$className])) { + if ($cache === null) { + $cache = $this->getCache(); + } + + if (!class_exists($className, false)) { + if (!$cache->load($className)) { + $compiled = $this->compile($source); + $cache->cache($className, $compiled); + } + } + + $this->log( + Mustache_Logger::DEBUG, + 'Instantiating template: "{className}"', + array('className' => $className) + ); + + $this->templates[$className] = new $className($this); + } + + return $this->templates[$className]; + } + + /** + * Helper method to tokenize a Mustache template. + * + * @see Mustache_Tokenizer::scan + * + * @param string $source + * + * @return array Tokens + */ + private function tokenize($source) + { + return $this->getTokenizer()->scan($source, $this->delimiters); + } + + /** + * Helper method to parse a Mustache template. + * + * @see Mustache_Parser::parse + * + * @param string $source + * + * @return array Token tree + */ + private function parse($source) + { + $parser = $this->getParser(); + $parser->setPragmas($this->getPragmas()); + + return $parser->parse($this->tokenize($source)); + } + + /** + * Helper method to compile a Mustache template. + * + * @see Mustache_Compiler::compile + * + * @param string|Mustache_Source $source + * + * @return string generated Mustache template class code + */ + private function compile($source) + { + $name = $this->getTemplateClassName($source); + + $this->log( + Mustache_Logger::INFO, + 'Compiling template to "{className}" class', + array('className' => $name) + ); + + if ($source instanceof Mustache_Source) { + $source = $source->getSource(); + } + $tree = $this->parse($source); + + $compiler = $this->getCompiler(); + $compiler->setPragmas($this->getPragmas()); + + return $compiler->compile($source, $tree, $name, isset($this->escape), $this->charset, $this->strictCallables, $this->entityFlags); + } + + /** + * Add a log record if logging is enabled. + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + */ + private function log($level, $message, array $context = array()) + { + if (isset($this->logger)) { + $this->logger->log($level, $message, $context); + } + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Exception.php b/system/vendor/mustache/mustache/src/Mustache/Exception.php new file mode 100644 index 0000000..d4001a9 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Exception.php @@ -0,0 +1,18 @@ +token = $token; + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($msg, 0, $previous); + } else { + parent::__construct($msg); // @codeCoverageIgnore + } + } + + /** + * @return array + */ + public function getToken() + { + return $this->token; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php b/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php new file mode 100644 index 0000000..0651c17 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php @@ -0,0 +1,38 @@ +filterName = $filterName; + $message = sprintf('Unknown filter: %s', $filterName); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($message, 0, $previous); + } else { + parent::__construct($message); // @codeCoverageIgnore + } + } + + public function getFilterName() + { + return $this->filterName; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php b/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php new file mode 100644 index 0000000..193be78 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php @@ -0,0 +1,38 @@ +helperName = $helperName; + $message = sprintf('Unknown helper: %s', $helperName); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($message, 0, $previous); + } else { + parent::__construct($message); // @codeCoverageIgnore + } + } + + public function getHelperName() + { + return $this->helperName; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php b/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php new file mode 100644 index 0000000..32a778a --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php @@ -0,0 +1,38 @@ +templateName = $templateName; + $message = sprintf('Unknown template: %s', $templateName); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($message, 0, $previous); + } else { + parent::__construct($message); // @codeCoverageIgnore + } + } + + public function getTemplateName() + { + return $this->templateName; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/HelperCollection.php b/system/vendor/mustache/mustache/src/Mustache/HelperCollection.php new file mode 100644 index 0000000..5d8f73c --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/HelperCollection.php @@ -0,0 +1,172 @@ + $helper` pairs. + * + * @throws Mustache_Exception_InvalidArgumentException if the $helpers argument isn't an array or Traversable + * + * @param array|Traversable $helpers (default: null) + */ + public function __construct($helpers = null) + { + if ($helpers === null) { + return; + } + + if (!is_array($helpers) && !$helpers instanceof Traversable) { + throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); + } + + foreach ($helpers as $name => $helper) { + $this->add($name, $helper); + } + } + + /** + * Magic mutator. + * + * @see Mustache_HelperCollection::add + * + * @param string $name + * @param mixed $helper + */ + public function __set($name, $helper) + { + $this->add($name, $helper); + } + + /** + * Add a helper to this collection. + * + * @param string $name + * @param mixed $helper + */ + public function add($name, $helper) + { + $this->helpers[$name] = $helper; + } + + /** + * Magic accessor. + * + * @see Mustache_HelperCollection::get + * + * @param string $name + * + * @return mixed Helper + */ + public function __get($name) + { + return $this->get($name); + } + + /** + * Get a helper by name. + * + * @throws Mustache_Exception_UnknownHelperException If helper does not exist + * + * @param string $name + * + * @return mixed Helper + */ + public function get($name) + { + if (!$this->has($name)) { + throw new Mustache_Exception_UnknownHelperException($name); + } + + return $this->helpers[$name]; + } + + /** + * Magic isset(). + * + * @see Mustache_HelperCollection::has + * + * @param string $name + * + * @return bool True if helper is present + */ + public function __isset($name) + { + return $this->has($name); + } + + /** + * Check whether a given helper is present in the collection. + * + * @param string $name + * + * @return bool True if helper is present + */ + public function has($name) + { + return array_key_exists($name, $this->helpers); + } + + /** + * Magic unset(). + * + * @see Mustache_HelperCollection::remove + * + * @param string $name + */ + public function __unset($name) + { + $this->remove($name); + } + + /** + * Check whether a given helper is present in the collection. + * + * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present + * + * @param string $name + */ + public function remove($name) + { + if (!$this->has($name)) { + throw new Mustache_Exception_UnknownHelperException($name); + } + + unset($this->helpers[$name]); + } + + /** + * Clear the helper collection. + * + * Removes all helpers from this collection + */ + public function clear() + { + $this->helpers = array(); + } + + /** + * Check whether the helper collection is empty. + * + * @return bool True if the collection is empty + */ + public function isEmpty() + { + return empty($this->helpers); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/LambdaHelper.php b/system/vendor/mustache/mustache/src/Mustache/LambdaHelper.php new file mode 100644 index 0000000..e93dbfa --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/LambdaHelper.php @@ -0,0 +1,76 @@ + =}}`. (default: null) + */ + public function __construct(Mustache_Engine $mustache, Mustache_Context $context, $delims = null) + { + $this->mustache = $mustache; + $this->context = $context; + $this->delims = $delims; + } + + /** + * Render a string as a Mustache template with the current rendering context. + * + * @param string $string + * + * @return string Rendered template + */ + public function render($string) + { + return $this->mustache + ->loadLambda((string) $string, $this->delims) + ->renderInternal($this->context); + } + + /** + * Render a string as a Mustache template with the current rendering context. + * + * @param string $string + * + * @return string Rendered template + */ + public function __invoke($string) + { + return $this->render($string); + } + + /** + * Get a Lambda Helper with custom delimiters. + * + * @param string $delims Custom delimiters, in the format `{{= <% %> =}}` + * + * @return Mustache_LambdaHelper + */ + public function withDelimiters($delims) + { + return new self($this->mustache, $this->context, $delims); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Loader.php b/system/vendor/mustache/mustache/src/Mustache/Loader.php new file mode 100644 index 0000000..23adba1 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Loader.php @@ -0,0 +1,27 @@ + '{{ bar }}', + * 'baz' => 'Hey {{ qux }}!' + * ); + * + * $tpl = $loader->load('foo'); // '{{ bar }}' + * + * The ArrayLoader is used internally as a partials loader by Mustache_Engine instance when an array of partials + * is set. It can also be used as a quick-and-dirty Template loader. + */ +class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_MutableLoader +{ + private $templates; + + /** + * ArrayLoader constructor. + * + * @param array $templates Associative array of Template source (default: array()) + */ + public function __construct(array $templates = array()) + { + $this->templates = $templates; + } + + /** + * Load a Template. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + if (!isset($this->templates[$name])) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return $this->templates[$name]; + } + + /** + * Set an associative array of Template sources for this loader. + * + * @param array $templates + */ + public function setTemplates(array $templates) + { + $this->templates = $templates; + } + + /** + * Set a Template source by name. + * + * @param string $name + * @param string $template Mustache Template source + */ + public function setTemplate($name, $template) + { + $this->templates[$name] = $template; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php b/system/vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php new file mode 100644 index 0000000..3fb6353 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php @@ -0,0 +1,69 @@ +loaders = array(); + foreach ($loaders as $loader) { + $this->addLoader($loader); + } + } + + /** + * Add a Loader instance. + * + * @param Mustache_Loader $loader + */ + public function addLoader(Mustache_Loader $loader) + { + $this->loaders[] = $loader; + } + + /** + * Load a Template by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + foreach ($this->loaders as $loader) { + try { + return $loader->load($name); + } catch (Mustache_Exception_UnknownTemplateException $e) { + // do nothing, check the next loader. + } + } + + throw new Mustache_Exception_UnknownTemplateException($name); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php b/system/vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php new file mode 100644 index 0000000..e366df7 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php @@ -0,0 +1,135 @@ +load('foo'); // equivalent to `file_get_contents(dirname(__FILE__).'/views/foo.mustache'); + * + * This is probably the most useful Mustache Loader implementation. It can be used for partials and normal Templates: + * + * $m = new Mustache(array( + * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'), + * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'), + * )); + */ +class Mustache_Loader_FilesystemLoader implements Mustache_Loader +{ + private $baseDir; + private $extension = '.mustache'; + private $templates = array(); + + /** + * Mustache filesystem Loader constructor. + * + * Passing an $options array allows overriding certain Loader options during instantiation: + * + * $options = array( + * // The filename extension used for Mustache templates. Defaults to '.mustache' + * 'extension' => '.ms', + * ); + * + * @throws Mustache_Exception_RuntimeException if $baseDir does not exist + * + * @param string $baseDir Base directory containing Mustache template files + * @param array $options Array of Loader options (default: array()) + */ + public function __construct($baseDir, array $options = array()) + { + $this->baseDir = $baseDir; + + if (strpos($this->baseDir, '://') === false) { + $this->baseDir = realpath($this->baseDir); + } + + if ($this->shouldCheckPath() && !is_dir($this->baseDir)) { + throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir)); + } + + if (array_key_exists('extension', $options)) { + if (empty($options['extension'])) { + $this->extension = ''; + } else { + $this->extension = '.' . ltrim($options['extension'], '.'); + } + } + } + + /** + * Load a Template by name. + * + * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'); + * $loader->load('admin/dashboard'); // loads "./views/admin/dashboard.mustache"; + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + if (!isset($this->templates[$name])) { + $this->templates[$name] = $this->loadFile($name); + } + + return $this->templates[$name]; + } + + /** + * Helper function for loading a Mustache file by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found + * + * @param string $name + * + * @return string Mustache Template source + */ + protected function loadFile($name) + { + $fileName = $this->getFileName($name); + + if ($this->shouldCheckPath() && !file_exists($fileName)) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return file_get_contents($fileName); + } + + /** + * Helper function for getting a Mustache template file name. + * + * @param string $name + * + * @return string Template file name + */ + protected function getFileName($name) + { + $fileName = $this->baseDir . '/' . $name; + if (substr($fileName, 0 - strlen($this->extension)) !== $this->extension) { + $fileName .= $this->extension; + } + + return $fileName; + } + + /** + * Only check if baseDir is a directory and requested templates are files if + * baseDir is using the filesystem stream wrapper. + * + * @return bool Whether to check `is_dir` and `file_exists` + */ + protected function shouldCheckPath() + { + return strpos($this->baseDir, '://') === false || strpos($this->baseDir, 'file://') === 0; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php b/system/vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php new file mode 100644 index 0000000..ae297fe --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php @@ -0,0 +1,123 @@ +load('hello'); + * $goodbye = $loader->load('goodbye'); + * + * __halt_compiler(); + * + * @@ hello + * Hello, {{ planet }}! + * + * @@ goodbye + * Goodbye, cruel {{ planet }} + * + * Templates are deliniated by lines containing only `@@ name`. + * + * The InlineLoader is well-suited to micro-frameworks such as Silex: + * + * $app->register(new MustacheServiceProvider, array( + * 'mustache.loader' => new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__) + * )); + * + * $app->get('/{name}', function ($name) use ($app) { + * return $app['mustache']->render('hello', compact('name')); + * }) + * ->value('name', 'world'); + * + * // ... + * + * __halt_compiler(); + * + * @@ hello + * Hello, {{ name }}! + */ +class Mustache_Loader_InlineLoader implements Mustache_Loader +{ + protected $fileName; + protected $offset; + protected $templates; + + /** + * The InlineLoader requires a filename and offset to process templates. + * + * The magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually + * perfectly suited to the job: + * + * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__); + * + * Note that this only works if the loader is instantiated inside the same + * file as the inline templates. If the templates are located in another + * file, it would be necessary to manually specify the filename and offset. + * + * @param string $fileName The file to parse for inline templates + * @param int $offset A string offset for the start of the templates. + * This usually coincides with the `__halt_compiler` + * call, and the `__COMPILER_HALT_OFFSET__` + */ + public function __construct($fileName, $offset) + { + if (!is_file($fileName)) { + throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid filename.'); + } + + if (!is_int($offset) || $offset < 0) { + throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid file offset.'); + } + + $this->fileName = $fileName; + $this->offset = $offset; + } + + /** + * Load a Template by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + $this->loadTemplates(); + + if (!array_key_exists($name, $this->templates)) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return $this->templates[$name]; + } + + /** + * Parse and load templates from the end of a source file. + */ + protected function loadTemplates() + { + if ($this->templates === null) { + $this->templates = array(); + $data = file_get_contents($this->fileName, false, null, $this->offset); + foreach (preg_split("/^@@(?= [\w\d\.]+$)/m", $data, -1) as $chunk) { + if (trim($chunk)) { + list($name, $content) = explode("\n", $chunk, 2); + $this->templates[trim($name)] = trim($content); + } + } + } + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php b/system/vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php new file mode 100644 index 0000000..57fe5be --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php @@ -0,0 +1,31 @@ + '.ms', + * 'stat_props' => array('size', 'mtime'), + * ); + * + * Specifying 'stat_props' overrides the stat properties used to invalidate the template cache. By default, this + * uses 'mtime' and 'size', but this can be set to any of the properties supported by stat(): + * + * http://php.net/manual/en/function.stat.php + * + * You can also disable filesystem stat entirely: + * + * $options = array('stat_props' => null); + * + * But with great power comes great responsibility. Namely, if you disable stat-based cache invalidation, + * YOU MUST CLEAR THE TEMPLATE CACHE YOURSELF when your templates change. Make it part of your build or deploy + * process so you don't forget! + * + * @throws Mustache_Exception_RuntimeException if $baseDir does not exist. + * + * @param string $baseDir Base directory containing Mustache template files. + * @param array $options Array of Loader options (default: array()) + */ + public function __construct($baseDir, array $options = array()) + { + parent::__construct($baseDir, $options); + + if (array_key_exists('stat_props', $options)) { + if (empty($options['stat_props'])) { + $this->statProps = array(); + } else { + $this->statProps = $options['stat_props']; + } + } else { + $this->statProps = array('size', 'mtime'); + } + } + + /** + * Helper function for loading a Mustache file by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * + * @param string $name + * + * @return Mustache_Source Mustache Template source + */ + protected function loadFile($name) + { + $fileName = $this->getFileName($name); + + if (!file_exists($fileName)) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return new Mustache_Source_FilesystemSource($fileName, $this->statProps); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php b/system/vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php new file mode 100644 index 0000000..7012c03 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php @@ -0,0 +1,39 @@ +load('{{ foo }}'); // '{{ foo }}' + * + * This is the default Template Loader instance used by Mustache: + * + * $m = new Mustache; + * $tpl = $m->loadTemplate('{{ foo }}'); + * echo $tpl->render(array('foo' => 'bar')); // "bar" + */ +class Mustache_Loader_StringLoader implements Mustache_Loader +{ + /** + * Load a Template by source. + * + * @param string $name Mustache Template source + * + * @return string Mustache Template source + */ + public function load($name) + { + return $name; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Logger.php b/system/vendor/mustache/mustache/src/Mustache/Logger.php new file mode 100644 index 0000000..cb4037a --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Logger.php @@ -0,0 +1,126 @@ +log(Mustache_Logger::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + */ + public function alert($message, array $context = array()) + { + $this->log(Mustache_Logger::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + */ + public function critical($message, array $context = array()) + { + $this->log(Mustache_Logger::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + */ + public function error($message, array $context = array()) + { + $this->log(Mustache_Logger::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + */ + public function warning($message, array $context = array()) + { + $this->log(Mustache_Logger::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + */ + public function notice($message, array $context = array()) + { + $this->log(Mustache_Logger::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + */ + public function info($message, array $context = array()) + { + $this->log(Mustache_Logger::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + */ + public function debug($message, array $context = array()) + { + $this->log(Mustache_Logger::DEBUG, $message, $context); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php b/system/vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php new file mode 100644 index 0000000..402a148 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php @@ -0,0 +1,194 @@ + 100, + self::INFO => 200, + self::NOTICE => 250, + self::WARNING => 300, + self::ERROR => 400, + self::CRITICAL => 500, + self::ALERT => 550, + self::EMERGENCY => 600, + ); + + protected $level; + protected $stream = null; + protected $url = null; + + /** + * @throws InvalidArgumentException if the logging level is unknown + * + * @param resource|string $stream Resource instance or URL + * @param int $level The minimum logging level at which this handler will be triggered + */ + public function __construct($stream, $level = Mustache_Logger::ERROR) + { + $this->setLevel($level); + + if (is_resource($stream)) { + $this->stream = $stream; + } else { + $this->url = $stream; + } + } + + /** + * Close stream resources. + */ + public function __destruct() + { + if (is_resource($this->stream)) { + fclose($this->stream); + } + } + + /** + * Set the minimum logging level. + * + * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown + * + * @param int $level The minimum logging level which will be written + */ + public function setLevel($level) + { + if (!array_key_exists($level, self::$levels)) { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level)); + } + + $this->level = $level; + } + + /** + * Get the current minimum logging level. + * + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * Logs with an arbitrary level. + * + * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown + * + * @param mixed $level + * @param string $message + * @param array $context + */ + public function log($level, $message, array $context = array()) + { + if (!array_key_exists($level, self::$levels)) { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level)); + } + + if (self::$levels[$level] >= self::$levels[$this->level]) { + $this->writeLog($level, $message, $context); + } + } + + /** + * Write a record to the log. + * + * @throws Mustache_Exception_LogicException If neither a stream resource nor url is present + * @throws Mustache_Exception_RuntimeException If the stream url cannot be opened + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + */ + protected function writeLog($level, $message, array $context = array()) + { + if (!is_resource($this->stream)) { + if (!isset($this->url)) { + throw new Mustache_Exception_LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); + } + + $this->stream = fopen($this->url, 'a'); + if (!is_resource($this->stream)) { + // @codeCoverageIgnoreStart + throw new Mustache_Exception_RuntimeException(sprintf('The stream or file "%s" could not be opened.', $this->url)); + // @codeCoverageIgnoreEnd + } + } + + fwrite($this->stream, self::formatLine($level, $message, $context)); + } + + /** + * Gets the name of the logging level. + * + * @throws InvalidArgumentException if the logging level is unknown + * + * @param int $level + * + * @return string + */ + protected static function getLevelName($level) + { + return strtoupper($level); + } + + /** + * Format a log line for output. + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + * + * @return string + */ + protected static function formatLine($level, $message, array $context = array()) + { + return sprintf( + "%s: %s\n", + self::getLevelName($level), + self::interpolateMessage($message, $context) + ); + } + + /** + * Interpolate context values into the message placeholders. + * + * @param string $message + * @param array $context + * + * @return string + */ + protected static function interpolateMessage($message, array $context = array()) + { + if (strpos($message, '{') === false) { + return $message; + } + + // build a replacement array with braces around the context keys + $replace = array(); + foreach ($context as $key => $val) { + $replace['{' . $key . '}'] = $val; + } + + // interpolate replacement values into the the message and return + return strtr($message, $replace); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Parser.php b/system/vendor/mustache/mustache/src/Mustache/Parser.php new file mode 100644 index 0000000..0ec4192 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Parser.php @@ -0,0 +1,317 @@ +lineNum = -1; + $this->lineTokens = 0; + $this->pragmas = $this->defaultPragmas; + + $this->pragmaFilters = isset($this->pragmas[Mustache_Engine::PRAGMA_FILTERS]); + $this->pragmaBlocks = isset($this->pragmas[Mustache_Engine::PRAGMA_BLOCKS]); + + return $this->buildTree($tokens); + } + + /** + * Enable pragmas across all templates, regardless of the presence of pragma + * tags in the individual templates. + * + * @internal Users should set global pragmas in Mustache_Engine, not here :) + * + * @param string[] $pragmas + */ + public function setPragmas(array $pragmas) + { + $this->pragmas = array(); + foreach ($pragmas as $pragma) { + $this->enablePragma($pragma); + } + $this->defaultPragmas = $this->pragmas; + } + + /** + * Helper method for recursively building a parse tree. + * + * @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered + * + * @param array &$tokens Set of Mustache tokens + * @param array $parent Parent token (default: null) + * + * @return array Mustache Token parse tree + */ + private function buildTree(array &$tokens, array $parent = null) + { + $nodes = array(); + + while (!empty($tokens)) { + $token = array_shift($tokens); + + if ($token[Mustache_Tokenizer::LINE] === $this->lineNum) { + $this->lineTokens++; + } else { + $this->lineNum = $token[Mustache_Tokenizer::LINE]; + $this->lineTokens = 0; + } + + if ($this->pragmaFilters && isset($token[Mustache_Tokenizer::NAME])) { + list($name, $filters) = $this->getNameAndFilters($token[Mustache_Tokenizer::NAME]); + if (!empty($filters)) { + $token[Mustache_Tokenizer::NAME] = $name; + $token[Mustache_Tokenizer::FILTERS] = $filters; + } + } + + switch ($token[Mustache_Tokenizer::TYPE]) { + case Mustache_Tokenizer::T_DELIM_CHANGE: + $this->checkIfTokenIsAllowedInParent($parent, $token); + $this->clearStandaloneLines($nodes, $tokens); + break; + + case Mustache_Tokenizer::T_SECTION: + case Mustache_Tokenizer::T_INVERTED: + $this->checkIfTokenIsAllowedInParent($parent, $token); + $this->clearStandaloneLines($nodes, $tokens); + $nodes[] = $this->buildTree($tokens, $token); + break; + + case Mustache_Tokenizer::T_END_SECTION: + if (!isset($parent)) { + $msg = sprintf( + 'Unexpected closing tag: /%s on line %d', + $token[Mustache_Tokenizer::NAME], + $token[Mustache_Tokenizer::LINE] + ); + throw new Mustache_Exception_SyntaxException($msg, $token); + } + + if ($token[Mustache_Tokenizer::NAME] !== $parent[Mustache_Tokenizer::NAME]) { + $msg = sprintf( + 'Nesting error: %s (on line %d) vs. %s (on line %d)', + $parent[Mustache_Tokenizer::NAME], + $parent[Mustache_Tokenizer::LINE], + $token[Mustache_Tokenizer::NAME], + $token[Mustache_Tokenizer::LINE] + ); + throw new Mustache_Exception_SyntaxException($msg, $token); + } + + $this->clearStandaloneLines($nodes, $tokens); + $parent[Mustache_Tokenizer::END] = $token[Mustache_Tokenizer::INDEX]; + $parent[Mustache_Tokenizer::NODES] = $nodes; + + return $parent; + + case Mustache_Tokenizer::T_PARTIAL: + $this->checkIfTokenIsAllowedInParent($parent, $token); + //store the whitespace prefix for laters! + if ($indent = $this->clearStandaloneLines($nodes, $tokens)) { + $token[Mustache_Tokenizer::INDENT] = $indent[Mustache_Tokenizer::VALUE]; + } + $nodes[] = $token; + break; + + case Mustache_Tokenizer::T_PARENT: + $this->checkIfTokenIsAllowedInParent($parent, $token); + $nodes[] = $this->buildTree($tokens, $token); + break; + + case Mustache_Tokenizer::T_BLOCK_VAR: + if ($this->pragmaBlocks) { + // BLOCKS pragma is enabled, let's do this! + if (isset($parent) && $parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { + $token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_BLOCK_ARG; + } + $this->clearStandaloneLines($nodes, $tokens); + $nodes[] = $this->buildTree($tokens, $token); + } else { + // pretend this was just a normal "escaped" token... + $token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_ESCAPED; + // TODO: figure out how to figure out if there was a space after this dollar: + $token[Mustache_Tokenizer::NAME] = '$' . $token[Mustache_Tokenizer::NAME]; + $nodes[] = $token; + } + break; + + case Mustache_Tokenizer::T_PRAGMA: + $this->enablePragma($token[Mustache_Tokenizer::NAME]); + // no break + + case Mustache_Tokenizer::T_COMMENT: + $this->clearStandaloneLines($nodes, $tokens); + $nodes[] = $token; + break; + + default: + $nodes[] = $token; + break; + } + } + + if (isset($parent)) { + $msg = sprintf( + 'Missing closing tag: %s opened on line %d', + $parent[Mustache_Tokenizer::NAME], + $parent[Mustache_Tokenizer::LINE] + ); + throw new Mustache_Exception_SyntaxException($msg, $parent); + } + + return $nodes; + } + + /** + * Clear standalone line tokens. + * + * Returns a whitespace token for indenting partials, if applicable. + * + * @param array $nodes Parsed nodes + * @param array $tokens Tokens to be parsed + * + * @return array|null Resulting indent token, if any + */ + private function clearStandaloneLines(array &$nodes, array &$tokens) + { + if ($this->lineTokens > 1) { + // this is the third or later node on this line, so it can't be standalone + return; + } + + $prev = null; + if ($this->lineTokens === 1) { + // this is the second node on this line, so it can't be standalone + // unless the previous node is whitespace. + if ($prev = end($nodes)) { + if (!$this->tokenIsWhitespace($prev)) { + return; + } + } + } + + if ($next = reset($tokens)) { + // If we're on a new line, bail. + if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) { + return; + } + + // If the next token isn't whitespace, bail. + if (!$this->tokenIsWhitespace($next)) { + return; + } + + if (count($tokens) !== 1) { + // Unless it's the last token in the template, the next token + // must end in newline for this to be standalone. + if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") { + return; + } + } + + // Discard the whitespace suffix + array_shift($tokens); + } + + if ($prev) { + // Return the whitespace prefix, if any + return array_pop($nodes); + } + } + + /** + * Check whether token is a whitespace token. + * + * True if token type is T_TEXT and value is all whitespace characters. + * + * @param array $token + * + * @return bool True if token is a whitespace token + */ + private function tokenIsWhitespace(array $token) + { + if ($token[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_TEXT) { + return preg_match('/^\s*$/', $token[Mustache_Tokenizer::VALUE]); + } + + return false; + } + + /** + * Check whether a token is allowed inside a parent tag. + * + * @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag + * + * @param array|null $parent + * @param array $token + */ + private function checkIfTokenIsAllowedInParent($parent, array $token) + { + if (isset($parent) && $parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { + throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token); + } + } + + /** + * Split a tag name into name and filters. + * + * @param string $name + * + * @return array [Tag name, Array of filters] + */ + private function getNameAndFilters($name) + { + $filters = array_map('trim', explode('|', $name)); + $name = array_shift($filters); + + return array($name, $filters); + } + + /** + * Enable a pragma. + * + * @param string $name + */ + private function enablePragma($name) + { + $this->pragmas[$name] = true; + + switch ($name) { + case Mustache_Engine::PRAGMA_BLOCKS: + $this->pragmaBlocks = true; + break; + + case Mustache_Engine::PRAGMA_FILTERS: + $this->pragmaFilters = true; + break; + } + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Source.php b/system/vendor/mustache/mustache/src/Mustache/Source.php new file mode 100644 index 0000000..278c2cb --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Source.php @@ -0,0 +1,40 @@ +fileName = $fileName; + $this->statProps = $statProps; + } + + /** + * Get the Source key (used to generate the compiled class name). + * + * @throws Mustache_Exception_RuntimeException when a source file cannot be read + * + * @return string + */ + public function getKey() + { + $chunks = array( + 'fileName' => $this->fileName, + ); + + if (!empty($this->statProps)) { + if (!isset($this->stat)) { + $this->stat = @stat($this->fileName); + } + + if ($this->stat === false) { + throw new Mustache_Exception_RuntimeException(sprintf('Failed to read source file "%s".', $this->fileName)); + } + + foreach ($this->statProps as $prop) { + $chunks[$prop] = $this->stat[$prop]; + } + } + + return json_encode($chunks); + } + + /** + * Get the template Source. + * + * @return string + */ + public function getSource() + { + return file_get_contents($this->fileName); + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Template.php b/system/vendor/mustache/mustache/src/Mustache/Template.php new file mode 100644 index 0000000..4de8239 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Template.php @@ -0,0 +1,180 @@ +mustache = $mustache; + } + + /** + * Mustache Template instances can be treated as a function and rendered by simply calling them. + * + * $m = new Mustache_Engine; + * $tpl = $m->loadTemplate('Hello, {{ name }}!'); + * echo $tpl(array('name' => 'World')); // "Hello, World!" + * + * @see Mustache_Template::render + * + * @param mixed $context Array or object rendering context (default: array()) + * + * @return string Rendered template + */ + public function __invoke($context = array()) + { + return $this->render($context); + } + + /** + * Render this template given the rendering context. + * + * @param mixed $context Array or object rendering context (default: array()) + * + * @return string Rendered template + */ + public function render($context = array()) + { + return $this->renderInternal( + $this->prepareContextStack($context) + ); + } + + /** + * Internal rendering method implemented by Mustache Template concrete subclasses. + * + * This is where the magic happens :) + * + * NOTE: This method is not part of the Mustache.php public API. + * + * @param Mustache_Context $context + * @param string $indent (default: '') + * + * @return string Rendered template + */ + abstract public function renderInternal(Mustache_Context $context, $indent = ''); + + /** + * Tests whether a value should be iterated over (e.g. in a section context). + * + * In most languages there are two distinct array types: list and hash (or whatever you want to call them). Lists + * should be iterated, hashes should be treated as objects. Mustache follows this paradigm for Ruby, Javascript, + * Java, Python, etc. + * + * PHP, however, treats lists and hashes as one primitive type: array. So Mustache.php needs a way to distinguish + * between between a list of things (numeric, normalized array) and a set of variables to be used as section context + * (associative array). In other words, this will be iterated over: + * + * $items = array( + * array('name' => 'foo'), + * array('name' => 'bar'), + * array('name' => 'baz'), + * ); + * + * ... but this will be used as a section context block: + * + * $items = array( + * 1 => array('name' => 'foo'), + * 'banana' => array('name' => 'bar'), + * 42 => array('name' => 'baz'), + * ); + * + * @param mixed $value + * + * @return bool True if the value is 'iterable' + */ + protected function isIterable($value) + { + switch (gettype($value)) { + case 'object': + return $value instanceof Traversable; + + case 'array': + $i = 0; + foreach ($value as $k => $v) { + if ($k !== $i++) { + return false; + } + } + + return true; + + default: + return false; + } + } + + /** + * Helper method to prepare the Context stack. + * + * Adds the Mustache HelperCollection to the stack's top context frame if helpers are present. + * + * @param mixed $context Optional first context frame (default: null) + * + * @return Mustache_Context + */ + protected function prepareContextStack($context = null) + { + $stack = new Mustache_Context(); + + $helpers = $this->mustache->getHelpers(); + if (!$helpers->isEmpty()) { + $stack->push($helpers); + } + + if (!empty($context)) { + $stack->push($context); + } + + return $stack; + } + + /** + * Resolve a context value. + * + * Invoke the value if it is callable, otherwise return the value. + * + * @param mixed $value + * @param Mustache_Context $context + * + * @return string + */ + protected function resolveValue($value, Mustache_Context $context) + { + if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) { + return $this->mustache + ->loadLambda((string) call_user_func($value)) + ->renderInternal($context); + } + + return $value; + } +} diff --git a/system/vendor/mustache/mustache/src/Mustache/Tokenizer.php b/system/vendor/mustache/mustache/src/Mustache/Tokenizer.php new file mode 100644 index 0000000..2a172c3 --- /dev/null +++ b/system/vendor/mustache/mustache/src/Mustache/Tokenizer.php @@ -0,0 +1,347 @@ +'; + const T_PARENT = '<'; + const T_DELIM_CHANGE = '='; + const T_ESCAPED = '_v'; + const T_UNESCAPED = '{'; + const T_UNESCAPED_2 = '&'; + const T_TEXT = '_t'; + const T_PRAGMA = '%'; + const T_BLOCK_VAR = '$'; + const T_BLOCK_ARG = '$arg'; + + // Valid token types + private static $tagTypes = array( + self::T_SECTION => true, + self::T_INVERTED => true, + self::T_END_SECTION => true, + self::T_COMMENT => true, + self::T_PARTIAL => true, + self::T_PARENT => true, + self::T_DELIM_CHANGE => true, + self::T_ESCAPED => true, + self::T_UNESCAPED => true, + self::T_UNESCAPED_2 => true, + self::T_PRAGMA => true, + self::T_BLOCK_VAR => true, + ); + + // Token properties + const TYPE = 'type'; + const NAME = 'name'; + const OTAG = 'otag'; + const CTAG = 'ctag'; + const LINE = 'line'; + const INDEX = 'index'; + const END = 'end'; + const INDENT = 'indent'; + const NODES = 'nodes'; + const VALUE = 'value'; + const FILTERS = 'filters'; + + private $state; + private $tagType; + private $buffer; + private $tokens; + private $seenTag; + private $line; + + private $otag; + private $otagChar; + private $otagLen; + + private $ctag; + private $ctagChar; + private $ctagLen; + + /** + * Scan and tokenize template source. + * + * @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered + * @throws Mustache_Exception_InvalidArgumentException when $delimiters string is invalid + * + * @param string $text Mustache template source to tokenize + * @param string $delimiters Optionally, pass initial opening and closing delimiters (default: empty string) + * + * @return array Set of Mustache tokens + */ + public function scan($text, $delimiters = '') + { + // Setting mbstring.func_overload makes things *really* slow. + // Let's do everyone a favor and scan this string as ASCII instead. + // + // The INI directive was removed in PHP 8.0 so we don't need to check there (and can drop it + // when we remove support for older versions of PHP). + // + // @codeCoverageIgnoreStart + $encoding = null; + if (version_compare(PHP_VERSION, '8.0.0', '<')) { + if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) { + $encoding = mb_internal_encoding(); + mb_internal_encoding('ASCII'); + } + } + // @codeCoverageIgnoreEnd + + $this->reset(); + + if (is_string($delimiters) && $delimiters = trim($delimiters)) { + $this->setDelimiters($delimiters); + } + + $len = strlen($text); + for ($i = 0; $i < $len; $i++) { + switch ($this->state) { + case self::IN_TEXT: + $char = $text[$i]; + // Test whether it's time to change tags. + if ($char === $this->otagChar && substr($text, $i, $this->otagLen) === $this->otag) { + $i--; + $this->flushBuffer(); + $this->state = self::IN_TAG_TYPE; + } else { + $this->buffer .= $char; + if ($char === "\n") { + $this->flushBuffer(); + $this->line++; + } + } + break; + + case self::IN_TAG_TYPE: + $i += $this->otagLen - 1; + $char = $text[$i + 1]; + if (isset(self::$tagTypes[$char])) { + $tag = $char; + $this->tagType = $tag; + } else { + $tag = null; + $this->tagType = self::T_ESCAPED; + } + + if ($this->tagType === self::T_DELIM_CHANGE) { + $i = $this->changeDelimiters($text, $i); + $this->state = self::IN_TEXT; + } elseif ($this->tagType === self::T_PRAGMA) { + $i = $this->addPragma($text, $i); + $this->state = self::IN_TEXT; + } else { + if ($tag !== null) { + $i++; + } + $this->state = self::IN_TAG; + } + $this->seenTag = $i; + break; + + default: + $char = $text[$i]; + // Test whether it's time to change tags. + if ($char === $this->ctagChar && substr($text, $i, $this->ctagLen) === $this->ctag) { + $token = array( + self::TYPE => $this->tagType, + self::NAME => trim($this->buffer), + self::OTAG => $this->otag, + self::CTAG => $this->ctag, + self::LINE => $this->line, + self::INDEX => ($this->tagType === self::T_END_SECTION) ? $this->seenTag - $this->otagLen : $i + $this->ctagLen, + ); + + if ($this->tagType === self::T_UNESCAPED) { + // Clean up `{{{ tripleStache }}}` style tokens. + if ($this->ctag === '}}') { + if (($i + 2 < $len) && $text[$i + 2] === '}') { + $i++; + } else { + $msg = sprintf( + 'Mismatched tag delimiters: %s on line %d', + $token[self::NAME], + $token[self::LINE] + ); + + throw new Mustache_Exception_SyntaxException($msg, $token); + } + } else { + $lastName = $token[self::NAME]; + if (substr($lastName, -1) === '}') { + $token[self::NAME] = trim(substr($lastName, 0, -1)); + } else { + $msg = sprintf( + 'Mismatched tag delimiters: %s on line %d', + $token[self::NAME], + $token[self::LINE] + ); + + throw new Mustache_Exception_SyntaxException($msg, $token); + } + } + } + + $this->buffer = ''; + $i += $this->ctagLen - 1; + $this->state = self::IN_TEXT; + $this->tokens[] = $token; + } else { + $this->buffer .= $char; + } + break; + } + } + + $this->flushBuffer(); + + // Restore the user's encoding... + // @codeCoverageIgnoreStart + if ($encoding) { + mb_internal_encoding($encoding); + } + // @codeCoverageIgnoreEnd + + return $this->tokens; + } + + /** + * Helper function to reset tokenizer internal state. + */ + private function reset() + { + $this->state = self::IN_TEXT; + $this->tagType = null; + $this->buffer = ''; + $this->tokens = array(); + $this->seenTag = false; + $this->line = 0; + + $this->otag = '{{'; + $this->otagChar = '{'; + $this->otagLen = 2; + + $this->ctag = '}}'; + $this->ctagChar = '}'; + $this->ctagLen = 2; + } + + /** + * Flush the current buffer to a token. + */ + private function flushBuffer() + { + if (strlen($this->buffer) > 0) { + $this->tokens[] = array( + self::TYPE => self::T_TEXT, + self::LINE => $this->line, + self::VALUE => $this->buffer, + ); + $this->buffer = ''; + } + } + + /** + * Change the current Mustache delimiters. Set new `otag` and `ctag` values. + * + * @throws Mustache_Exception_SyntaxException when delimiter string is invalid + * + * @param string $text Mustache template source + * @param int $index Current tokenizer index + * + * @return int New index value + */ + private function changeDelimiters($text, $index) + { + $startIndex = strpos($text, '=', $index) + 1; + $close = '=' . $this->ctag; + $closeIndex = strpos($text, $close, $index); + + $token = array( + self::TYPE => self::T_DELIM_CHANGE, + self::LINE => $this->line, + ); + + try { + $this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex))); + } catch (Mustache_Exception_InvalidArgumentException $e) { + throw new Mustache_Exception_SyntaxException($e->getMessage(), $token); + } + + $this->tokens[] = $token; + + return $closeIndex + strlen($close) - 1; + } + + /** + * Set the current Mustache `otag` and `ctag` delimiters. + * + * @throws Mustache_Exception_InvalidArgumentException when delimiter string is invalid + * + * @param string $delimiters + */ + private function setDelimiters($delimiters) + { + if (!preg_match('/^\s*(\S+)\s+(\S+)\s*$/', $delimiters, $matches)) { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Invalid delimiters: %s', $delimiters)); + } + + list($_, $otag, $ctag) = $matches; + + $this->otag = $otag; + $this->otagChar = $otag[0]; + $this->otagLen = strlen($otag); + + $this->ctag = $ctag; + $this->ctagChar = $ctag[0]; + $this->ctagLen = strlen($ctag); + } + + /** + * Add pragma token. + * + * Pragmas are hoisted to the front of the template, so all pragma tokens + * will appear at the front of the token list. + * + * @param string $text + * @param int $index + * + * @return int New index value + */ + private function addPragma($text, $index) + { + $end = strpos($text, $this->ctag, $index); + $pragma = trim(substr($text, $index + 2, $end - $index - 2)); + + // Pragmas are hoisted to the front of the template. + array_unshift($this->tokens, array( + self::TYPE => self::T_PRAGMA, + self::NAME => $pragma, + self::LINE => 0, + )); + + return $end + $this->ctagLen - 1; + } +} diff --git a/system/vendor/smarty/smarty/CHANGELOG.md b/system/vendor/smarty/smarty/CHANGELOG.md new file mode 100644 index 0000000..450b4f1 --- /dev/null +++ b/system/vendor/smarty/smarty/CHANGELOG.md @@ -0,0 +1,3494 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [3.1.44] - 2022-01-18 + +### Fixed +- Fixed illegal characters bug in math function security check [#702](https://github.com/smarty-php/smarty/issues/702) + +## [3.1.43] - 2022-01-10 + +### Security +- Prevent evasion of the `static_classes` security policy. This addresses CVE-2021-21408 + +## [3.1.42] - 2022-01-10 + +### Security +- Prevent arbitrary PHP code execution through maliciously crafted expression for the math function. This addresses CVE-2021-29454 + +## [3.1.41] - 2022-01-09 + +### Security +- Rewrote the mailto function to not use `eval` when encoding with javascript + +## [3.1.40] - 2021-10-13 + +### Changed +- modifier escape now triggers a E_USER_NOTICE when an unsupported escape type is used https://github.com/smarty-php/smarty/pull/649 + +### Security +- More advanced javascript escaping to handle https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements thanks to m-haritonov + +## [3.1.39] - 2021-02-17 + +### Security +- Prevent access to `$smarty.template_object` in sandbox mode. This addresses CVE-2021-26119. +- Fixed code injection vulnerability by using illegal function names in `{function name='blah'}{/function}`. This addresses CVE-2021-26120. + +## [3.1.38] - 2021-01-08 + +### Fixed +- Smarty::SMARTY_VERSION wasn't updated https://github.com/smarty-php/smarty/issues/628 + +## [3.1.37] - 2021-01-07 + +### Changed +- Changed error handlers and handling of undefined constants for php8-compatibility (set $errcontext argument optional) https://github.com/smarty-php/smarty/issues/605 +- Changed expected error levels in unit tests for php8-compatibility +- Travis unit tests now run for all php versions >= 5.3, including php8 +- Travis runs on Xenial where possible + +### Fixed +- PHP5.3 compatibility fixes +- Brought lexer source functionally up-to-date with compiled version + +## [3.1.36] - 2020-04-14 + +### Fixed + - Smarty::SMARTY_VERSION wasn't updated in v3.1.35 https://github.com/smarty-php/smarty/issues/584 + +## [3.1.35] - 2020-04-14 + - remove whitespaces after comments https://github.com/smarty-php/smarty/issues/447 + - fix foreachelse on arrayiterators https://github.com/smarty-php/smarty/issues/506 + - fix files contained in git export archive for package maintainers https://github.com/smarty-php/smarty/issues/325 + - throw SmartyException when setting caching attributes for cacheable plugin https://github.com/smarty-php/smarty/issues/457 + - fix errors that occured where isset was replaced with null check such as https://github.com/smarty-php/smarty/issues/453 + - unit tests are now in the repository + +## 3.1.34 release - 05.11.2019 +13.01.2020 + - fix typo in exception message (JercSi) + - fix typehint warning with callable (bets4breakfast) + - add travis badge and compatability info to readme (matks) + - fix stdClass cast when compiling foreach (carpii) + - fix wrong set/get methods for memcached (IT-Experte) + - fix pborm assigning value to object variables in smarty_internal_compile_assign (Hunman) + - exclude error_reporting.ini from git export (glensc) + +## 3.1.34-dev-6 - +30.10.2018 + - bugfix a nested subblock in an inheritance child template was not replace by + outer level block with same name in same child template https://github.com/smarty-php/smarty/issues/500 + +29.10.2018 + - bugfix Smarty::$php_handling == PHP_PASSTHRU (default) did eat the "\n" (newline) character if it did directly followed + a PHP tag like "?>" or other https://github.com/smarty-php/smarty/issues/501 + +14.10.2018 + - bugfix autoloader exit shortcut https://github.com/smarty-php/smarty/issues/467 + +11.10.2018 + - bugfix {insert} not works when caching is enabled and included template is present + https://github.com/smarty-php/smarty/issues/496 + - bugfix in date-format modifier; NULL at date string or default_date did not produce correct output + https://github.com/smarty-php/smarty/pull/458 + +09.10.2018 + - bugfix fix of 26.8.2017 https://github.com/smarty-php/smarty/issues/327 + modifier is applied to sum expression https://github.com/smarty-php/smarty/issues/491 + - bugfix indexed arrays could not be defined "array(...)"" + +18.09.2018 + - bugfix large plain text template sections without a Smarty tag > 700kB could + could fail in version 3.1.32 and 3.1.33 because PHP preg_match() restrictions + https://github.com/smarty-php/smarty/issues/488 + +## 3.1.33 release - 12.09.2018 +## 3.1.33-dev-12 - +03.09.2018 + - bugfix {foreach} using new style property access like {$item@property} on + Smarty 2 style named foreach loop could produce errors https://github.com/smarty-php/smarty/issues/484 + +31.08.2018 + - bugfix some custom left and right delimiters like '{^' '^}' did not work + https://github.com/smarty-php/smarty/issues/450 https://github.com/smarty-php/smarty/pull/482 + + - reformating for PSR-2 coding standards https://github.com/smarty-php/smarty/pull/483 + + - bugfix on Windows absolute filepathes did fail if the drive letter was followed by a linux DIRECTORY_SEPARATOR + like C:/ at Smarty > 3.1.33-dev-5 https://github.com/smarty-php/smarty/issues/451 + + - PSR-2 code style fixes for config and template file Lexer/Parser generated with + the Smarty Lexer/Parser generator from https://github.com/smarty-php/smarty-lexer + https://github.com/smarty-php/smarty/pull/483 + +26.08.2018 + - bugfix/enhancement {capture} allow variable as capture block name in Smarty special variable + like $smarty.capture.$foo https://github.com/smarty-php/smarty/issues/478 https://github.com/smarty-php/smarty/pull/481 + +## 3.1.33-dev-6 - +19.08.2018 + - fix PSR-2 coding standards and PHPDoc blocks https://github.com/smarty-php/smarty/pull/452 + https://github.com/smarty-php/smarty/pull/475 + https://github.com/smarty-php/smarty/pull/473 + - bugfix PHP5.2 compatibility https://github.com/smarty-php/smarty/pull/472 + +## 3.1.33-dev-4 - +17.05.2018 + - bugfix strip-block produces different output in Smarty v3.1.32 https://github.com/smarty-php/smarty/issues/436 + - bugfix Smarty::compileAllTemplates ignores `$extension` parameter https://github.com/smarty-php/smarty/issues/437 + https://github.com/smarty-php/smarty/pull/438 + - improvement do not compute total property in {foreach} if not needed https://github.com/smarty-php/smarty/issues/443 + - bugfix plugins may not be loaded when setMergeCompiledIncludes is true https://github.com/smarty-php/smarty/issues/435 + +26.04.2018 + - bugfix regarding Security Vulnerability did not solve the problem under Linux. + Security issue CVE-2018-16831 + +## 3.1.32 - (24.04.2018) +24.04.2018 + - bugfix possible Security Vulnerability in Smarty_Security class. + +26.03.2018 + - bugfix plugins may not be loaded if {function} or {block} tags are executed in nocache mode + https://github.com/smarty-php/smarty/issues/371 + +26.03.2018 + - new feature {parent} = {$smarty.block.parent} {child} = {$smarty.block.child} + +23.03.2018 + - bugfix preg_replace could fail on large content resulting in a blank page https://github.com/smarty-php/smarty/issues/417 + +21.03.2018 + - bugfix {$smarty.section...} used outside {section}{/section} showed incorrect values if {section}{/section} was called inside + another loop https://github.com/smarty-php/smarty/issues/422 + - bugfix short form of {section} attributes did not work https://github.com/smarty-php/smarty/issues/428 + +17.03.2018 + - improvement Smarty::compileAllTemplates() exit with a non-zero status code if max errors is reached https://github.com/smarty-php/smarty/pull/402 + +16.03.2018 + - bugfix extends resource did not work with user defined left/right delimiter https://github.com/smarty-php/smarty/issues/419 + +22.11.2017 + - bugfix {break} and {continue} could fail if {foreach}{/foreach} did contain other + looping tags like {for}, {section} and {while} https://github.com/smarty-php/smarty/issues/323 + +20.11.2017 + - bugfix rework of newline spacing between tag code and template text. + now again identical with Smarty2 (forum topic 26878) + - replacement of " by ' + +05.11.2017 + - lexer/parser optimization + - code cleanup and optimizations + - bugfix {$smarty.section.name.loop} used together with {$smarty.section.name.total} could produce + wrong results (forum topic 27041) + +26.10.2017 + - bugfix Smarty version was not filled in header comment of compiled and cached files + - optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR + - deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors() + as Smarty does no longer use error suppression like @filemtime(). + for backward compatibility code is moved from Smarty class to an external class and still can be + called. + - correction of PHPDoc blocks + - minor code cleanup + +21.10.2017 + - bugfix custom delimiters could fail since modification of version 3.1.32-dev-23 + https://github.com/smarty-php/smarty/issues/394 + +18.10.2017 + - bugfix fix implementation of unclosed block tag in double quoted string of 12.10.2017 + https://github.com/smarty-php/smarty/issues/396 https://github.com/smarty-php/smarty/issues/397 + https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392 + +12.10.2017 + - bugfix $smarty.block.child and $smarty.block.parent could not be used like any + $smarty special variable https://github.com/smarty-php/smarty/issues/393 + - unclosed block tag in double quoted string must throw compiler exception. + https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392 + +07.10.2017 + - bugfix modification of 9.8.2017 did fail on some recursive + tag nesting. https://github.com/smarty-php/smarty/issues/389 + +26.8.2017 + - bugfix chained modifier failed when last modifier parameter is a signed value + https://github.com/smarty-php/smarty/issues/327 + - bugfix templates filepath with multibyte characters did not work + https://github.com/smarty-php/smarty/issues/385 + - bugfix {make_nocache} did display code if the template did not contain other nocache code + https://github.com/smarty-php/smarty/issues/369 + +09.8.2017 + - improvement repeated delimiter like {{ and }} will be treated as literal + https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw + +05.8.2017 + - bugfix wordwrap modifier could fail if used in nocache code. + converted plugin file shared.mb_wordwrap.php into modifier.mb_wordwrap.php + - cleanup of _getSmartyObj() + +31.7.2017 + - Call clearstatcache() after mkdir() failure https://github.com/smarty-php/smarty/pull/379 + +30.7.2017 + - rewrite mkdir() bugfix to retry automatically see https://github.com/smarty-php/smarty/pull/377 + https://github.com/smarty-php/smarty/pull/379 + +21.7.2017 + - security possible PHP code injection on custom resources at display() or fetch() + calls if the resource does not sanitize the template name + - bugfix fix 'mkdir(): File exists' error on create directory from parallel + processes https://github.com/smarty-php/smarty/pull/377 + - bugfix solve preg_match() hhvm parameter problem https://github.com/smarty-php/smarty/pull/372 + +27.5.2017 + - bugfix change compiled code for registered function and modifiers to called as callable to allow closures + https://github.com/smarty-php/smarty/pull/368, https://github.com/smarty-php/smarty/issues/273 + - bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler + - improvement replace phpversion() by PHP_VERSION constant. + https://github.com/smarty-php/smarty/pull/363 + +21.5.2017 + - performance store flag for already required shared plugin functions in static variable or + Smarty's $_cache to improve performance when plugins are often called + https://github.com/smarty-php/smarty/commit/51e0d5cd405d764a4ea257d1bac1fb1205f74528#commitcomment-22280086 + - bugfix remove special treatment of classes implementing ArrayAccess in {foreach} + https://github.com/smarty-php/smarty/issues/332 + - bugfix remove deleted files by clear_cache() and clear_compiled_template() from + ACP cache if present, add some is_file() checks to avoid possible warnings on filemtime() + caused by above functions. + https://github.com/smarty-php/smarty/issues/341 + - bugfix version 3.1.31 did fail under PHP 5.2 + https://github.com/smarty-php/smarty/issues/365 + +19.5.2017 + - change properties $accessMap and $obsoleteProperties from private to protected + https://github.com/smarty-php/smarty/issues/351 + - new feature The named capture buffers can now be accessed also as array + See NEWS_FEATURES.txt https://github.com/smarty-php/smarty/issues/366 + - improvement check if ini_get() and ini_set() not disabled + https://github.com/smarty-php/smarty/pull/362 + +24.4.2017 + - fix spelling https://github.com/smarty-php/smarty/commit/e3eda8a5f5653d8abb960eb1bc47e3eca679b1b4#commitcomment-21803095 + +17.4.2017 + - correct generated code on empty() and isset() call, observe change PHP behaviour since PHP 5.5 + https://github.com/smarty-php/smarty/issues/347 + +14.4.2017 + - merge pull requests https://github.com/smarty-php/smarty/pull/349, https://github.com/smarty-php/smarty/pull/322 and https://github.com/smarty-php/smarty/pull/337 to fix spelling and annotation + +13.4.2017 + - bugfix array_merge() parameter should be checked https://github.com/smarty-php/smarty/issues/350 + +## 3.1.31 - (14.12.2016) + 23.11.2016 + - move template object cache into static variables + + 19.11.2016 + - bugfix inheritance root child templates containing nested {block}{/block} could call sub-bock content from parent + template https://github.com/smarty-php/smarty/issues/317 + - change version checking + + 11.11.2016 + - bugfix when Smarty is using a cached template object on Smarty::fetch() or Smarty::isCached() the inheritance data + must be removed https://github.com/smarty-php/smarty/issues/312 + - smaller speed optimization + + 08.11.2016 + - add bootstrap file to load and register Smarty_Autoloader. Change composer.json to make it known to composer + + 07.11.2016 + - optimization of lexer speed https://github.com/smarty-php/smarty/issues/311 + + 27.10.2016 + - bugfix template function definitions array has not been cached between Smarty::fetch() and Smarty::display() calls + https://github.com/smarty-php/smarty/issues/301 + + 23.10.2016 + - improvement/bugfix when Smarty::fetch() is called on a template object the inheritance and tplFunctions property + should be copied to the called template object + + 21.10.2016 + - bugfix for compile locking touched timestamp of old compiled file was not restored on compilation error https://github.com/smarty-php/smarty/issues/308 + + 20.10.2016 + - bugfix nocache code was not removed in cache file when subtemplate did contain PHP short tags in text but no other + nocache code https://github.com/smarty-php/smarty/issues/300 + + 19.10.2016 + - bugfix {make_nocache $var} did fail when variable value did contain '\' https://github.com/smarty-php/smarty/issues/305 + - bugfix {make_nocache $var} remove spaces from variable value https://github.com/smarty-php/smarty/issues/304 + + 12.10.2016 + - bugfix {include} with template names including variable or constants could fail after bugfix from + 28.09.2016 https://github.com/smarty-php/smarty/issues/302 + + 08.10.2016 + - optimization move runtime extension for template functions into Smarty objects + + 29.09.2016 + - improvement new Smarty::$extends_recursion property to disable execution of {extends} in templates called by extends resource + https://github.com/smarty-php/smarty/issues/296 + + 28.09.2016 + - bugfix the generated code for calling a subtemplate must pass the template resource name in single quotes https://github.com/smarty-php/smarty/issues/299 + - bugfix nocache hash was not removed for tags in subtemplates https://github.com/smarty-php/smarty/issues/300 + + 27.09.2016 + - bugfix when Smarty does use an internally cached template object on Smarty::fetch() calls + the template and config variables must be cleared https://github.com/smarty-php/smarty/issues/297 + + 20.09.2016 + - bugfix some $smarty special template variables are no longer accessed as real variable. + using them on calls like {if isset($smarty.foo)} or {if empty($smarty.foo)} will fail + http://www.smarty.net/forums/viewtopic.php?t=26222 + - temporary fix for https://github.com/smarty-php/smarty/issues/293 main reason still under investigation + - improvement new tags {block_parent} {block_child} in template inheritance + + 19.09.2016 + - optimization clear compiled and cached folder completely on detected version change + - cleanup convert cache resource file method clear into runtime extension + + 15.09.2016 + - bugfix assigning a variable in if condition by function like {if $value = array_shift($array)} the function got called twice https://github.com/smarty-php/smarty/issues/291 + - bugfix function plugins called with assign attribute like {foo assign='bar'} did not output returned content because + because assumption was made that it was assigned to a variable https://github.com/smarty-php/smarty/issues/292 + - bugfix calling $smarty->isCached() on a not existing cache file with $smarty->cache_locking = true; could cause a 10 second delay http://www.smarty.net/forums/viewtopic.php?t=26282 + - improvement make Smarty::clearCompiledTemplate() on custom resource independent from changes of templateId computation + + 11.09.2016 + - improvement {math} misleading E_USER_WARNING messages when parameter value = null https://github.com/smarty-php/smarty/issues/288 + - improvement move often used code snippets into methods + - performance Smarty::configLoad() did load unneeded template source object + + 09.09.2016 + - bugfix/optimization {foreach} did not execute the {foreachelse} when iterating empty objects https://github.com/smarty-php/smarty/pull/287 + - bugfix {foreach} must keep the @properties when restoring a saved $item variable as the properties might be used outside {foreach} https://github.com/smarty-php/smarty/issues/267 + - improvement {foreach} observe {break n} and {continue n} nesting levels when restoring saved $item and $key variables + + 08.09.2016 + - bugfix implement wrapper for removed method getConfigVariable() https://github.com/smarty-php/smarty/issues/286 + + 07.09.2016 + - bugfix using nocache like attribute with value true like {plugin nocache=true} did not work https://github.com/smarty-php/smarty/issues/285 + - bugfix uppercase TRUE, FALSE and NULL did not work when security was enabled https://github.com/smarty-php/smarty/issues/282 + - bugfix when {foreach} was looping over an object the total property like {$item@total} did always return 1 https://github.com/smarty-php/smarty/issues/281 + - bugfix {capture}{/capture} did add in 3.1.30 unintended additional blank lines https://github.com/smarty-php/smarty/issues/268 + + 01.09.2016 + - performance require_once should be called only once for shared plugins https://github.com/smarty-php/smarty/issues/280 + + 26.08.2016 + - bugfix change of 23.08.2016 failed on linux when use_include_path = true + + 23.08.2016 + - bugfix remove constant DS as shortcut for DIRECTORY_SEPARATOR as the user may have defined it to something else https://github.com/smarty-php/smarty/issues/277 + + 20.08-2016 + - bugfix {config_load ... scope="global"} shall not throw an arror but fallback to scope="smarty" https://github.com/smarty-php/smarty/issues/274 + - bugfix {make_nocache} failed when using composer autoloader https://github.com/smarty-php/smarty/issues/275 + + 14.08.2016 + - bugfix $smarty_>debugging = true; did E_NOTICE messages when {eval} tag was used https://github.com/smarty-php/smarty/issues/266 + - bugfix Class 'Smarty_Internal_Runtime_ValidateCompiled' not found when upgrading from some older Smarty versions with existing + compiled or cached template files https://github.com/smarty-php/smarty/issues/269 + - optimization remove unneeded call to update acopes when {assign} scope and template scope was local (default) + +## 3.1.30 - (07.08.2016) + + 07.08.2016 + - bugfix update of 04.08.2016 was incomplete + + 05.08.2016 + - bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264 + - updated error checking at template and config default handler + + 04.08.2016 + - improvement move template function source parameter into extension + + 26.07.2016 + - optimization unneeded loading of compiled resource + + 24.07.2016 + - regression this->addPluginsDir('/abs/path/to/dir') adding absolute path without trailing '/' did fail https://github.com/smarty-php/smarty/issues/260 + + 23.07.2016 + - bugfix setTemplateDir('/') and setTemplateDir('') did create wrong absolute filepath https://github.com/smarty-php/smarty/issues/245 + - optimization of filepath normalization + - improvement remove double function declaration in plugin shared.escape_special_cars.php https://github.com/smarty-php/smarty/issues/229 + + 19.07.2016 + - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 + - bugfix {math} shell injection vulnerability patch provided by Tim Weber + + 18.07.2016 + - bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254 + - bugfix modifier on plugins like {plugin|modifier ... } did fail when the plugin does return an array https://github.com/smarty-php/smarty/issues/228 + - bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244 + - bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246 + + 14.07.2016 + - bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231 + + 13.07.2016 + - bugfix PHP 7 compatibility on registered compiler plugins https://github.com/smarty-php/smarty/issues/241 + - update testInstall() https://github.com/smarty-php/smarty/issues/248https://github.com/smarty-php/smarty/issues/248 + - bugfix enable debugging could fail when template objects did already exists https://github.com/smarty-php/smarty/issues/237 + - bugfix template function data should be merged when loading subtemplate https://github.com/smarty-php/smarty/issues/240 + - bugfix wrong parameter on compileAllTemplates() https://github.com/smarty-php/smarty/issues/231 + + 12.07.2016 + - bugfix {foreach} item variable must be created also on empty from array https://github.com/smarty-php/smarty/issues/238 and https://github.com/smarty-php/smarty/issues/239 + - bugfix enableSecurity() must init cache flags https://github.com/smarty-php/smarty/issues/247 + + 27.05.2016 + - bugfix/improvement of compileAlltemplates() follow symlinks in template folder (PHP >= 5.3.1) https://github.com/smarty-php/smarty/issues/224 + clear internal cache and expension handler for each template to avoid possible conflicts https://github.com/smarty-php/smarty/issues/231 + + 16.05.2016 + - optimization {foreach} compiler and processing + - broken PHP 5.3 and 5.4 compatibility + + 15.05.2016 + - optimization and cleanup of resource code + + 10.05.2016 + - optimization of inheritance processing + + 07.05.2016 + -bugfix Only variables should be assigned by reference https://github.com/smarty-php/smarty/issues/227 + + 02.05.2016 + - enhancement {block} tag names can now be variable https://github.com/smarty-php/smarty/issues/221 + + 01.05.2016 + - bugfix same relative filepath at {include} called from template in different folders could display wrong sub-template + + 29.04.2016 + - bugfix {strip} remove space on linebreak between html tags https://github.com/smarty-php/smarty/issues/213 + + 24.04.2016 + - bugfix nested {include} with relative file path could fail when called in {block} ... {/block} https://github.com/smarty-php/smarty/issues/218 + + 14.04.2016 + - bugfix special variable {$smarty.capture.name} was not case sensitive on name https://github.com/smarty-php/smarty/issues/210 + - bugfix the default template handler must calculate the source uid https://github.com/smarty-php/smarty/issues/205 + + 13.04.2016 + - bugfix template inheritance status must be saved when calling sub-templates https://github.com/smarty-php/smarty/issues/215 + + 27.03.2016 + - bugfix change of 11.03.2016 cause again {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153 + + 11.03.2016 + - optimization of capture and security handling + - improvement $smarty->clearCompiledTemplate() should return on recompiled or uncompiled resources + + 10.03.2016 + - optimization of resource processing + + 09.03.2016 + - improvement rework of 'scope' attribute handling see see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/194 + https://github.com/smarty-php/smarty/issues/186 https://github.com/smarty-php/smarty/issues/179 + - bugfix correct Autoloader update of 2.3.2014 https://github.com/smarty-php/smarty/issues/199 + + 04.03.2016 + - bugfix change from 01.03.2016 will cause $smarty->isCached(..) failure if called multiple time for same template + (forum topic 25935) + + 02.03.2016 + - revert autoloader optimizations because of unexplainable warning when using plugins https://github.com/smarty-php/smarty/issues/199 + + 01.03.2016 + - bugfix template objects must be cached on $smarty->fetch('foo.tpl) calls incase the template is fetched + multiple times (forum topic 25909) + + 25.02.2016 + - bugfix wrong _realpath with 4 or more parent-directories https://github.com/smarty-php/smarty/issues/190 + - optimization of _realpath + - bugfix instanceof expression in template code must be treated as value https://github.com/smarty-php/smarty/issues/191 + + 20.02.2016 + - bugfix {strip} must keep space between hmtl tags. Broken by changes of 10.2.2016 https://github.com/smarty-php/smarty/issues/184 + - new feature/bugfix {foreach}{section} add 'properties' attribute to force compilation of loop properties + see NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/189 + + 19.02.2016 + - revert output buffer flushing on display, echo content again because possible problems when PHP files had + characters (newline} after ?> at file end https://github.com/smarty-php/smarty/issues/187 + + 14.02.2016 + - new tag {make_nocache} read NEW_FEATURES.txt https://github.com/smarty-php/smarty/issues/110 + - optimization of sub-template processing + - bugfix using extendsall as default resource and {include} inside {block} tags could produce unexpected results https://github.com/smarty-php/smarty/issues/183 + - optimization of tag attribute compiling + - optimization make compiler tag object cache static for higher compilation speed + + 11.02.2016 + - improvement added KnockoutJS comments to trimwhitespace outputfilter https://github.com/smarty-php/smarty/issues/82 + https://github.com/smarty-php/smarty/pull/181 + + 10.02.2016 + - bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177 + - bugfix wrong precedence on special if conditions like '$foo is ... by $bar' could cause wrong code https://github.com/smarty-php/smarty/issues/178 + - improvement because of ambiguities the inline constant support has been removed from the $foo.bar syntax https://github.com/smarty-php/smarty/issues/149 + - bugfix other {strip} error with output tags between hmtl https://github.com/smarty-php/smarty/issues/180 + + 09.02.2016 + - move some code from parser into compiler + - reformat all code for unique style + - update/bugfix scope attribute handling reworked. Read the newfeatures.txt file + + 05.02.2016 + - improvement internal compiler changes + + 01.02.2016 + - bugfix {foreach} compilation failed when $smarty->merge_compiled_includes = true and pre-filters are used. + + 29.01.2016 + - bugfix implement replacement code for _tag_stack property https://github.com/smarty-php/smarty/issues/151 + + 28.01.2016 + - bugfix allow windows network filepath or wrapper (forum topic 25876) https://github.com/smarty-php/smarty/issues/170 + - bugfix if fetch('foo.tpl') is called on a template object the $parent parameter should default to the calling template object https://github.com/smarty-php/smarty/issues/152 + + 27.01.2016 + - revert bugfix compiling {section} did create warning + - bugfix {$smarty.section.customer.loop} did throw compiler error https://github.com/smarty-php/smarty/issues/161 + update of yesterdays fix + - bugfix string resource could inject code at {block} or inline subtemplates through PHP comments https://github.com/smarty-php/smarty/issues/157 + - bugfix output filters did not observe nocache code flhttps://github.com/smarty-php/smarty/issues/154g https://github.com/smarty-php/smarty/issues/160 + - bugfix {extends} with relative file path did not work https://github.com/smarty-php/smarty/issues/154 + https://github.com/smarty-php/smarty/issues/158 + - bugfix {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153 + + 26.01.2016 + - improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169 + - bugfix compiling {section} did create warning + - bugfix {$smarty.section.customer.loop} did throw compiler error https://github.com/smarty-php/smarty/issues/161 + + 02.01.2016 + - update scope handling + - optimize block plugin compiler + - improvement runtime checks if registered block plugins are callable + + 01.01.2016 + - remove Smarty::$resource_cache_mode property + + 31.12.2015 + - optimization of {assign}, {if} and {while} compiled code + + 30.12.2015 + - bugfix plugin names starting with "php" did not compile https://github.com/smarty-php/smarty/issues/147 + + 29.12.2015 + - bugfix Smarty::error_reporting was not observed when display() or fetch() was called on template objects https://github.com/smarty-php/smarty/issues/145 + + 28.12.2015 + - optimization of {foreach} code size and processing + + 27.12.2015 + - improve inheritance code + - update external methods + - code fixes + - PHPdoc updates + + 25.12.2015 + - compile {block} tag code and its processing into classes + - optimization replace hhvm extension by inline code + - new feature If ACP is enabled force an apc_compile_file() when compiled or cached template was updated + + 24.12.2015 + - new feature Compiler does now observe the template_dir setting and will create separate compiled files if required + - bugfix post filter did fail on template inheritance https://github.com/smarty-php/smarty/issues/144 + + 23.12.2015 + - optimization move internal method decodeProperties back into template object + - optimization move subtemplate processing back into template object + - new feature Caching does now observe the template_dir setting and will create separate cache files if required + + 22.12.2015 + - change $xxx_dir properties from private to protected in case Smarty class gets extended + - code optimizations + + 21.12.2015 + - bugfix a filepath starting with '/' or '\' on windows should normalize to the root dir + of current working drive https://github.com/smarty-php/smarty/issues/134 + - optimization of filepath normalization + - bugfix {strip} must remove all blanks between html tags https://github.com/smarty-php/smarty/issues/136 + + - 3.1.29 - (21.12.2015) + 21.12.2015 + - optimization improve speed of filetime checks on extends and extendsall resource + + 20.12.2015 + - bugfix failure when the default resource type was set to 'extendsall' https://github.com/smarty-php/smarty/issues/123 + - update compilation of Smarty special variables + - bugfix add addition check for OS type on normalization of file path https://github.com/smarty-php/smarty/issues/134 + - bugfix the source uid of the extendsall resource must contain $template_dir settings https://github.com/smarty-php/smarty/issues/123 + + 19.12.2015 + - bugfix using $smarty.capture.foo in expressions could fail https://github.com/smarty-php/smarty/pull/138 + - bugfix broken PHP 5.2 compatibility https://github.com/smarty-php/smarty/issues/139 + - remove no longer used code + - improvement make sure that compiled and cache templates never can contain a trailing '?>? + + 18.12.2015 + - bugfix regression when modifier parameter was followed by math https://github.com/smarty-php/smarty/issues/132 + + 17.12.2015 + - bugfix {$smarty.capture.nameFail} did lowercase capture name https://github.com/smarty-php/smarty/issues/135 + - bugfix using {block append/prepend} on same block in multiple levels of inheritance templates could fail (forum topic 25827) + - bugfix text content consisting of just a single '0' like in {if true}0{/if} was suppressed (forum topic 25834) + + 16.12.2015 + - bugfix {foreach} did fail if from atrribute is a Generator class https://github.com/smarty-php/smarty/issues/128 + - bugfix direct access $smarty->template_dir = 'foo'; should call Smarty::setTemplateDir() https://github.com/smarty-php/smarty/issues/121 + + 15.12.2015 + - bugfix {$smarty.cookies.foo} did return the $_COOKIE array not the 'foo' value https://github.com/smarty-php/smarty/issues/122 + - bugfix a call to clearAllCache() and other should clear all internal template object caches (forum topic 25828) + + 14.12.2015 + - bugfix {$smarty.config.foo} broken in 3.1.28 https://github.com/smarty-php/smarty/issues/120 + - bugfix multiple calls of {section} with same name droped E_NOTICE error https://github.com/smarty-php/smarty/issues/118 + + - 3.1.28 - (13.12.2015) + 13.12.2015 + - bugfix {foreach} and {section} with uppercase characters in name attribute did not work (forum topic 25819) + - bugfix $smarty->debugging_ctrl = 'URL' did not work (forum topic 25811) + - bugfix Debug Console could display incorrect data when using subtemplates + + 09.12.2015 + - bugfix 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/system/vendor/smarty/smarty/libs/plugins/block.textformat.php b/system/vendor/smarty/smarty/libs/plugins/block.textformat.php new file mode 100644 index 0000000..5e49463 --- /dev/null +++ b/system/vendor/smarty/smarty/libs/plugins/block.textformat.php @@ -0,0 +1,121 @@ + + * @throws \SmartyException + */ +function smarty_block_textformat($params, $content, Smarty_Internal_Template $template, &$repeat) +{ + if (is_null($content)) { + return; + } + if (Smarty::$_MBSTRING) { + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_modifier_mb_wordwrap', + 'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php' + ) + ) + ); + } + $style = null; + $indent = 0; + $indent_first = 0; + $indent_char = ' '; + $wrap = 80; + $wrap_char = "\n"; + $wrap_cut = false; + $assign = null; + foreach ($params as $_key => $_val) { + switch ($_key) { + case 'style': + case 'indent_char': + case 'wrap_char': + case 'assign': + $$_key = (string)$_val; + break; + case 'indent': + case 'indent_first': + case 'wrap': + $$_key = (int)$_val; + break; + case 'wrap_cut': + $$_key = (bool)$_val; + break; + default: + trigger_error("textformat: unknown attribute '{$_key}'"); + } + } + if ($style === 'email') { + $wrap = 72; + } + // split into paragraphs + $_paragraphs = preg_split('![\r\n]{2}!', $content); + foreach ($_paragraphs as &$_paragraph) { + if (!$_paragraph) { + continue; + } + // convert mult. spaces & special chars to single space + $_paragraph = + preg_replace( + array( + '!\s+!' . Smarty::$_UTF8_MODIFIER, + '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER + ), + array( + ' ', + '' + ), + $_paragraph + ); + // indent first line + if ($indent_first > 0) { + $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph; + } + // wordwrap sentences + if (Smarty::$_MBSTRING) { + $_paragraph = smarty_modifier_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); + } else { + $_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); + } + // indent lines + if ($indent > 0) { + $_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph); + } + } + $_output = implode($wrap_char . $wrap_char, $_paragraphs); + if ($assign) { + $template->assign($assign, $_output); + } else { + return $_output; + } +} diff --git a/system/vendor/smarty/smarty/libs/plugins/function.counter.php b/system/vendor/smarty/smarty/libs/plugins/function.counter.php new file mode 100644 index 0000000..a4129e7 --- /dev/null +++ b/system/vendor/smarty/smarty/libs/plugins/function.counter.php @@ -0,0 +1,62 @@ + + * @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) +{ + static $counters = array(); + $name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default'; + if (!isset($counters[ $name ])) { + $counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1); + } + $counter =& $counters[ $name ]; + if (isset($params[ 'start' ])) { + $counter[ 'start' ] = $counter[ 'count' ] = (int)$params[ 'start' ]; + } + if (!empty($params[ 'assign' ])) { + $counter[ 'assign' ] = $params[ 'assign' ]; + } + if (isset($counter[ 'assign' ])) { + $template->assign($counter[ 'assign' ], $counter[ 'count' ]); + } + if (isset($params[ 'print' ])) { + $print = (bool)$params[ 'print' ]; + } else { + $print = empty($counter[ 'assign' ]); + } + if ($print) { + $retval = $counter[ 'count' ]; + } else { + $retval = null; + } + if (isset($params[ 'skip' ])) { + $counter[ 'skip' ] = $params[ 'skip' ]; + } + if (isset($params[ 'direction' ])) { + $counter[ 'direction' ] = $params[ 'direction' ]; + } + if ($counter[ 'direction' ] === 'down') { + $counter[ 'count' ] -= $counter[ 'skip' ]; + } else { + $counter[ 'count' ] += $counter[ 'skip' ]; + } + return $retval; +} diff --git a/system/vendor/smarty/smarty/libs/plugins/function.cycle.php b/system/vendor/smarty/smarty/libs/plugins/function.cycle.php new file mode 100644 index 0000000..07ffcc5 --- /dev/null +++ b/system/vendor/smarty/smarty/libs/plugins/function.cycle.php @@ -0,0 +1,92 @@ + + * @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 + */ +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; + if (!isset($params[ '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' ]) { + $cycle_vars[ $name ][ 'index' ] = 0; + } + $cycle_vars[ $name ][ 'values' ] = $params[ 'values' ]; + } + if (isset($params[ 'delimiter' ])) { + $cycle_vars[ $name ][ 'delimiter' ] = $params[ 'delimiter' ]; + } elseif (!isset($cycle_vars[ $name ][ 'delimiter' ])) { + $cycle_vars[ $name ][ 'delimiter' ] = ','; + } + 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' ]); + } + if (!isset($cycle_vars[ $name ][ 'index' ]) || $reset) { + $cycle_vars[ $name ][ 'index' ] = 0; + } + if (isset($params[ 'assign' ])) { + $print = false; + $template->assign($params[ 'assign' ], $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]); + } + if ($print) { + $retval = $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]; + } else { + $retval = null; + } + if ($advance) { + if ($cycle_vars[ $name ][ 'index' ] >= count($cycle_array) - 1) { + $cycle_vars[ $name ][ 'index' ] = 0; + } else { + $cycle_vars[ $name ][ 'index' ]++; + } + } + return $retval; +} diff --git a/system/vendor/smarty/smarty/libs/plugins/function.fetch.php b/system/vendor/smarty/smarty/libs/plugins/function.fetch.php new file mode 100644 index 0000000..768761b --- /dev/null +++ b/system/vendor/smarty/smarty/libs/plugins/function.fetch.php @@ -0,0 +1,204 @@ + + * + * @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); + 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' ])) { + return; + } + } else { + // local file + if (!$template->smarty->security_policy->isTrustedResourceDir($params[ 'file' ])) { + return; + } + } + } + $content = ''; + if ($protocol === 'http') { + // http fetch + 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; + $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' ])) { + $port = 80; + } else { + $port = $uri_parts[ 'port' ]; + } + if (!empty($uri_parts[ 'user' ])) { + $user = $uri_parts[ 'user' ]; + } + if (!empty($uri_parts[ 'pass' ])) { + $pass = $uri_parts[ 'pass' ]; + } + // loop through parameters, setup headers + foreach ($params as $param_key => $param_value) { + switch ($param_key) { + case 'file': + case 'assign': + case 'assign_headers': + break; + case 'user': + if (!empty($param_value)) { + $user = $param_value; + } + break; + case 'pass': + if (!empty($param_value)) { + $pass = $param_value; + } + break; + case 'accept': + 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); + return; + } else { + $extra_headers[] = $param_value; + } + } + break; + case 'proxy_host': + if (!empty($param_value)) { + $proxy_host = $param_value; + } + break; + case 'proxy_port': + if (!preg_match('!\D!', $param_value)) { + $proxy_port = (int)$param_value; + } else { + trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE); + return; + } + break; + case 'agent': + if (!empty($param_value)) { + $agent = $param_value; + } + break; + case 'referer': + if (!empty($param_value)) { + $referer = $param_value; + } + break; + case 'timeout': + if (!preg_match('!\D!', $param_value)) { + $timeout = (int)$param_value; + } else { + 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); + return; + } + } + if (!empty($proxy_host) && !empty($proxy_port)) { + $_is_proxy = true; + $fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout); + } else { + $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout); + } + if (!$fp) { + trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE); + return; + } else { + 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)) { + fputs($fp, "Host: $host\r\n"); + } + if (!empty($accept)) { + fputs($fp, "Accept: $accept\r\n"); + } + if (!empty($agent)) { + fputs($fp, "User-Agent: $agent\r\n"); + } + 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 (!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); + } + fclose($fp); + $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 ])); + } + } + } else { + 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' ] . "'"); + } + } + if (!empty($params[ 'assign' ])) { + $template->assign($params[ 'assign' ], $content); + } else { + return $content; + } +} diff --git a/system/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php b/system/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php new file mode 100644 index 0000000..302358e --- /dev/null +++ b/system/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php @@ -0,0 +1,286 @@ +' output=$names} + * {html_checkboxes values=$ids checked=$checked separator='
' output=$names} + * + * Params: + * + * - name (optional) - string default "checkbox" + * - values (required) - array + * - options (optional) - associative array + * - checked (optional) - array default not set + * - separator (optional) - ie
or   + * - output (optional) - the output next to each checkbox + * - assign (optional) - assign the output as an array to this variable + * - 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) + * @author Christopher Kvarme + * @author credits to Monte Ohrt + * @version 1.0 + * + * @param array $params parameters + * @param Smarty_Internal_Template $template template object + * + * @return string + * @uses smarty_function_escape_special_chars() + * @throws \SmartyException + */ +function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template) +{ + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' + ) + ) + ); + $name = 'checkbox'; + $values = null; + $options = null; + $selected = array(); + $separator = ''; + $escape = true; + $labels = true; + $label_ids = false; + $output = null; + $extra = ''; + foreach ($params as $_key => $_val) { + switch ($_key) { + case 'name': + case 'separator': + $$_key = (string)$_val; + break; + case 'escape': + case 'labels': + case 'label_ids': + $$_key = (bool)$_val; + break; + case 'options': + $$_key = (array)$_val; + break; + case 'values': + case 'output': + $$_key = array_values((array)$_val); + break; + case 'checked': + case 'selected': + if (is_array($_val)) { + $selected = array(); + foreach ($_val as $_sel) { + if (is_object($_sel)) { + 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 + ); + continue; + } + } else { + $_sel = smarty_function_escape_special_chars((string)$_sel); + } + $selected[ $_sel ] = true; + } + } elseif (is_object($_val)) { + 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 + ); + } + } else { + $selected = smarty_function_escape_special_chars((string)$_val); + } + break; + case 'checkboxes': + trigger_error( + 'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', + E_USER_WARNING + ); + $options = (array)$_val; + break; + case 'assign': + break; + case 'strict': + break; + case 'disabled': + case 'readonly': + if (!empty($params[ 'strict' ])) { + if (!is_scalar($_val)) { + trigger_error( + "html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", + E_USER_NOTICE + ); + } + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + break; + } + // omit break; to fall through! + // no break + default: + 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); + } + break; + } + } + if (!isset($options) && !isset($values)) { + return ''; + } /* raise error here? */ + $_html_result = array(); + if (isset($options)) { + 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) { + $_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' ])) { + $template->assign($params[ 'assign' ], $_html_result); + } else { + return implode("\n", $_html_result); + } +} + +/** + * @param $name + * @param $value + * @param $output + * @param $selected + * @param $extra + * @param $separator + * @param $labels + * @param $label_ids + * @param bool $escape + * + * @return string + */ +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 + ); + 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 + ); + 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 .= '